diff --git a/go.mod b/go.mod index 4a54f7360776..bb6dfab8dd8f 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.65.0 - github.com/hashicorp/go-azure-sdk v0.20240111.1094251 + github.com/hashicorp/go-azure-sdk v0.20240112.1095456 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 a6c7149f5a2b..b445c324aee9 100644 --- a/go.sum +++ b/go.sum @@ -114,8 +114,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.65.0 h1:aOZV7HcxvqAlnaWJ/Fhfu321dXLs++TyBIVelWOb/8w= github.com/hashicorp/go-azure-helpers v0.65.0/go.mod h1:ELmZ65vzHJNTk6ml4jsPD+xq2gZb7t78D35s+XN02Kk= -github.com/hashicorp/go-azure-sdk v0.20240111.1094251 h1:tBsbiZILcmyZe8kazO7lrt/2JX/iGqmAD9N+xqZhmXE= -github.com/hashicorp/go-azure-sdk v0.20240111.1094251/go.mod h1:m5lGAt22BNeuIAgBZFnA7I9E4Gm9h4PflqFbR/Ey7Fs= +github.com/hashicorp/go-azure-sdk v0.20240112.1095456 h1:E2ttp4UVsMIzFlBlGk3r03DBpcaOkNuQjpENUwU5yZg= +github.com/hashicorp/go-azure-sdk v0.20240112.1095456/go.mod h1:m5lGAt22BNeuIAgBZFnA7I9E4Gm9h4PflqFbR/Ey7Fs= 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/kusto/2023-08-15/attacheddatabaseconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/client.go index 60062fbe9c4f..48860590ab41 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/client.go @@ -1,18 +1,26 @@ package attacheddatabaseconfigurations -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 AttachedDatabaseConfigurationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewAttachedDatabaseConfigurationsClientWithBaseURI(endpoint string) AttachedDatabaseConfigurationsClient { - return AttachedDatabaseConfigurationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewAttachedDatabaseConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*AttachedDatabaseConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "attacheddatabaseconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AttachedDatabaseConfigurationsClient: %+v", err) } + + return &AttachedDatabaseConfigurationsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/constants.go index 6f113a36d925..6fff6d6518e2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/constants.go @@ -1,6 +1,10 @@ package attacheddatabaseconfigurations -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. @@ -17,6 +21,19 @@ func PossibleValuesForAttachedDatabaseType() []string { } } +func (s *AttachedDatabaseType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAttachedDatabaseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAttachedDatabaseType(input string) (*AttachedDatabaseType, error) { vals := map[string]AttachedDatabaseType{ "microsoft.kusto/clusters/attacheddatabaseconfigurations": AttachedDatabaseTypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations, @@ -46,6 +63,19 @@ func PossibleValuesForDefaultPrincipalsModificationKind() []string { } } +func (s *DefaultPrincipalsModificationKind) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDefaultPrincipalsModificationKind(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDefaultPrincipalsModificationKind(input string) (*DefaultPrincipalsModificationKind, error) { vals := map[string]DefaultPrincipalsModificationKind{ "none": DefaultPrincipalsModificationKindNone, @@ -85,6 +115,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -118,6 +161,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_checknameavailability.go new file mode 100644 index 000000000000..3bc5527ca78c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_checknameavailability.go @@ -0,0 +1,57 @@ +package attacheddatabaseconfigurations + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input AttachedDatabaseConfigurationsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attachedDatabaseConfigurationCheckNameAvailability", 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_checknameavailability_autorest.go deleted file mode 100644 index 732d7ec501a4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package attacheddatabaseconfigurations - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input AttachedDatabaseConfigurationsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c AttachedDatabaseConfigurationsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input AttachedDatabaseConfigurationsCheckNameRequest) (*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/attachedDatabaseConfigurationCheckNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c AttachedDatabaseConfigurationsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_createorupdate.go new file mode 100644 index 000000000000..f096f1528d4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_createorupdate.go @@ -0,0 +1,75 @@ +package attacheddatabaseconfigurations + +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 AttachedDatabaseConfigurationsClient) CreateOrUpdate(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 AttachedDatabaseConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_createorupdate_autorest.go deleted file mode 100644 index ad625764008e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package attacheddatabaseconfigurations - -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 AttachedDatabaseConfigurationsClient) CreateOrUpdate(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c AttachedDatabaseConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) 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 AttachedDatabaseConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) (*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 AttachedDatabaseConfigurationsClient) 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_delete.go new file mode 100644 index 000000000000..e88930550541 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_delete.go @@ -0,0 +1,71 @@ +package attacheddatabaseconfigurations + +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 AttachedDatabaseConfigurationsClient) Delete(ctx context.Context, id AttachedDatabaseConfigurationId) (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 AttachedDatabaseConfigurationsClient) DeleteThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId) 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_delete_autorest.go deleted file mode 100644 index 554b338d451c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package attacheddatabaseconfigurations - -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 AttachedDatabaseConfigurationsClient) Delete(ctx context.Context, id AttachedDatabaseConfigurationId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c AttachedDatabaseConfigurationsClient) DeleteThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId) 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 AttachedDatabaseConfigurationsClient) preparerForDelete(ctx context.Context, id AttachedDatabaseConfigurationId) (*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 AttachedDatabaseConfigurationsClient) 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_get.go new file mode 100644 index 000000000000..44ddcee8bea2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_get.go @@ -0,0 +1,51 @@ +package attacheddatabaseconfigurations + +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 *AttachedDatabaseConfiguration +} + +// Get ... +func (c AttachedDatabaseConfigurationsClient) Get(ctx context.Context, id AttachedDatabaseConfigurationId) (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/kusto/2023-08-15/attacheddatabaseconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_get_autorest.go deleted file mode 100644 index 229079c049df..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package attacheddatabaseconfigurations - -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 *AttachedDatabaseConfiguration -} - -// Get ... -func (c AttachedDatabaseConfigurationsClient) Get(ctx context.Context, id AttachedDatabaseConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AttachedDatabaseConfigurationsClient) preparerForGet(ctx context.Context, id AttachedDatabaseConfigurationId) (*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 AttachedDatabaseConfigurationsClient) 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_listbycluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_listbycluster.go new file mode 100644 index 000000000000..6030714b5b3e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_listbycluster.go @@ -0,0 +1,53 @@ +package attacheddatabaseconfigurations + +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 ListByClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AttachedDatabaseConfigurationListResult +} + +// ListByCluster ... +func (c AttachedDatabaseConfigurationsClient) ListByCluster(ctx context.Context, id commonids.KustoClusterId) (result ListByClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/attachedDatabaseConfigurations", 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/kusto/2023-08-15/attacheddatabaseconfigurations/method_listbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_listbycluster_autorest.go deleted file mode 100644 index f84744f4f9cf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/method_listbycluster_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package attacheddatabaseconfigurations - -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 ListByClusterOperationResponse struct { - HttpResponse *http.Response - Model *AttachedDatabaseConfigurationListResult -} - -// ListByCluster ... -func (c AttachedDatabaseConfigurationsClient) ListByCluster(ctx context.Context, id commonids.KustoClusterId) (result ListByClusterOperationResponse, err error) { - req, err := c.preparerForListByCluster(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "ListByCluster", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "ListByCluster", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByCluster(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "ListByCluster", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByCluster prepares the ListByCluster request. -func (c AttachedDatabaseConfigurationsClient) preparerForListByCluster(ctx context.Context, id commonids.KustoClusterId) (*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/attachedDatabaseConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByCluster handles the response to the ListByCluster request. The method always -// closes the http.Response Body. -func (c AttachedDatabaseConfigurationsClient) responderForListByCluster(resp *http.Response) (result ListByClusterOperationResponse, 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/kusto/2023-08-15/clusterprincipalassignments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/client.go index 6c90bacce61d..2412ce6b030d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/client.go @@ -1,18 +1,26 @@ package clusterprincipalassignments -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 ClusterPrincipalAssignmentsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewClusterPrincipalAssignmentsClientWithBaseURI(endpoint string) ClusterPrincipalAssignmentsClient { - return ClusterPrincipalAssignmentsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewClusterPrincipalAssignmentsClientWithBaseURI(sdkApi sdkEnv.Api) (*ClusterPrincipalAssignmentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "clusterprincipalassignments", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ClusterPrincipalAssignmentsClient: %+v", err) } + + return &ClusterPrincipalAssignmentsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/constants.go index 9a2882262806..339660a31676 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/constants.go @@ -1,6 +1,10 @@ package clusterprincipalassignments -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForClusterPrincipalRole() []string { } } +func (s *ClusterPrincipalRole) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusterPrincipalRole(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClusterPrincipalRole(input string) (*ClusterPrincipalRole, error) { vals := map[string]ClusterPrincipalRole{ "alldatabasesadmin": ClusterPrincipalRoleAllDatabasesAdmin, @@ -45,6 +62,19 @@ func PossibleValuesForPrincipalAssignmentType() []string { } } +func (s *PrincipalAssignmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrincipalAssignmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrincipalAssignmentType(input string) (*PrincipalAssignmentType, error) { vals := map[string]PrincipalAssignmentType{ "microsoft.kusto/clusters/principalassignments": PrincipalAssignmentTypeMicrosoftPointKustoClustersPrincipalAssignments, @@ -74,6 +104,19 @@ func PossibleValuesForPrincipalType() []string { } } +func (s *PrincipalType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrincipalType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrincipalType(input string) (*PrincipalType, error) { vals := map[string]PrincipalType{ "app": PrincipalTypeApp, @@ -113,6 +156,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -146,6 +202,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_checknameavailability.go new file mode 100644 index 000000000000..dc180b93aa63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_checknameavailability.go @@ -0,0 +1,57 @@ +package clusterprincipalassignments + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ClusterPrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input ClusterPrincipalAssignmentCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/checkPrincipalAssignmentNameAvailability", 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/kusto/2023-08-15/clusterprincipalassignments/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_checknameavailability_autorest.go deleted file mode 100644 index 4fd4f017e579..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package clusterprincipalassignments - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c ClusterPrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input ClusterPrincipalAssignmentCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ClusterPrincipalAssignmentsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input ClusterPrincipalAssignmentCheckNameRequest) (*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/checkPrincipalAssignmentNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ClusterPrincipalAssignmentsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/clusterprincipalassignments/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_createorupdate.go new file mode 100644 index 000000000000..ffbdd4525656 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_createorupdate.go @@ -0,0 +1,74 @@ +package clusterprincipalassignments + +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 ClusterPrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) (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 ClusterPrincipalAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) 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/kusto/2023-08-15/clusterprincipalassignments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_createorupdate_autorest.go deleted file mode 100644 index 2e03cfb69e06..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package clusterprincipalassignments - -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 ClusterPrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ClusterPrincipalAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) 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 ClusterPrincipalAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) (*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 ClusterPrincipalAssignmentsClient) 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/kusto/2023-08-15/clusterprincipalassignments/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_delete.go new file mode 100644 index 000000000000..fd2029e069f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_delete.go @@ -0,0 +1,71 @@ +package clusterprincipalassignments + +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 ClusterPrincipalAssignmentsClient) Delete(ctx context.Context, id PrincipalAssignmentId) (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 ClusterPrincipalAssignmentsClient) DeleteThenPoll(ctx context.Context, id PrincipalAssignmentId) 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/kusto/2023-08-15/clusterprincipalassignments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_delete_autorest.go deleted file mode 100644 index 276677a3b05d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package clusterprincipalassignments - -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 ClusterPrincipalAssignmentsClient) Delete(ctx context.Context, id PrincipalAssignmentId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ClusterPrincipalAssignmentsClient) DeleteThenPoll(ctx context.Context, id PrincipalAssignmentId) 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 ClusterPrincipalAssignmentsClient) preparerForDelete(ctx context.Context, id PrincipalAssignmentId) (*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 ClusterPrincipalAssignmentsClient) 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/kusto/2023-08-15/clusterprincipalassignments/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_get.go new file mode 100644 index 000000000000..a4012e8a3443 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_get.go @@ -0,0 +1,51 @@ +package clusterprincipalassignments + +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 *ClusterPrincipalAssignment +} + +// Get ... +func (c ClusterPrincipalAssignmentsClient) Get(ctx context.Context, id PrincipalAssignmentId) (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/kusto/2023-08-15/clusterprincipalassignments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_get_autorest.go deleted file mode 100644 index 1aa40590ce5b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package clusterprincipalassignments - -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 *ClusterPrincipalAssignment -} - -// Get ... -func (c ClusterPrincipalAssignmentsClient) Get(ctx context.Context, id PrincipalAssignmentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ClusterPrincipalAssignmentsClient) preparerForGet(ctx context.Context, id PrincipalAssignmentId) (*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 ClusterPrincipalAssignmentsClient) 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/kusto/2023-08-15/clusterprincipalassignments/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_list.go new file mode 100644 index 000000000000..ef0695d4941c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_list.go @@ -0,0 +1,53 @@ +package clusterprincipalassignments + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClusterPrincipalAssignmentListResult +} + +// List ... +func (c ClusterPrincipalAssignmentsClient) List(ctx context.Context, id commonids.KustoClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/principalAssignments", 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/kusto/2023-08-15/clusterprincipalassignments/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_list_autorest.go deleted file mode 100644 index 65b8ec6703ab..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusterprincipalassignments - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *ClusterPrincipalAssignmentListResult -} - -// List ... -func (c ClusterPrincipalAssignmentsClient) List(ctx context.Context, id commonids.KustoClusterId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ClusterPrincipalAssignmentsClient) preparerForList(ctx context.Context, id commonids.KustoClusterId) (*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/principalAssignments", id.ID())), - 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 ClusterPrincipalAssignmentsClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/kusto/2023-08-15/clusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/client.go index 1e6fabf8cbaa..e4ab7fd89ad8 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/client.go @@ -1,18 +1,26 @@ package clusters -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 ClustersClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewClustersClientWithBaseURI(endpoint string) ClustersClient { - return ClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewClustersClientWithBaseURI(sdkApi sdkEnv.Api) (*ClustersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "clusters", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ClustersClient: %+v", err) } + + return &ClustersClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/constants.go index c107f7ba319e..63ed2133d2ca 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/constants.go @@ -1,6 +1,10 @@ package clusters -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. @@ -21,6 +25,19 @@ func PossibleValuesForAzureScaleType() []string { } } +func (s *AzureScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAzureScaleType(input string) (*AzureScaleType, error) { vals := map[string]AzureScaleType{ "automatic": AzureScaleTypeAutomatic, @@ -174,6 +191,19 @@ func PossibleValuesForAzureSkuName() []string { } } +func (s *AzureSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAzureSkuName(input string) (*AzureSkuName, error) { vals := map[string]AzureSkuName{ "dev(no sla)_standard_d11_v2": AzureSkuNameDevNoSLAStandardDOneOneVTwo, @@ -264,6 +294,19 @@ func PossibleValuesForAzureSkuTier() []string { } } +func (s *AzureSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAzureSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseAzureSkuTier(input string) (*AzureSkuTier, error) { vals := map[string]AzureSkuTier{ "basic": AzureSkuTierBasic, @@ -292,6 +335,19 @@ func PossibleValuesForClusterNetworkAccessFlag() []string { } } +func (s *ClusterNetworkAccessFlag) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusterNetworkAccessFlag(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClusterNetworkAccessFlag(input string) (*ClusterNetworkAccessFlag, error) { vals := map[string]ClusterNetworkAccessFlag{ "disabled": ClusterNetworkAccessFlagDisabled, @@ -318,6 +374,19 @@ func PossibleValuesForClusterType() []string { } } +func (s *ClusterType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusterType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseClusterType(input string) (*ClusterType, error) { vals := map[string]ClusterType{ "microsoft.kusto/clusters": ClusterTypeMicrosoftPointKustoClusters, @@ -347,6 +416,19 @@ func PossibleValuesForDatabaseShareOrigin() []string { } } +func (s *DatabaseShareOrigin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabaseShareOrigin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabaseShareOrigin(input string) (*DatabaseShareOrigin, error) { vals := map[string]DatabaseShareOrigin{ "datashare": DatabaseShareOriginDataShare, @@ -376,6 +458,19 @@ func PossibleValuesForEngineType() []string { } } +func (s *EngineType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEngineType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseEngineType(input string) (*EngineType, error) { vals := map[string]EngineType{ "v3": EngineTypeVThree, @@ -410,6 +505,19 @@ func PossibleValuesForLanguageExtensionImageName() []string { } } +func (s *LanguageExtensionImageName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLanguageExtensionImageName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLanguageExtensionImageName(input string) (*LanguageExtensionImageName, error) { vals := map[string]LanguageExtensionImageName{ "pythoncustomimage": LanguageExtensionImageNamePythonCustomImage, @@ -441,6 +549,19 @@ func PossibleValuesForLanguageExtensionName() []string { } } +func (s *LanguageExtensionName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLanguageExtensionName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseLanguageExtensionName(input string) (*LanguageExtensionName, error) { vals := map[string]LanguageExtensionName{ "python": LanguageExtensionNamePYTHON, @@ -469,6 +590,19 @@ func PossibleValuesForMigrationClusterRole() []string { } } +func (s *MigrationClusterRole) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMigrationClusterRole(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMigrationClusterRole(input string) (*MigrationClusterRole, error) { vals := map[string]MigrationClusterRole{ "destination": MigrationClusterRoleDestination, @@ -507,6 +641,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -540,6 +687,19 @@ func PossibleValuesForPublicIPType() []string { } } +func (s *PublicIPType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicIPType(input string) (*PublicIPType, error) { vals := map[string]PublicIPType{ "dualstack": PublicIPTypeDualStack, @@ -568,6 +728,19 @@ func PossibleValuesForPublicNetworkAccess() []string { } } +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { vals := map[string]PublicNetworkAccess{ "disabled": PublicNetworkAccessDisabled, @@ -596,6 +769,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, @@ -640,6 +826,19 @@ func PossibleValuesForState() []string { } } +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseState(input string) (*State, error) { vals := map[string]State{ "creating": StateCreating, @@ -676,6 +875,19 @@ func PossibleValuesForVnetState() []string { } } +func (s *VnetState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVnetState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVnetState(input string) (*VnetState, error) { vals := map[string]VnetState{ "disabled": VnetStateDisabled, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_addlanguageextensions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_addlanguageextensions.go new file mode 100644 index 000000000000..16a1d90b331a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_addlanguageextensions.go @@ -0,0 +1,75 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddLanguageExtensionsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AddLanguageExtensions ... +func (c ClustersClient) AddLanguageExtensions(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) (result AddLanguageExtensionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/addLanguageExtensions", 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 +} + +// AddLanguageExtensionsThenPoll performs AddLanguageExtensions then polls until it's completed +func (c ClustersClient) AddLanguageExtensionsThenPoll(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) error { + result, err := c.AddLanguageExtensions(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AddLanguageExtensions: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AddLanguageExtensions: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_addlanguageextensions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_addlanguageextensions_autorest.go deleted file mode 100644 index 60e6556fb8bf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_addlanguageextensions_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AddLanguageExtensionsOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AddLanguageExtensions ... -func (c ClustersClient) AddLanguageExtensions(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) (result AddLanguageExtensionsOperationResponse, err error) { - req, err := c.preparerForAddLanguageExtensions(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "AddLanguageExtensions", nil, "Failure preparing request") - return - } - - result, err = c.senderForAddLanguageExtensions(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "AddLanguageExtensions", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AddLanguageExtensionsThenPoll performs AddLanguageExtensions then polls until it's completed -func (c ClustersClient) AddLanguageExtensionsThenPoll(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) error { - result, err := c.AddLanguageExtensions(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AddLanguageExtensions: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AddLanguageExtensions: %+v", err) - } - - return nil -} - -// preparerForAddLanguageExtensions prepares the AddLanguageExtensions request. -func (c ClustersClient) preparerForAddLanguageExtensions(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) (*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/addLanguageExtensions", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAddLanguageExtensions sends the AddLanguageExtensions request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForAddLanguageExtensions(ctx context.Context, req *http.Request) (future AddLanguageExtensionsOperationResponse, 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/kusto/2023-08-15/clusters/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_checknameavailability.go new file mode 100644 index 000000000000..576000ac23f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_checknameavailability.go @@ -0,0 +1,56 @@ +package clusters + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ClustersClient) CheckNameAvailability(ctx context.Context, id LocationId, input ClusterCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/checkNameAvailability", 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/kusto/2023-08-15/clusters/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_checknameavailability_autorest.go deleted file mode 100644 index f2852ec723fb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_checknameavailability_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusters - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c ClustersClient) CheckNameAvailability(ctx context.Context, id LocationId, input ClusterCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ClustersClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input ClusterCheckNameRequest) (*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/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ClustersClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/clusters/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_createorupdate.go new file mode 100644 index 000000000000..16075ad9dbd1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_createorupdate.go @@ -0,0 +1,107 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c ClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KustoClusterId, input Cluster, options CreateOrUpdateOperationOptions) (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(), + OptionsObject: options, + } + + 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 ClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KustoClusterId, input Cluster, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/kusto/2023-08-15/clusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_createorupdate_autorest.go deleted file mode 100644 index 37f61eda4263..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_createorupdate_autorest.go +++ /dev/null @@ -1,114 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ClustersClient) CreateOrUpdate(ctx context.Context, id commonids.KustoClusterId, input Cluster, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KustoClusterId, input Cluster, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - 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 ClustersClient) preparerForCreateOrUpdate(ctx context.Context, id commonids.KustoClusterId, input Cluster, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) 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/kusto/2023-08-15/clusters/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_delete.go new file mode 100644 index 000000000000..8db1e23a2e23 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_delete.go @@ -0,0 +1,72 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ClustersClient) Delete(ctx context.Context, id commonids.KustoClusterId) (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 ClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KustoClusterId) 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/kusto/2023-08-15/clusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_delete_autorest.go deleted file mode 100644 index b08295dcd165..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_delete_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ClustersClient) Delete(ctx context.Context, id commonids.KustoClusterId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ClustersClient) DeleteThenPoll(ctx context.Context, id commonids.KustoClusterId) 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 ClustersClient) preparerForDelete(ctx context.Context, id commonids.KustoClusterId) (*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 ClustersClient) 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/kusto/2023-08-15/clusters/method_detachfollowerdatabases.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_detachfollowerdatabases.go new file mode 100644 index 000000000000..694536c1c72b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_detachfollowerdatabases.go @@ -0,0 +1,75 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DetachFollowerDatabasesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DetachFollowerDatabases ... +func (c ClustersClient) DetachFollowerDatabases(ctx context.Context, id commonids.KustoClusterId, input FollowerDatabaseDefinition) (result DetachFollowerDatabasesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/detachFollowerDatabases", 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 +} + +// DetachFollowerDatabasesThenPoll performs DetachFollowerDatabases then polls until it's completed +func (c ClustersClient) DetachFollowerDatabasesThenPoll(ctx context.Context, id commonids.KustoClusterId, input FollowerDatabaseDefinition) error { + result, err := c.DetachFollowerDatabases(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DetachFollowerDatabases: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DetachFollowerDatabases: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_detachfollowerdatabases_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_detachfollowerdatabases_autorest.go deleted file mode 100644 index 1034ba43df36..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_detachfollowerdatabases_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DetachFollowerDatabasesOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DetachFollowerDatabases ... -func (c ClustersClient) DetachFollowerDatabases(ctx context.Context, id commonids.KustoClusterId, input FollowerDatabaseDefinition) (result DetachFollowerDatabasesOperationResponse, err error) { - req, err := c.preparerForDetachFollowerDatabases(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DetachFollowerDatabases", nil, "Failure preparing request") - return - } - - result, err = c.senderForDetachFollowerDatabases(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DetachFollowerDatabases", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DetachFollowerDatabasesThenPoll performs DetachFollowerDatabases then polls until it's completed -func (c ClustersClient) DetachFollowerDatabasesThenPoll(ctx context.Context, id commonids.KustoClusterId, input FollowerDatabaseDefinition) error { - result, err := c.DetachFollowerDatabases(ctx, id, input) - if err != nil { - return fmt.Errorf("performing DetachFollowerDatabases: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DetachFollowerDatabases: %+v", err) - } - - return nil -} - -// preparerForDetachFollowerDatabases prepares the DetachFollowerDatabases request. -func (c ClustersClient) preparerForDetachFollowerDatabases(ctx context.Context, id commonids.KustoClusterId, input FollowerDatabaseDefinition) (*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/detachFollowerDatabases", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDetachFollowerDatabases sends the DetachFollowerDatabases request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForDetachFollowerDatabases(ctx context.Context, req *http.Request) (future DetachFollowerDatabasesOperationResponse, 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/kusto/2023-08-15/clusters/method_diagnosevirtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_diagnosevirtualnetwork.go new file mode 100644 index 000000000000..cf5dc0de1c4c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_diagnosevirtualnetwork.go @@ -0,0 +1,71 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnoseVirtualNetworkOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DiagnoseVirtualNetwork ... +func (c ClustersClient) DiagnoseVirtualNetwork(ctx context.Context, id commonids.KustoClusterId) (result DiagnoseVirtualNetworkOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/diagnoseVirtualNetwork", 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 +} + +// DiagnoseVirtualNetworkThenPoll performs DiagnoseVirtualNetwork then polls until it's completed +func (c ClustersClient) DiagnoseVirtualNetworkThenPoll(ctx context.Context, id commonids.KustoClusterId) error { + result, err := c.DiagnoseVirtualNetwork(ctx, id) + if err != nil { + return fmt.Errorf("performing DiagnoseVirtualNetwork: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DiagnoseVirtualNetwork: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_diagnosevirtualnetwork_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_diagnosevirtualnetwork_autorest.go deleted file mode 100644 index b77fa7fa424c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_diagnosevirtualnetwork_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DiagnoseVirtualNetworkOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DiagnoseVirtualNetwork ... -func (c ClustersClient) DiagnoseVirtualNetwork(ctx context.Context, id commonids.KustoClusterId) (result DiagnoseVirtualNetworkOperationResponse, err error) { - req, err := c.preparerForDiagnoseVirtualNetwork(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DiagnoseVirtualNetwork", nil, "Failure preparing request") - return - } - - result, err = c.senderForDiagnoseVirtualNetwork(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DiagnoseVirtualNetwork", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DiagnoseVirtualNetworkThenPoll performs DiagnoseVirtualNetwork then polls until it's completed -func (c ClustersClient) DiagnoseVirtualNetworkThenPoll(ctx context.Context, id commonids.KustoClusterId) error { - result, err := c.DiagnoseVirtualNetwork(ctx, id) - if err != nil { - return fmt.Errorf("performing DiagnoseVirtualNetwork: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DiagnoseVirtualNetwork: %+v", err) - } - - return nil -} - -// preparerForDiagnoseVirtualNetwork prepares the DiagnoseVirtualNetwork request. -func (c ClustersClient) preparerForDiagnoseVirtualNetwork(ctx context.Context, id commonids.KustoClusterId) (*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/diagnoseVirtualNetwork", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDiagnoseVirtualNetwork sends the DiagnoseVirtualNetwork request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForDiagnoseVirtualNetwork(ctx context.Context, req *http.Request) (future DiagnoseVirtualNetworkOperationResponse, 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/kusto/2023-08-15/clusters/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_get.go new file mode 100644 index 000000000000..e455fac3f451 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_get.go @@ -0,0 +1,52 @@ +package clusters + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Cluster +} + +// Get ... +func (c ClustersClient) Get(ctx context.Context, id commonids.KustoClusterId) (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/kusto/2023-08-15/clusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_get_autorest.go deleted file mode 100644 index 3d389398ca7c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_get_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package clusters - -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 GetOperationResponse struct { - HttpResponse *http.Response - Model *Cluster -} - -// Get ... -func (c ClustersClient) Get(ctx context.Context, id commonids.KustoClusterId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ClustersClient) preparerForGet(ctx context.Context, id commonids.KustoClusterId) (*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 ClustersClient) 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/kusto/2023-08-15/clusters/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_list.go new file mode 100644 index 000000000000..abf34156a892 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_list.go @@ -0,0 +1,53 @@ +package clusters + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ClusterListResult +} + +// List ... +func (c ClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Kusto/clusters", 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/kusto/2023-08-15/clusters/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_list_autorest.go deleted file mode 100644 index 5f7f90cf9eae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusters - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *ClusterListResult -} - -// List ... -func (c ClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ClustersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Kusto/clusters", id.ID())), - 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 ClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/kusto/2023-08-15/clusters/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listbyresourcegroup.go new file mode 100644 index 000000000000..47d2b91805e6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listbyresourcegroup.go @@ -0,0 +1,53 @@ +package clusters + +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 *ClusterListResult +} + +// ListByResourceGroup ... +func (c ClustersClient) 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.Kusto/clusters", 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/kusto/2023-08-15/clusters/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 6af1d374af18..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusters - -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 ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *ClusterListResult -} - -// ListByResourceGroup ... -func (c ClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ClustersClient) 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.Kusto/clusters", id.ID())), - 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 ClustersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, 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/kusto/2023-08-15/clusters/method_listfollowerdatabases.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listfollowerdatabases.go new file mode 100644 index 000000000000..e27c8da2cb40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listfollowerdatabases.go @@ -0,0 +1,53 @@ +package clusters + +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 ListFollowerDatabasesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *FollowerDatabaseListResult +} + +// ListFollowerDatabases ... +func (c ClustersClient) ListFollowerDatabases(ctx context.Context, id commonids.KustoClusterId) (result ListFollowerDatabasesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listFollowerDatabases", 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/kusto/2023-08-15/clusters/method_listfollowerdatabases_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listfollowerdatabases_autorest.go deleted file mode 100644 index 56cc872c04ed..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listfollowerdatabases_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusters - -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 ListFollowerDatabasesOperationResponse struct { - HttpResponse *http.Response - Model *FollowerDatabaseListResult -} - -// ListFollowerDatabases ... -func (c ClustersClient) ListFollowerDatabases(ctx context.Context, id commonids.KustoClusterId) (result ListFollowerDatabasesOperationResponse, err error) { - req, err := c.preparerForListFollowerDatabases(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListFollowerDatabases", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListFollowerDatabases", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListFollowerDatabases(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListFollowerDatabases", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListFollowerDatabases prepares the ListFollowerDatabases request. -func (c ClustersClient) preparerForListFollowerDatabases(ctx context.Context, id commonids.KustoClusterId) (*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/listFollowerDatabases", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListFollowerDatabases handles the response to the ListFollowerDatabases request. The method always -// closes the http.Response Body. -func (c ClustersClient) responderForListFollowerDatabases(resp *http.Response) (result ListFollowerDatabasesOperationResponse, 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/kusto/2023-08-15/clusters/method_listlanguageextensions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listlanguageextensions.go new file mode 100644 index 000000000000..eebf5b774664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listlanguageextensions.go @@ -0,0 +1,53 @@ +package clusters + +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 ListLanguageExtensionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *LanguageExtensionsList +} + +// ListLanguageExtensions ... +func (c ClustersClient) ListLanguageExtensions(ctx context.Context, id commonids.KustoClusterId) (result ListLanguageExtensionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listLanguageExtensions", 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/kusto/2023-08-15/clusters/method_listlanguageextensions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listlanguageextensions_autorest.go deleted file mode 100644 index 6fd9149db2c9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listlanguageextensions_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusters - -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 ListLanguageExtensionsOperationResponse struct { - HttpResponse *http.Response - Model *LanguageExtensionsList -} - -// ListLanguageExtensions ... -func (c ClustersClient) ListLanguageExtensions(ctx context.Context, id commonids.KustoClusterId) (result ListLanguageExtensionsOperationResponse, err error) { - req, err := c.preparerForListLanguageExtensions(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListLanguageExtensions", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListLanguageExtensions", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListLanguageExtensions(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListLanguageExtensions", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListLanguageExtensions prepares the ListLanguageExtensions request. -func (c ClustersClient) preparerForListLanguageExtensions(ctx context.Context, id commonids.KustoClusterId) (*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/listLanguageExtensions", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListLanguageExtensions handles the response to the ListLanguageExtensions request. The method always -// closes the http.Response Body. -func (c ClustersClient) responderForListLanguageExtensions(resp *http.Response) (result ListLanguageExtensionsOperationResponse, 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/kusto/2023-08-15/clusters/method_listskusbyresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listskusbyresource.go new file mode 100644 index 000000000000..59ff4a93ff33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listskusbyresource.go @@ -0,0 +1,53 @@ +package clusters + +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 ListSkusByResourceOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ListResourceSkusResult +} + +// ListSkusByResource ... +func (c ClustersClient) ListSkusByResource(ctx context.Context, id commonids.KustoClusterId) (result ListSkusByResourceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", 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/kusto/2023-08-15/clusters/method_listskusbyresource_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listskusbyresource_autorest.go deleted file mode 100644 index 5dd40d5ce202..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_listskusbyresource_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package clusters - -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 ListSkusByResourceOperationResponse struct { - HttpResponse *http.Response - Model *ListResourceSkusResult -} - -// ListSkusByResource ... -func (c ClustersClient) ListSkusByResource(ctx context.Context, id commonids.KustoClusterId) (result ListSkusByResourceOperationResponse, err error) { - req, err := c.preparerForListSkusByResource(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListSkusByResource", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListSkusByResource", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListSkusByResource(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListSkusByResource", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListSkusByResource prepares the ListSkusByResource request. -func (c ClustersClient) preparerForListSkusByResource(ctx context.Context, id commonids.KustoClusterId) (*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/skus", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListSkusByResource handles the response to the ListSkusByResource request. The method always -// closes the http.Response Body. -func (c ClustersClient) responderForListSkusByResource(resp *http.Response) (result ListSkusByResourceOperationResponse, 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/kusto/2023-08-15/clusters/method_migrate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_migrate.go new file mode 100644 index 000000000000..017d5478b6f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_migrate.go @@ -0,0 +1,75 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Migrate ... +func (c ClustersClient) Migrate(ctx context.Context, id commonids.KustoClusterId, input ClusterMigrateRequest) (result MigrateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrate", 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 +} + +// MigrateThenPoll performs Migrate then polls until it's completed +func (c ClustersClient) MigrateThenPoll(ctx context.Context, id commonids.KustoClusterId, input ClusterMigrateRequest) error { + result, err := c.Migrate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Migrate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Migrate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_migrate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_migrate_autorest.go deleted file mode 100644 index d0c79dbf752f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_migrate_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MigrateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Migrate ... -func (c ClustersClient) Migrate(ctx context.Context, id commonids.KustoClusterId, input ClusterMigrateRequest) (result MigrateOperationResponse, err error) { - req, err := c.preparerForMigrate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Migrate", nil, "Failure preparing request") - return - } - - result, err = c.senderForMigrate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Migrate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// MigrateThenPoll performs Migrate then polls until it's completed -func (c ClustersClient) MigrateThenPoll(ctx context.Context, id commonids.KustoClusterId, input ClusterMigrateRequest) error { - result, err := c.Migrate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Migrate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Migrate: %+v", err) - } - - return nil -} - -// preparerForMigrate prepares the Migrate request. -func (c ClustersClient) preparerForMigrate(ctx context.Context, id commonids.KustoClusterId, input ClusterMigrateRequest) (*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/migrate", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForMigrate sends the Migrate request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForMigrate(ctx context.Context, req *http.Request) (future MigrateOperationResponse, 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/kusto/2023-08-15/clusters/method_removelanguageextensions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_removelanguageextensions.go new file mode 100644 index 000000000000..b41681060140 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_removelanguageextensions.go @@ -0,0 +1,75 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoveLanguageExtensionsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RemoveLanguageExtensions ... +func (c ClustersClient) RemoveLanguageExtensions(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) (result RemoveLanguageExtensionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/removeLanguageExtensions", 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 +} + +// RemoveLanguageExtensionsThenPoll performs RemoveLanguageExtensions then polls until it's completed +func (c ClustersClient) RemoveLanguageExtensionsThenPoll(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) error { + result, err := c.RemoveLanguageExtensions(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RemoveLanguageExtensions: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RemoveLanguageExtensions: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_removelanguageextensions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_removelanguageextensions_autorest.go deleted file mode 100644 index d82eb7c82501..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_removelanguageextensions_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RemoveLanguageExtensionsOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RemoveLanguageExtensions ... -func (c ClustersClient) RemoveLanguageExtensions(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) (result RemoveLanguageExtensionsOperationResponse, err error) { - req, err := c.preparerForRemoveLanguageExtensions(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "RemoveLanguageExtensions", nil, "Failure preparing request") - return - } - - result, err = c.senderForRemoveLanguageExtensions(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "RemoveLanguageExtensions", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RemoveLanguageExtensionsThenPoll performs RemoveLanguageExtensions then polls until it's completed -func (c ClustersClient) RemoveLanguageExtensionsThenPoll(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) error { - result, err := c.RemoveLanguageExtensions(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RemoveLanguageExtensions: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RemoveLanguageExtensions: %+v", err) - } - - return nil -} - -// preparerForRemoveLanguageExtensions prepares the RemoveLanguageExtensions request. -func (c ClustersClient) preparerForRemoveLanguageExtensions(ctx context.Context, id commonids.KustoClusterId, input LanguageExtensionsList) (*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/removeLanguageExtensions", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRemoveLanguageExtensions sends the RemoveLanguageExtensions request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForRemoveLanguageExtensions(ctx context.Context, req *http.Request) (future RemoveLanguageExtensionsOperationResponse, 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/kusto/2023-08-15/clusters/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_start.go new file mode 100644 index 000000000000..39f1b91f2c70 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_start.go @@ -0,0 +1,71 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c ClustersClient) Start(ctx context.Context, id commonids.KustoClusterId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c ClustersClient) StartThenPoll(ctx context.Context, id commonids.KustoClusterId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_start_autorest.go deleted file mode 100644 index 7798ed02ddb8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_start_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StartOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Start ... -func (c ClustersClient) Start(ctx context.Context, id commonids.KustoClusterId) (result StartOperationResponse, err error) { - req, err := c.preparerForStart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = c.senderForStart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Start", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StartThenPoll performs Start then polls until it's completed -func (c ClustersClient) StartThenPoll(ctx context.Context, id commonids.KustoClusterId) error { - result, err := c.Start(ctx, id) - if err != nil { - return fmt.Errorf("performing Start: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Start: %+v", err) - } - - return nil -} - -// preparerForStart prepares the Start request. -func (c ClustersClient) preparerForStart(ctx context.Context, id commonids.KustoClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStart sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, 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/kusto/2023-08-15/clusters/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_stop.go new file mode 100644 index 000000000000..cb528e3b82c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_stop.go @@ -0,0 +1,71 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Stop ... +func (c ClustersClient) Stop(ctx context.Context, id commonids.KustoClusterId) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/stop", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// StopThenPoll performs Stop then polls until it's completed +func (c ClustersClient) StopThenPoll(ctx context.Context, id commonids.KustoClusterId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_stop_autorest.go deleted file mode 100644 index e6046d64519f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_stop_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StopOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Stop ... -func (c ClustersClient) Stop(ctx context.Context, id commonids.KustoClusterId) (result StopOperationResponse, err error) { - req, err := c.preparerForStop(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = c.senderForStop(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Stop", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// StopThenPoll performs Stop then polls until it's completed -func (c ClustersClient) StopThenPoll(ctx context.Context, id commonids.KustoClusterId) error { - result, err := c.Stop(ctx, id) - if err != nil { - return fmt.Errorf("performing Stop: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Stop: %+v", err) - } - - return nil -} - -// preparerForStop prepares the Stop request. -func (c ClustersClient) preparerForStop(ctx context.Context, id commonids.KustoClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForStop sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, 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/kusto/2023-08-15/clusters/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_update.go new file mode 100644 index 000000000000..3491d0c0c061 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_update.go @@ -0,0 +1,104 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c ClustersClient) Update(ctx context.Context, id commonids.KustoClusterId, input ClusterUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + 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 ClustersClient) UpdateThenPoll(ctx context.Context, id commonids.KustoClusterId, input ClusterUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/kusto/2023-08-15/clusters/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_update_autorest.go deleted file mode 100644 index c8ad95c97f37..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters/method_update_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ClustersClient) Update(ctx context.Context, id commonids.KustoClusterId, input ClusterUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ClustersClient) UpdateThenPoll(ctx context.Context, id commonids.KustoClusterId, input ClusterUpdate, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - 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 ClustersClient) preparerForUpdate(ctx context.Context, id commonids.KustoClusterId, input ClusterUpdate, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) 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/kusto/2023-08-15/databaseprincipalassignments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/client.go index c8a03f9a28fc..fe184bcd76ac 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/client.go @@ -1,18 +1,26 @@ package databaseprincipalassignments -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 DatabasePrincipalAssignmentsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDatabasePrincipalAssignmentsClientWithBaseURI(endpoint string) DatabasePrincipalAssignmentsClient { - return DatabasePrincipalAssignmentsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDatabasePrincipalAssignmentsClientWithBaseURI(sdkApi sdkEnv.Api) (*DatabasePrincipalAssignmentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "databaseprincipalassignments", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DatabasePrincipalAssignmentsClient: %+v", err) } + + return &DatabasePrincipalAssignmentsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/constants.go index 080703a10e25..d225e34ae78d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/constants.go @@ -1,6 +1,10 @@ package databaseprincipalassignments -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. @@ -17,6 +21,19 @@ func PossibleValuesForDatabasePrincipalAssignmentType() []string { } } +func (s *DatabasePrincipalAssignmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabasePrincipalAssignmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabasePrincipalAssignmentType(input string) (*DatabasePrincipalAssignmentType, error) { vals := map[string]DatabasePrincipalAssignmentType{ "microsoft.kusto/clusters/databases/principalassignments": DatabasePrincipalAssignmentTypeMicrosoftPointKustoClustersDatabasesPrincipalAssignments, @@ -52,6 +69,19 @@ func PossibleValuesForDatabasePrincipalRole() []string { } } +func (s *DatabasePrincipalRole) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabasePrincipalRole(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabasePrincipalRole(input string) (*DatabasePrincipalRole, error) { vals := map[string]DatabasePrincipalRole{ "admin": DatabasePrincipalRoleAdmin, @@ -86,6 +116,19 @@ func PossibleValuesForPrincipalType() []string { } } +func (s *PrincipalType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrincipalType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrincipalType(input string) (*PrincipalType, error) { vals := map[string]PrincipalType{ "app": PrincipalTypeApp, @@ -125,6 +168,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -158,6 +214,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_checknameavailability.go new file mode 100644 index 000000000000..433748db0cdd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_checknameavailability.go @@ -0,0 +1,57 @@ +package databaseprincipalassignments + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalAssignmentCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/checkPrincipalAssignmentNameAvailability", 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/kusto/2023-08-15/databaseprincipalassignments/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_checknameavailability_autorest.go deleted file mode 100644 index 76377a6af8d7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package databaseprincipalassignments - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalAssignmentCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c DatabasePrincipalAssignmentsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalAssignmentCheckNameRequest) (*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/checkPrincipalAssignmentNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c DatabasePrincipalAssignmentsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/databaseprincipalassignments/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_createorupdate.go new file mode 100644 index 000000000000..343c601221a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_createorupdate.go @@ -0,0 +1,74 @@ +package databaseprincipalassignments + +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 DatabasePrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) (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 DatabasePrincipalAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) 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/kusto/2023-08-15/databaseprincipalassignments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_createorupdate_autorest.go deleted file mode 100644 index fccbbee585c3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package databaseprincipalassignments - -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 DatabasePrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c DatabasePrincipalAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) 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 DatabasePrincipalAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) (*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 DatabasePrincipalAssignmentsClient) 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/kusto/2023-08-15/databaseprincipalassignments/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_delete.go new file mode 100644 index 000000000000..16f88b84e642 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_delete.go @@ -0,0 +1,71 @@ +package databaseprincipalassignments + +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 DatabasePrincipalAssignmentsClient) Delete(ctx context.Context, id DatabasePrincipalAssignmentId) (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 DatabasePrincipalAssignmentsClient) DeleteThenPoll(ctx context.Context, id DatabasePrincipalAssignmentId) 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/kusto/2023-08-15/databaseprincipalassignments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_delete_autorest.go deleted file mode 100644 index 37d3f2214f77..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package databaseprincipalassignments - -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 DatabasePrincipalAssignmentsClient) Delete(ctx context.Context, id DatabasePrincipalAssignmentId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c DatabasePrincipalAssignmentsClient) DeleteThenPoll(ctx context.Context, id DatabasePrincipalAssignmentId) 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 DatabasePrincipalAssignmentsClient) preparerForDelete(ctx context.Context, id DatabasePrincipalAssignmentId) (*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 DatabasePrincipalAssignmentsClient) 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/kusto/2023-08-15/databaseprincipalassignments/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_get.go new file mode 100644 index 000000000000..2fa5f1b59e2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_get.go @@ -0,0 +1,51 @@ +package databaseprincipalassignments + +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 *DatabasePrincipalAssignment +} + +// Get ... +func (c DatabasePrincipalAssignmentsClient) Get(ctx context.Context, id DatabasePrincipalAssignmentId) (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/kusto/2023-08-15/databaseprincipalassignments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_get_autorest.go deleted file mode 100644 index 6ebfe16a3fd4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package databaseprincipalassignments - -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 *DatabasePrincipalAssignment -} - -// Get ... -func (c DatabasePrincipalAssignmentsClient) Get(ctx context.Context, id DatabasePrincipalAssignmentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DatabasePrincipalAssignmentsClient) preparerForGet(ctx context.Context, id DatabasePrincipalAssignmentId) (*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 DatabasePrincipalAssignmentsClient) 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/kusto/2023-08-15/databaseprincipalassignments/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_list.go new file mode 100644 index 000000000000..7755a4742d2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_list.go @@ -0,0 +1,53 @@ +package databaseprincipalassignments + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DatabasePrincipalAssignmentListResult +} + +// List ... +func (c DatabasePrincipalAssignmentsClient) List(ctx context.Context, id commonids.KustoDatabaseId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/principalAssignments", 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/kusto/2023-08-15/databaseprincipalassignments/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_list_autorest.go deleted file mode 100644 index f10ff33f7a4a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databaseprincipalassignments/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package databaseprincipalassignments - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *DatabasePrincipalAssignmentListResult -} - -// List ... -func (c DatabasePrincipalAssignmentsClient) List(ctx context.Context, id commonids.KustoDatabaseId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c DatabasePrincipalAssignmentsClient) preparerForList(ctx context.Context, id commonids.KustoDatabaseId) (*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/principalAssignments", id.ID())), - 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 DatabasePrincipalAssignmentsClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/kusto/2023-08-15/databases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/client.go index 5305d65eb6c1..11c4bb68fa0e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/client.go @@ -1,18 +1,26 @@ package databases -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 DatabasesClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { - return DatabasesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDatabasesClientWithBaseURI(sdkApi sdkEnv.Api) (*DatabasesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "databases", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) } + + return &DatabasesClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/constants.go index 193bf1d5791f..fd46fa713d3a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/constants.go @@ -1,6 +1,10 @@ package databases -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForCallerRole() []string { } } +func (s *CallerRole) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCallerRole(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCallerRole(input string) (*CallerRole, error) { vals := map[string]CallerRole{ "admin": CallerRoleAdmin, @@ -55,6 +72,19 @@ func PossibleValuesForDatabasePrincipalRole() []string { } } +func (s *DatabasePrincipalRole) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabasePrincipalRole(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabasePrincipalRole(input string) (*DatabasePrincipalRole, error) { vals := map[string]DatabasePrincipalRole{ "admin": DatabasePrincipalRoleAdmin, @@ -89,6 +119,19 @@ func PossibleValuesForDatabasePrincipalType() []string { } } +func (s *DatabasePrincipalType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabasePrincipalType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabasePrincipalType(input string) (*DatabasePrincipalType, error) { vals := map[string]DatabasePrincipalType{ "app": DatabasePrincipalTypeApp, @@ -120,6 +163,19 @@ func PossibleValuesForDatabaseShareOrigin() []string { } } +func (s *DatabaseShareOrigin) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabaseShareOrigin(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabaseShareOrigin(input string) (*DatabaseShareOrigin, error) { vals := map[string]DatabaseShareOrigin{ "datashare": DatabaseShareOriginDataShare, @@ -149,6 +205,19 @@ func PossibleValuesForKind() []string { } } +func (s *Kind) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKind(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseKind(input string) (*Kind, error) { vals := map[string]Kind{ "readonlyfollowing": KindReadOnlyFollowing, @@ -179,6 +248,19 @@ func PossibleValuesForPrincipalsModificationKind() []string { } } +func (s *PrincipalsModificationKind) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrincipalsModificationKind(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePrincipalsModificationKind(input string) (*PrincipalsModificationKind, error) { vals := map[string]PrincipalsModificationKind{ "none": PrincipalsModificationKindNone, @@ -218,6 +300,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -251,6 +346,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, @@ -279,6 +387,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{ "microsoft.kusto/clusters/attacheddatabaseconfigurations": TypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_addprincipals.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_addprincipals.go new file mode 100644 index 000000000000..587b72a70efb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_addprincipals.go @@ -0,0 +1,57 @@ +package databases + +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 AddPrincipalsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DatabasePrincipalListResult +} + +// AddPrincipals ... +func (c DatabasesClient) AddPrincipals(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalListRequest) (result AddPrincipalsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/addPrincipals", 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/kusto/2023-08-15/databases/method_addprincipals_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_addprincipals_autorest.go deleted file mode 100644 index e4793cc48419..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_addprincipals_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package databases - -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 AddPrincipalsOperationResponse struct { - HttpResponse *http.Response - Model *DatabasePrincipalListResult -} - -// AddPrincipals ... -func (c DatabasesClient) AddPrincipals(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalListRequest) (result AddPrincipalsOperationResponse, err error) { - req, err := c.preparerForAddPrincipals(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "AddPrincipals", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "AddPrincipals", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAddPrincipals(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "AddPrincipals", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAddPrincipals prepares the AddPrincipals request. -func (c DatabasesClient) preparerForAddPrincipals(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalListRequest) (*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/addPrincipals", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAddPrincipals handles the response to the AddPrincipals request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForAddPrincipals(resp *http.Response) (result AddPrincipalsOperationResponse, 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/kusto/2023-08-15/databases/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_checknameavailability.go new file mode 100644 index 000000000000..1fe6a59144f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_checknameavailability.go @@ -0,0 +1,57 @@ +package databases + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c DatabasesClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input CheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/checkNameAvailability", 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/kusto/2023-08-15/databases/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_checknameavailability_autorest.go deleted file mode 100644 index f12e692ffa68..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package databases - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c DatabasesClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input CheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c DatabasesClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input CheckNameRequest) (*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/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/databases/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_createorupdate.go new file mode 100644 index 000000000000..9667f9c38f73 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_createorupdate.go @@ -0,0 +1,104 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type CreateOrUpdateOperationOptions struct { + CallerRole *CallerRole +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.CallerRole != nil { + out.Append("callerRole", fmt.Sprintf("%v", *o.CallerRole)) + } + return &out +} + +// CreateOrUpdate ... +func (c DatabasesClient) CreateOrUpdate(ctx context.Context, id commonids.KustoDatabaseId, input Database, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + OptionsObject: options, + } + + 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 DatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KustoDatabaseId, input Database, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/kusto/2023-08-15/databases/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_createorupdate_autorest.go deleted file mode 100644 index f892858518ec..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_createorupdate_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - CallerRole *CallerRole -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.CallerRole != nil { - out["callerRole"] = *o.CallerRole - } - - return out -} - -// CreateOrUpdate ... -func (c DatabasesClient) CreateOrUpdate(ctx context.Context, id commonids.KustoDatabaseId, input Database, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c DatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.KustoDatabaseId, input Database, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - 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 DatabasesClient) preparerForCreateOrUpdate(ctx context.Context, id commonids.KustoDatabaseId, input Database, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c DatabasesClient) 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/kusto/2023-08-15/databases/method_databaseinvitefollower.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_databaseinvitefollower.go new file mode 100644 index 000000000000..8f30454b2bb6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_databaseinvitefollower.go @@ -0,0 +1,57 @@ +package databases + +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 DatabaseInviteFollowerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DatabaseInviteFollowerResult +} + +// DatabaseInviteFollower ... +func (c DatabasesClient) DatabaseInviteFollower(ctx context.Context, id commonids.KustoDatabaseId, input DatabaseInviteFollowerRequest) (result DatabaseInviteFollowerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/inviteFollower", 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/kusto/2023-08-15/databases/method_databaseinvitefollower_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_databaseinvitefollower_autorest.go deleted file mode 100644 index 963ad548d072..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_databaseinvitefollower_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package databases - -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 DatabaseInviteFollowerOperationResponse struct { - HttpResponse *http.Response - Model *DatabaseInviteFollowerResult -} - -// DatabaseInviteFollower ... -func (c DatabasesClient) DatabaseInviteFollower(ctx context.Context, id commonids.KustoDatabaseId, input DatabaseInviteFollowerRequest) (result DatabaseInviteFollowerOperationResponse, err error) { - req, err := c.preparerForDatabaseInviteFollower(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "DatabaseInviteFollower", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "DatabaseInviteFollower", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDatabaseInviteFollower(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "DatabaseInviteFollower", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDatabaseInviteFollower prepares the DatabaseInviteFollower request. -func (c DatabasesClient) preparerForDatabaseInviteFollower(ctx context.Context, id commonids.KustoDatabaseId, input DatabaseInviteFollowerRequest) (*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/inviteFollower", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDatabaseInviteFollower handles the response to the DatabaseInviteFollower request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForDatabaseInviteFollower(resp *http.Response) (result DatabaseInviteFollowerOperationResponse, 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/kusto/2023-08-15/databases/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_delete.go new file mode 100644 index 000000000000..3b7cd9785e1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_delete.go @@ -0,0 +1,72 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c DatabasesClient) Delete(ctx context.Context, id commonids.KustoDatabaseId) (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 DatabasesClient) DeleteThenPoll(ctx context.Context, id commonids.KustoDatabaseId) 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/kusto/2023-08-15/databases/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_delete_autorest.go deleted file mode 100644 index 3be60944e575..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_delete_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c DatabasesClient) Delete(ctx context.Context, id commonids.KustoDatabaseId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id commonids.KustoDatabaseId) 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 DatabasesClient) preparerForDelete(ctx context.Context, id commonids.KustoDatabaseId) (*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 DatabasesClient) 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/kusto/2023-08-15/databases/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_get.go new file mode 100644 index 000000000000..f2bd5b8a02dc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_get.go @@ -0,0 +1,59 @@ +package databases + +import ( + "context" + "encoding/json" + "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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id commonids.KustoDatabaseId) (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 + } + + var respObj json.RawMessage + if err = resp.Unmarshal(&respObj); err != nil { + return + } + model, err := unmarshalDatabaseImplementation(respObj) + if err != nil { + return + } + result.Model = &model + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_get_autorest.go deleted file mode 100644 index 56e8553b6dae..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_get_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package databases - -import ( - "context" - "encoding/json" - "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 GetOperationResponse struct { - HttpResponse *http.Response - Model *Database -} - -// Get ... -func (c DatabasesClient) Get(ctx context.Context, id commonids.KustoDatabaseId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DatabasesClient) preparerForGet(ctx context.Context, id commonids.KustoDatabaseId) (*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 DatabasesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - var respObj json.RawMessage - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - if err != nil { - return - } - model, err := unmarshalDatabaseImplementation(respObj) - if err != nil { - return - } - result.Model = &model - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listbycluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listbycluster.go new file mode 100644 index 000000000000..409eb47ba3c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listbycluster.go @@ -0,0 +1,120 @@ +package databases + +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 ListByClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Database +} + +type ListByClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []Database +} + +type ListByClusterOperationOptions struct { + Top *int64 +} + +func DefaultListByClusterOperationOptions() ListByClusterOperationOptions { + return ListByClusterOperationOptions{} +} + +func (o ListByClusterOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByClusterOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByClusterOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByCluster ... +func (c DatabasesClient) ListByCluster(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions) (result ListByClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/databases", 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 *[]Database `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByClusterComplete retrieves all the results into a single object +func (c DatabasesClient) ListByClusterComplete(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions) (ListByClusterCompleteResult, error) { + return c.ListByClusterCompleteMatchingPredicate(ctx, id, options, DatabaseOperationPredicate{}) +} + +// ListByClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DatabasesClient) ListByClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions, predicate DatabaseOperationPredicate) (result ListByClusterCompleteResult, err error) { + items := make([]Database, 0) + + resp, err := c.ListByCluster(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 = ListByClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listbycluster_autorest.go deleted file mode 100644 index 940a35e25cdf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listbycluster_autorest.go +++ /dev/null @@ -1,226 +0,0 @@ -package databases - -import ( - "context" - "encoding/json" - "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 ListByClusterOperationResponse struct { - HttpResponse *http.Response - Model *[]Database - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByClusterOperationResponse, error) -} - -type ListByClusterCompleteResult struct { - Items []Database -} - -func (r ListByClusterOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByClusterOperationResponse) LoadMore(ctx context.Context) (resp ListByClusterOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByClusterOperationOptions struct { - Top *int64 -} - -func DefaultListByClusterOperationOptions() ListByClusterOperationOptions { - return ListByClusterOperationOptions{} -} - -func (o ListByClusterOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByClusterOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByCluster ... -func (c DatabasesClient) ListByCluster(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions) (resp ListByClusterOperationResponse, err error) { - req, err := c.preparerForListByCluster(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByCluster(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByCluster prepares the ListByCluster request. -func (c DatabasesClient) preparerForListByCluster(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions) (*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/databases", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByClusterWithNextLink prepares the ListByCluster request with the given nextLink token. -func (c DatabasesClient) preparerForListByClusterWithNextLink(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)) -} - -// responderForListByCluster handles the response to the ListByCluster request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForListByCluster(resp *http.Response) (result ListByClusterOperationResponse, err error) { - type page struct { - Values []json.RawMessage `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 - temp := make([]Database, 0) - for i, v := range respObj.Values { - val, err := unmarshalDatabaseImplementation(v) - if err != nil { - err = fmt.Errorf("unmarshalling item %d for Database (%q): %+v", i, v, err) - return result, err - } - temp = append(temp, val) - } - result.Model = &temp - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByClusterOperationResponse, err error) { - req, err := c.preparerForListByClusterWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByCluster(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByClusterComplete retrieves all of the results into a single object -func (c DatabasesClient) ListByClusterComplete(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions) (ListByClusterCompleteResult, error) { - return c.ListByClusterCompleteMatchingPredicate(ctx, id, options, DatabaseOperationPredicate{}) -} - -// ListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DatabasesClient) ListByClusterCompleteMatchingPredicate(ctx context.Context, id commonids.KustoClusterId, options ListByClusterOperationOptions, predicate DatabaseOperationPredicate) (resp ListByClusterCompleteResult, err error) { - items := make([]Database, 0) - - page, err := c.ListByCluster(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 := ListByClusterCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listprincipals.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listprincipals.go new file mode 100644 index 000000000000..3752d874b9bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listprincipals.go @@ -0,0 +1,53 @@ +package databases + +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 ListPrincipalsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DatabasePrincipalListResult +} + +// ListPrincipals ... +func (c DatabasesClient) ListPrincipals(ctx context.Context, id commonids.KustoDatabaseId) (result ListPrincipalsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listPrincipals", 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/kusto/2023-08-15/databases/method_listprincipals_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listprincipals_autorest.go deleted file mode 100644 index 6d12a42cc986..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_listprincipals_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package databases - -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 ListPrincipalsOperationResponse struct { - HttpResponse *http.Response - Model *DatabasePrincipalListResult -} - -// ListPrincipals ... -func (c DatabasesClient) ListPrincipals(ctx context.Context, id commonids.KustoDatabaseId) (result ListPrincipalsOperationResponse, err error) { - req, err := c.preparerForListPrincipals(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListPrincipals", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListPrincipals", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListPrincipals(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListPrincipals", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListPrincipals prepares the ListPrincipals request. -func (c DatabasesClient) preparerForListPrincipals(ctx context.Context, id commonids.KustoDatabaseId) (*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/listPrincipals", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListPrincipals handles the response to the ListPrincipals request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForListPrincipals(resp *http.Response) (result ListPrincipalsOperationResponse, 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/kusto/2023-08-15/databases/method_removeprincipals.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_removeprincipals.go new file mode 100644 index 000000000000..9e92eadc2970 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_removeprincipals.go @@ -0,0 +1,57 @@ +package databases + +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 RemovePrincipalsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DatabasePrincipalListResult +} + +// RemovePrincipals ... +func (c DatabasesClient) RemovePrincipals(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalListRequest) (result RemovePrincipalsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/removePrincipals", 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/kusto/2023-08-15/databases/method_removeprincipals_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_removeprincipals_autorest.go deleted file mode 100644 index 1685b46c4adb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_removeprincipals_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package databases - -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 RemovePrincipalsOperationResponse struct { - HttpResponse *http.Response - Model *DatabasePrincipalListResult -} - -// RemovePrincipals ... -func (c DatabasesClient) RemovePrincipals(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalListRequest) (result RemovePrincipalsOperationResponse, err error) { - req, err := c.preparerForRemovePrincipals(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RemovePrincipals", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RemovePrincipals", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRemovePrincipals(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RemovePrincipals", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRemovePrincipals prepares the RemovePrincipals request. -func (c DatabasesClient) preparerForRemovePrincipals(ctx context.Context, id commonids.KustoDatabaseId, input DatabasePrincipalListRequest) (*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/removePrincipals", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRemovePrincipals handles the response to the RemovePrincipals request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForRemovePrincipals(resp *http.Response) (result RemovePrincipalsOperationResponse, 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/kusto/2023-08-15/databases/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_update.go new file mode 100644 index 000000000000..857005bf2bc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_update.go @@ -0,0 +1,104 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type UpdateOperationOptions struct { + CallerRole *CallerRole +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.CallerRole != nil { + out.Append("callerRole", fmt.Sprintf("%v", *o.CallerRole)) + } + return &out +} + +// Update ... +func (c DatabasesClient) Update(ctx context.Context, id commonids.KustoDatabaseId, input Database, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + OptionsObject: options, + } + + 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 DatabasesClient) UpdateThenPoll(ctx context.Context, id commonids.KustoDatabaseId, input Database, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/kusto/2023-08-15/databases/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_update_autorest.go deleted file mode 100644 index 932a82e5f3f4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases/method_update_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - CallerRole *CallerRole -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.CallerRole != nil { - out["callerRole"] = *o.CallerRole - } - - return out -} - -// Update ... -func (c DatabasesClient) Update(ctx context.Context, id commonids.KustoDatabaseId, input Database, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c DatabasesClient) UpdateThenPoll(ctx context.Context, id commonids.KustoDatabaseId, input Database, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - 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 DatabasesClient) preparerForUpdate(ctx context.Context, id commonids.KustoDatabaseId, input Database, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c DatabasesClient) 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/kusto/2023-08-15/dataconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/client.go index 4eb423e42af3..c7bee31c0469 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/client.go @@ -1,18 +1,26 @@ package dataconnections -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 DataConnectionsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewDataConnectionsClientWithBaseURI(endpoint string) DataConnectionsClient { - return DataConnectionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewDataConnectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*DataConnectionsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "dataconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DataConnectionsClient: %+v", err) } + + return &DataConnectionsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/constants.go index 5d891c8d11b7..b8f76aed7515 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/constants.go @@ -1,6 +1,10 @@ package dataconnections -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForBlobStorageEventType() []string { } } +func (s *BlobStorageEventType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBlobStorageEventType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseBlobStorageEventType(input string) (*BlobStorageEventType, error) { vals := map[string]BlobStorageEventType{ "microsoft.storage.blobcreated": BlobStorageEventTypeMicrosoftPointStoragePointBlobCreated, @@ -47,6 +64,19 @@ func PossibleValuesForCompression() []string { } } +func (s *Compression) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCompression(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseCompression(input string) (*Compression, error) { vals := map[string]Compression{ "gzip": CompressionGZip, @@ -79,6 +109,19 @@ func PossibleValuesForDataConnectionKind() []string { } } +func (s *DataConnectionKind) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataConnectionKind(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDataConnectionKind(input string) (*DataConnectionKind, error) { vals := map[string]DataConnectionKind{ "cosmosdb": DataConnectionKindCosmosDb, @@ -107,6 +150,19 @@ func PossibleValuesForDataConnectionType() []string { } } +func (s *DataConnectionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDataConnectionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDataConnectionType(input string) (*DataConnectionType, error) { vals := map[string]DataConnectionType{ "microsoft.kusto/clusters/databases/dataconnections": DataConnectionTypeMicrosoftPointKustoClustersDatabasesDataConnections, @@ -134,6 +190,19 @@ func PossibleValuesForDatabaseRouting() []string { } } +func (s *DatabaseRouting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDatabaseRouting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDatabaseRouting(input string) (*DatabaseRouting, error) { vals := map[string]DatabaseRouting{ "multi": DatabaseRoutingMulti, @@ -190,6 +259,19 @@ func PossibleValuesForEventGridDataFormat() []string { } } +func (s *EventGridDataFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEventGridDataFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseEventGridDataFormat(input string) (*EventGridDataFormat, error) { vals := map[string]EventGridDataFormat{ "apacheavro": EventGridDataFormatAPACHEAVRO, @@ -260,6 +342,19 @@ func PossibleValuesForEventHubDataFormat() []string { } } +func (s *EventHubDataFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEventHubDataFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseEventHubDataFormat(input string) (*EventHubDataFormat, error) { vals := map[string]EventHubDataFormat{ "apacheavro": EventHubDataFormatAPACHEAVRO, @@ -330,6 +425,19 @@ func PossibleValuesForIotHubDataFormat() []string { } } +func (s *IotHubDataFormat) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIotHubDataFormat(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseIotHubDataFormat(input string) (*IotHubDataFormat, error) { vals := map[string]IotHubDataFormat{ "apacheavro": IotHubDataFormatAPACHEAVRO, @@ -382,6 +490,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -415,6 +536,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_checknameavailability.go new file mode 100644 index 000000000000..7815a8777039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_checknameavailability.go @@ -0,0 +1,57 @@ +package dataconnections + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c DataConnectionsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/checkNameAvailability", 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/kusto/2023-08-15/dataconnections/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_checknameavailability_autorest.go deleted file mode 100644 index 662969c849d3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package dataconnections - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c DataConnectionsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c DataConnectionsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionCheckNameRequest) (*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/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c DataConnectionsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/dataconnections/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_createorupdate.go new file mode 100644 index 000000000000..c074fbc03caf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_createorupdate.go @@ -0,0 +1,75 @@ +package dataconnections + +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 DataConnectionsClient) CreateOrUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 DataConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id DataConnectionId, input DataConnection) 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/kusto/2023-08-15/dataconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_createorupdate_autorest.go deleted file mode 100644 index 62b72e6ac351..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package dataconnections - -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 DataConnectionsClient) CreateOrUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c DataConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id DataConnectionId, input DataConnection) 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 DataConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (*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 DataConnectionsClient) 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/kusto/2023-08-15/dataconnections/method_dataconnectionvalidation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_dataconnectionvalidation.go new file mode 100644 index 000000000000..e1f28c045307 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_dataconnectionvalidation.go @@ -0,0 +1,75 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionValidationOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DataConnectionValidation ... +func (c DataConnectionsClient) DataConnectionValidation(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionValidation) (result DataConnectionValidationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/dataConnectionValidation", 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 +} + +// DataConnectionValidationThenPoll performs DataConnectionValidation then polls until it's completed +func (c DataConnectionsClient) DataConnectionValidationThenPoll(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionValidation) error { + result, err := c.DataConnectionValidation(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DataConnectionValidation: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DataConnectionValidation: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_dataconnectionvalidation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_dataconnectionvalidation_autorest.go deleted file mode 100644 index 386c887a5339..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_dataconnectionvalidation_autorest.go +++ /dev/null @@ -1,80 +0,0 @@ -package dataconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DataConnectionValidationOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// DataConnectionValidation ... -func (c DataConnectionsClient) DataConnectionValidation(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionValidation) (result DataConnectionValidationOperationResponse, err error) { - req, err := c.preparerForDataConnectionValidation(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "DataConnectionValidation", nil, "Failure preparing request") - return - } - - result, err = c.senderForDataConnectionValidation(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "DataConnectionValidation", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DataConnectionValidationThenPoll performs DataConnectionValidation then polls until it's completed -func (c DataConnectionsClient) DataConnectionValidationThenPoll(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionValidation) error { - result, err := c.DataConnectionValidation(ctx, id, input) - if err != nil { - return fmt.Errorf("performing DataConnectionValidation: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after DataConnectionValidation: %+v", err) - } - - return nil -} - -// preparerForDataConnectionValidation prepares the DataConnectionValidation request. -func (c DataConnectionsClient) preparerForDataConnectionValidation(ctx context.Context, id commonids.KustoDatabaseId, input DataConnectionValidation) (*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/dataConnectionValidation", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDataConnectionValidation sends the DataConnectionValidation request. The method will close the -// http.Response Body if it receives an error. -func (c DataConnectionsClient) senderForDataConnectionValidation(ctx context.Context, req *http.Request) (future DataConnectionValidationOperationResponse, 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/kusto/2023-08-15/dataconnections/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_delete.go new file mode 100644 index 000000000000..22539c4c00e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_delete.go @@ -0,0 +1,71 @@ +package dataconnections + +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 DataConnectionsClient) Delete(ctx context.Context, id DataConnectionId) (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 DataConnectionsClient) DeleteThenPoll(ctx context.Context, id DataConnectionId) 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/kusto/2023-08-15/dataconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_delete_autorest.go deleted file mode 100644 index db400eaac4a4..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package dataconnections - -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 DataConnectionsClient) Delete(ctx context.Context, id DataConnectionId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c DataConnectionsClient) DeleteThenPoll(ctx context.Context, id DataConnectionId) 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 DataConnectionsClient) preparerForDelete(ctx context.Context, id DataConnectionId) (*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 DataConnectionsClient) 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/kusto/2023-08-15/dataconnections/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_get.go new file mode 100644 index 000000000000..6567a103e581 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_get.go @@ -0,0 +1,58 @@ +package dataconnections + +import ( + "context" + "encoding/json" + "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 *DataConnection +} + +// Get ... +func (c DataConnectionsClient) Get(ctx context.Context, id DataConnectionId) (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 + } + + var respObj json.RawMessage + if err = resp.Unmarshal(&respObj); err != nil { + return + } + model, err := unmarshalDataConnectionImplementation(respObj) + if err != nil { + return + } + result.Model = &model + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_get_autorest.go deleted file mode 100644 index 9a3d67b73e3d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_get_autorest.go +++ /dev/null @@ -1,77 +0,0 @@ -package dataconnections - -import ( - "context" - "encoding/json" - "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 *DataConnection -} - -// Get ... -func (c DataConnectionsClient) Get(ctx context.Context, id DataConnectionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DataConnectionsClient) preparerForGet(ctx context.Context, id DataConnectionId) (*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 DataConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - var respObj json.RawMessage - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - if err != nil { - return - } - model, err := unmarshalDataConnectionImplementation(respObj) - if err != nil { - return - } - result.Model = &model - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_listbydatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_listbydatabase.go new file mode 100644 index 000000000000..4662463e995f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_listbydatabase.go @@ -0,0 +1,53 @@ +package dataconnections + +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 ListByDatabaseOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DataConnectionListResult +} + +// ListByDatabase ... +func (c DataConnectionsClient) ListByDatabase(ctx context.Context, id commonids.KustoDatabaseId) (result ListByDatabaseOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/dataConnections", 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/kusto/2023-08-15/dataconnections/method_listbydatabase_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_listbydatabase_autorest.go deleted file mode 100644 index 8534a517cc6f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_listbydatabase_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package dataconnections - -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 ListByDatabaseOperationResponse struct { - HttpResponse *http.Response - Model *DataConnectionListResult -} - -// ListByDatabase ... -func (c DataConnectionsClient) ListByDatabase(ctx context.Context, id commonids.KustoDatabaseId) (result ListByDatabaseOperationResponse, err error) { - req, err := c.preparerForListByDatabase(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "ListByDatabase", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByDatabase(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "ListByDatabase", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByDatabase prepares the ListByDatabase request. -func (c DataConnectionsClient) preparerForListByDatabase(ctx context.Context, id commonids.KustoDatabaseId) (*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/dataConnections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByDatabase handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (c DataConnectionsClient) responderForListByDatabase(resp *http.Response) (result ListByDatabaseOperationResponse, 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/kusto/2023-08-15/dataconnections/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_update.go new file mode 100644 index 000000000000..e9f345746c08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_update.go @@ -0,0 +1,75 @@ +package dataconnections + +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 DataConnectionsClient) Update(ctx context.Context, id DataConnectionId, input DataConnection) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + 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 DataConnectionsClient) UpdateThenPoll(ctx context.Context, id DataConnectionId, input DataConnection) 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/kusto/2023-08-15/dataconnections/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_update_autorest.go deleted file mode 100644 index 0557133cd50f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/dataconnections/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package dataconnections - -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 DataConnectionsClient) Update(ctx context.Context, id DataConnectionId, input DataConnection) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c DataConnectionsClient) UpdateThenPoll(ctx context.Context, id DataConnectionId, input DataConnection) 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 DataConnectionsClient) preparerForUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (*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 DataConnectionsClient) 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/kusto/2023-08-15/managedprivateendpoints/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/client.go index 1c18122fab33..c0a043e05258 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/client.go @@ -1,18 +1,26 @@ package managedprivateendpoints -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 ManagedPrivateEndpointsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewManagedPrivateEndpointsClientWithBaseURI(endpoint string) ManagedPrivateEndpointsClient { - return ManagedPrivateEndpointsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewManagedPrivateEndpointsClientWithBaseURI(sdkApi sdkEnv.Api) (*ManagedPrivateEndpointsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "managedprivateendpoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ManagedPrivateEndpointsClient: %+v", err) } + + return &ManagedPrivateEndpointsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/constants.go index 5311ff7cce7c..2673f5e7f301 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/constants.go @@ -1,6 +1,10 @@ package managedprivateendpoints -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. @@ -17,6 +21,19 @@ func PossibleValuesForManagedPrivateEndpointsType() []string { } } +func (s *ManagedPrivateEndpointsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseManagedPrivateEndpointsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseManagedPrivateEndpointsType(input string) (*ManagedPrivateEndpointsType, error) { vals := map[string]ManagedPrivateEndpointsType{ "microsoft.kusto/clusters/managedprivateendpoints": ManagedPrivateEndpointsTypeMicrosoftPointKustoClustersManagedPrivateEndpoints, @@ -54,6 +71,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -87,6 +117,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_checknameavailability.go new file mode 100644 index 000000000000..dec0fdd93115 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_checknameavailability.go @@ -0,0 +1,57 @@ +package managedprivateendpoints + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ManagedPrivateEndpointsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input ManagedPrivateEndpointsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/managedPrivateEndpointsCheckNameAvailability", 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/kusto/2023-08-15/managedprivateendpoints/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_checknameavailability_autorest.go deleted file mode 100644 index 0b56ff39a2f5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package managedprivateendpoints - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c ManagedPrivateEndpointsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input ManagedPrivateEndpointsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ManagedPrivateEndpointsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input ManagedPrivateEndpointsCheckNameRequest) (*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/managedPrivateEndpointsCheckNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ManagedPrivateEndpointsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/managedprivateendpoints/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_createorupdate.go new file mode 100644 index 000000000000..a2a17f7192d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_createorupdate.go @@ -0,0 +1,75 @@ +package managedprivateendpoints + +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 ManagedPrivateEndpointsClient) CreateOrUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 ManagedPrivateEndpointsClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) 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/kusto/2023-08-15/managedprivateendpoints/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_createorupdate_autorest.go deleted file mode 100644 index 9ca910404f17..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedprivateendpoints - -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 ManagedPrivateEndpointsClient) CreateOrUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ManagedPrivateEndpointsClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) 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 ManagedPrivateEndpointsClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (*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 ManagedPrivateEndpointsClient) 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/kusto/2023-08-15/managedprivateendpoints/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_delete.go new file mode 100644 index 000000000000..98a0990b10a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_delete.go @@ -0,0 +1,71 @@ +package managedprivateendpoints + +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 ManagedPrivateEndpointsClient) Delete(ctx context.Context, id ManagedPrivateEndpointId) (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 ManagedPrivateEndpointsClient) DeleteThenPoll(ctx context.Context, id ManagedPrivateEndpointId) 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/kusto/2023-08-15/managedprivateendpoints/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_delete_autorest.go deleted file mode 100644 index aa9e0477433d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package managedprivateendpoints - -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 ManagedPrivateEndpointsClient) Delete(ctx context.Context, id ManagedPrivateEndpointId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ManagedPrivateEndpointsClient) DeleteThenPoll(ctx context.Context, id ManagedPrivateEndpointId) 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 ManagedPrivateEndpointsClient) preparerForDelete(ctx context.Context, id ManagedPrivateEndpointId) (*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 ManagedPrivateEndpointsClient) 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/kusto/2023-08-15/managedprivateendpoints/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_get.go new file mode 100644 index 000000000000..8e3d59a1bed5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_get.go @@ -0,0 +1,51 @@ +package managedprivateendpoints + +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 *ManagedPrivateEndpoint +} + +// Get ... +func (c ManagedPrivateEndpointsClient) Get(ctx context.Context, id ManagedPrivateEndpointId) (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/kusto/2023-08-15/managedprivateendpoints/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_get_autorest.go deleted file mode 100644 index a322aa21710b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package managedprivateendpoints - -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 *ManagedPrivateEndpoint -} - -// Get ... -func (c ManagedPrivateEndpointsClient) Get(ctx context.Context, id ManagedPrivateEndpointId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedPrivateEndpointsClient) preparerForGet(ctx context.Context, id ManagedPrivateEndpointId) (*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 ManagedPrivateEndpointsClient) 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/kusto/2023-08-15/managedprivateendpoints/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_list.go new file mode 100644 index 000000000000..b209382f4b35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_list.go @@ -0,0 +1,53 @@ +package managedprivateendpoints + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ManagedPrivateEndpointListResult +} + +// List ... +func (c ManagedPrivateEndpointsClient) List(ctx context.Context, id commonids.KustoClusterId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/managedPrivateEndpoints", 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/kusto/2023-08-15/managedprivateendpoints/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_list_autorest.go deleted file mode 100644 index ee07fd39beef..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package managedprivateendpoints - -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 ListOperationResponse struct { - HttpResponse *http.Response - Model *ManagedPrivateEndpointListResult -} - -// List ... -func (c ManagedPrivateEndpointsClient) List(ctx context.Context, id commonids.KustoClusterId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ManagedPrivateEndpointsClient) preparerForList(ctx context.Context, id commonids.KustoClusterId) (*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/managedPrivateEndpoints", id.ID())), - 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 ManagedPrivateEndpointsClient) responderForList(resp *http.Response) (result ListOperationResponse, 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/kusto/2023-08-15/managedprivateendpoints/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_update.go new file mode 100644 index 000000000000..7bb774f054f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_update.go @@ -0,0 +1,74 @@ +package managedprivateendpoints + +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 ManagedPrivateEndpointsClient) Update(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (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 ManagedPrivateEndpointsClient) UpdateThenPoll(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) 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/kusto/2023-08-15/managedprivateendpoints/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_update_autorest.go deleted file mode 100644 index 96a472d57c99..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/managedprivateendpoints/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package managedprivateendpoints - -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 ManagedPrivateEndpointsClient) Update(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ManagedPrivateEndpointsClient) UpdateThenPoll(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) 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 ManagedPrivateEndpointsClient) preparerForUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (*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 ManagedPrivateEndpointsClient) 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/kusto/2023-08-15/scripts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/client.go index 5d4ca209622f..a4b2e43918ae 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/client.go @@ -1,18 +1,26 @@ package scripts -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 ScriptsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewScriptsClientWithBaseURI(endpoint string) ScriptsClient { - return ScriptsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewScriptsClientWithBaseURI(sdkApi sdkEnv.Api) (*ScriptsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "scripts", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ScriptsClient: %+v", err) } + + return &ScriptsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/constants.go index d41bc71678e6..32034b7c8bba 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/constants.go @@ -1,6 +1,10 @@ package scripts -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. @@ -29,6 +33,19 @@ func PossibleValuesForProvisioningState() []string { } } +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ "canceled": ProvisioningStateCanceled, @@ -62,6 +79,19 @@ func PossibleValuesForReason() []string { } } +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseReason(input string) (*Reason, error) { vals := map[string]Reason{ "alreadyexists": ReasonAlreadyExists, @@ -88,6 +118,19 @@ func PossibleValuesForScriptType() []string { } } +func (s *ScriptType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScriptType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseScriptType(input string) (*ScriptType, error) { vals := map[string]ScriptType{ "microsoft.kusto/clusters/databases/scripts": ScriptTypeMicrosoftPointKustoClustersDatabasesScripts, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_checknameavailability.go new file mode 100644 index 000000000000..ad081c2471dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_checknameavailability.go @@ -0,0 +1,57 @@ +package scripts + +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 CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ScriptsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input ScriptCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/scriptsCheckNameAvailability", 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/kusto/2023-08-15/scripts/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_checknameavailability_autorest.go deleted file mode 100644 index 3332418e948d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_checknameavailability_autorest.go +++ /dev/null @@ -1,71 +0,0 @@ -package scripts - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameResult -} - -// CheckNameAvailability ... -func (c ScriptsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input ScriptCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ScriptsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.KustoDatabaseId, input ScriptCheckNameRequest) (*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/scriptsCheckNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ScriptsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, 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/kusto/2023-08-15/scripts/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_createorupdate.go new file mode 100644 index 000000000000..c6a8293fcf07 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_createorupdate.go @@ -0,0 +1,75 @@ +package scripts + +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 ScriptsClient) CreateOrUpdate(ctx context.Context, id ScriptId, input Script) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + 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 ScriptsClient) CreateOrUpdateThenPoll(ctx context.Context, id ScriptId, input Script) 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/kusto/2023-08-15/scripts/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_createorupdate_autorest.go deleted file mode 100644 index 1313d11653bb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_createorupdate_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package scripts - -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 ScriptsClient) CreateOrUpdate(ctx context.Context, id ScriptId, input Script) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ScriptsClient) CreateOrUpdateThenPoll(ctx context.Context, id ScriptId, input Script) 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 ScriptsClient) preparerForCreateOrUpdate(ctx context.Context, id ScriptId, input Script) (*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 ScriptsClient) 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/kusto/2023-08-15/scripts/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_delete.go new file mode 100644 index 000000000000..c6d30e57ae66 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_delete.go @@ -0,0 +1,71 @@ +package scripts + +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 ScriptsClient) Delete(ctx context.Context, id ScriptId) (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 ScriptsClient) DeleteThenPoll(ctx context.Context, id ScriptId) 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/kusto/2023-08-15/scripts/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_delete_autorest.go deleted file mode 100644 index 628884654aaa..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_delete_autorest.go +++ /dev/null @@ -1,78 +0,0 @@ -package scripts - -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 ScriptsClient) Delete(ctx context.Context, id ScriptId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ScriptsClient) DeleteThenPoll(ctx context.Context, id ScriptId) 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 ScriptsClient) preparerForDelete(ctx context.Context, id ScriptId) (*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 ScriptsClient) 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/kusto/2023-08-15/scripts/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_get.go new file mode 100644 index 000000000000..6a0dbd353ede --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_get.go @@ -0,0 +1,51 @@ +package scripts + +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 *Script +} + +// Get ... +func (c ScriptsClient) Get(ctx context.Context, id ScriptId) (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/kusto/2023-08-15/scripts/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_get_autorest.go deleted file mode 100644 index 2c58e075a2fb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package scripts - -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 *Script -} - -// Get ... -func (c ScriptsClient) Get(ctx context.Context, id ScriptId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ScriptsClient) preparerForGet(ctx context.Context, id ScriptId) (*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 ScriptsClient) 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/kusto/2023-08-15/scripts/method_listbydatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_listbydatabase.go new file mode 100644 index 000000000000..920942ca698b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_listbydatabase.go @@ -0,0 +1,53 @@ +package scripts + +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 ListByDatabaseOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ScriptListResult +} + +// ListByDatabase ... +func (c ScriptsClient) ListByDatabase(ctx context.Context, id commonids.KustoDatabaseId) (result ListByDatabaseOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/scripts", 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/kusto/2023-08-15/scripts/method_listbydatabase_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_listbydatabase_autorest.go deleted file mode 100644 index 59fec2e2a0f1..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_listbydatabase_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package scripts - -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 ListByDatabaseOperationResponse struct { - HttpResponse *http.Response - Model *ScriptListResult -} - -// ListByDatabase ... -func (c ScriptsClient) ListByDatabase(ctx context.Context, id commonids.KustoDatabaseId) (result ListByDatabaseOperationResponse, err error) { - req, err := c.preparerForListByDatabase(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "ListByDatabase", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByDatabase(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "ListByDatabase", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByDatabase prepares the ListByDatabase request. -func (c ScriptsClient) preparerForListByDatabase(ctx context.Context, id commonids.KustoDatabaseId) (*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/scripts", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByDatabase handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (c ScriptsClient) responderForListByDatabase(resp *http.Response) (result ListByDatabaseOperationResponse, 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/kusto/2023-08-15/scripts/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_update.go new file mode 100644 index 000000000000..a93a7aaa0c38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_update.go @@ -0,0 +1,74 @@ +package scripts + +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 ScriptsClient) Update(ctx context.Context, id ScriptId, input Script) (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 ScriptsClient) UpdateThenPoll(ctx context.Context, id ScriptId, input Script) 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/kusto/2023-08-15/scripts/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_update_autorest.go deleted file mode 100644 index d797971176c9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/scripts/method_update_autorest.go +++ /dev/null @@ -1,79 +0,0 @@ -package scripts - -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 ScriptsClient) Update(ctx context.Context, id ScriptId, input Script) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ScriptsClient) UpdateThenPoll(ctx context.Context, id ScriptId, input Script) 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 ScriptsClient) preparerForUpdate(ctx context.Context, id ScriptId, input Script) (*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 ScriptsClient) 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/modules.txt b/vendor/modules.txt index ff1f89f605d6..2541ce5bb12a 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.20240111.1094251 +# github.com/hashicorp/go-azure-sdk v0.20240112.1095456 ## 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