diff --git a/go.mod b/go.mod index 3667207bdf76..4f2eb1dc4fde 100644 --- a/go.mod +++ b/go.mod @@ -17,8 +17,8 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/uuid v1.3.1 github.com/hashicorp/go-azure-helpers v0.66.2 - github.com/hashicorp/go-azure-sdk/resource-manager v0.20240208.1095436 - github.com/hashicorp/go-azure-sdk/sdk v0.20240208.1095436 + github.com/hashicorp/go-azure-sdk/resource-manager v0.20240209.1123314 + github.com/hashicorp/go-azure-sdk/sdk v0.20240209.1123314 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 e24ab768c184..c79d789afe7a 100644 --- a/go.sum +++ b/go.sum @@ -115,10 +115,10 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-azure-helpers v0.66.2 h1:+Pzuo7pdKl0hBXXr5ymmhs4Q40tHAo2nAvHq4WgSjx8= github.com/hashicorp/go-azure-helpers v0.66.2/go.mod h1:kJxXrFtJKJdOEqvad8pllAe7dhP4DbN8J6sqFZe47+4= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240208.1095436 h1:awCrGPNyprHpMrXzV2y6Q/lu42CF5NSp2MWlBbPKZuk= -github.com/hashicorp/go-azure-sdk/resource-manager v0.20240208.1095436/go.mod h1:rrFiMJS+OGzFAF8E/ChLWHqb/BVifPUR/KGbghLX1as= -github.com/hashicorp/go-azure-sdk/sdk v0.20240208.1095436 h1:uKvcPpjG3HPexQYztAXUiIzZUSHOA7VZ3Cggt9eVOw0= -github.com/hashicorp/go-azure-sdk/sdk v0.20240208.1095436/go.mod h1:IKIPyL+hfFWBHABKT0NOWlIEzlusiUBG0SxIfaiv278= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240209.1123314 h1:OtOKXi3sfxWn/flytBpBTMJU8groqm/53zJK0TD/sc0= +github.com/hashicorp/go-azure-sdk/resource-manager v0.20240209.1123314/go.mod h1:Z0ht6E49oPRJ1by2Qf+I1UgRNVLYb3MvsbHZ2KgMm8w= +github.com/hashicorp/go-azure-sdk/sdk v0.20240209.1123314 h1:HoXqXKNIRJqvLwgNkehB0Lh9PacLElhk+6aik6FuUUI= +github.com/hashicorp/go-azure-sdk/sdk v0.20240209.1123314/go.mod h1:IKIPyL+hfFWBHABKT0NOWlIEzlusiUBG0SxIfaiv278= 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/internal/clients/client.go b/internal/clients/client.go index 36124c6df42f..e1209eef0601 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -489,7 +489,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.MachineLearning, err = machinelearning.NewClient(o); err != nil { return fmt.Errorf("building clients for Machine Learning: %+v", err) } - client.Maintenance = maintenance.NewClient(o) + if client.Maintenance, err = maintenance.NewClient(o); err != nil { + return fmt.Errorf("building clients for Maintenance: %+v", err) + } if client.ManagedApplication, err = managedapplication.NewClient(o); err != nil { return fmt.Errorf("building clients for Managed Applications: %+v", err) } diff --git a/internal/services/maintenance/client/client.go b/internal/services/maintenance/client/client.go index 543b45cefada..9b6412f1f8c2 100644 --- a/internal/services/maintenance/client/client.go +++ b/internal/services/maintenance/client/client.go @@ -4,6 +4,8 @@ package client import ( + "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments" "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations" "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations" @@ -16,19 +18,28 @@ type Client struct { PublicConfigurationsClient *publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient } -func NewClient(o *common.ClientOptions) *Client { - configurationsClient := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&configurationsClient.Client, o.ResourceManagerAuthorizer) +func NewClient(o *common.ClientOptions) (*Client, error) { + configurationsClient, err := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Configurations client : %+v", err) + } + o.Configure(configurationsClient.Client, o.Authorizers.ResourceManager) - configurationAssignmentsClient := configurationassignments.NewConfigurationAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&configurationAssignmentsClient.Client, o.ResourceManagerAuthorizer) + configurationAssignmentsClient, err := configurationassignments.NewConfigurationAssignmentsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Configuration Assignments client : %+v", err) + } + o.Configure(configurationAssignmentsClient.Client, o.Authorizers.ResourceManager) - publicConfigurationsClient := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&publicConfigurationsClient.Client, o.ResourceManagerAuthorizer) + publicConfigurationsClient, err := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Public Configuration Assignments client : %+v", err) + } + o.Configure(publicConfigurationsClient.Client, o.Authorizers.ResourceManager) return &Client{ - ConfigurationsClient: &configurationsClient, - ConfigurationAssignmentsClient: &configurationAssignmentsClient, - PublicConfigurationsClient: &publicConfigurationsClient, - } + ConfigurationsClient: configurationsClient, + ConfigurationAssignmentsClient: configurationAssignmentsClient, + PublicConfigurationsClient: publicConfigurationsClient, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/client.go index 20420cff689e..dbc7cab57fc6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/client.go @@ -1,18 +1,26 @@ package configurationassignments -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 ConfigurationAssignmentsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewConfigurationAssignmentsClientWithBaseURI(endpoint string) ConfigurationAssignmentsClient { - return ConfigurationAssignmentsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewConfigurationAssignmentsClientWithBaseURI(sdkApi sdkEnv.Api) (*ConfigurationAssignmentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "configurationassignments", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ConfigurationAssignmentsClient: %+v", err) } + + return &ConfigurationAssignmentsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdate.go new file mode 100644 index 000000000000..86498c22cefd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdate.go @@ -0,0 +1,55 @@ +package configurationassignments + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationAssignment +} + +// CreateOrUpdate ... +func (c ConfigurationAssignmentsClient) CreateOrUpdate(ctx context.Context, id ScopedConfigurationAssignmentId, input ConfigurationAssignment) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdate_autorest.go deleted file mode 100644 index 5f04a3732c5d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package configurationassignments - -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 CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ConfigurationAssignment -} - -// CreateOrUpdate ... -func (c ConfigurationAssignmentsClient) CreateOrUpdate(ctx context.Context, id ScopedConfigurationAssignmentId, input ConfigurationAssignment) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ConfigurationAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id ScopedConfigurationAssignmentId, input ConfigurationAssignment) (*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)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/maintenance/2022-07-01-preview/configurationassignments/method_createorupdateparent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdateparent.go new file mode 100644 index 000000000000..f0f08fbc58b4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdateparent.go @@ -0,0 +1,55 @@ +package configurationassignments + +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 CreateOrUpdateParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationAssignment +} + +// CreateOrUpdateParent ... +func (c ConfigurationAssignmentsClient) CreateOrUpdateParent(ctx context.Context, id ScopedConfigurationAssignmentId, input ConfigurationAssignment) (result CreateOrUpdateParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdateparent_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdateparent_autorest.go deleted file mode 100644 index a43e4989e0c5..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_createorupdateparent_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package configurationassignments - -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 CreateOrUpdateParentOperationResponse struct { - HttpResponse *http.Response - Model *ConfigurationAssignment -} - -// CreateOrUpdateParent ... -func (c ConfigurationAssignmentsClient) CreateOrUpdateParent(ctx context.Context, id ScopedConfigurationAssignmentId, input ConfigurationAssignment) (result CreateOrUpdateParentOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdateParent(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdateParent", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdateParent", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdateParent(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdateParent", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdateParent prepares the CreateOrUpdateParent request. -func (c ConfigurationAssignmentsClient) preparerForCreateOrUpdateParent(ctx context.Context, id ScopedConfigurationAssignmentId, input ConfigurationAssignment) (*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)) -} - -// responderForCreateOrUpdateParent handles the response to the CreateOrUpdateParent request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForCreateOrUpdateParent(resp *http.Response) (result CreateOrUpdateParentOperationResponse, 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/maintenance/2022-07-01-preview/configurationassignments/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_delete.go new file mode 100644 index 000000000000..8a7e5123ac3d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_delete.go @@ -0,0 +1,52 @@ +package configurationassignments + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationAssignment +} + +// Delete ... +func (c ConfigurationAssignmentsClient) Delete(ctx context.Context, id ScopedConfigurationAssignmentId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_delete_autorest.go deleted file mode 100644 index fe9748241e57..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_delete_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package configurationassignments - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response - Model *ConfigurationAssignment -} - -// Delete ... -func (c ConfigurationAssignmentsClient) Delete(ctx context.Context, id ScopedConfigurationAssignmentId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ConfigurationAssignmentsClient) preparerForDelete(ctx context.Context, id ScopedConfigurationAssignmentId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_deleteparent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_deleteparent.go new file mode 100644 index 000000000000..00948592286f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_deleteparent.go @@ -0,0 +1,52 @@ +package configurationassignments + +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 DeleteParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationAssignment +} + +// DeleteParent ... +func (c ConfigurationAssignmentsClient) DeleteParent(ctx context.Context, id ScopedConfigurationAssignmentId) (result DeleteParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_deleteparent_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_deleteparent_autorest.go deleted file mode 100644 index dfa2673bded6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_deleteparent_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package configurationassignments - -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 DeleteParentOperationResponse struct { - HttpResponse *http.Response - Model *ConfigurationAssignment -} - -// DeleteParent ... -func (c ConfigurationAssignmentsClient) DeleteParent(ctx context.Context, id ScopedConfigurationAssignmentId) (result DeleteParentOperationResponse, err error) { - req, err := c.preparerForDeleteParent(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "DeleteParent", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "DeleteParent", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDeleteParent(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "DeleteParent", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDeleteParent prepares the DeleteParent request. -func (c ConfigurationAssignmentsClient) preparerForDeleteParent(ctx context.Context, id ScopedConfigurationAssignmentId) (*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)) -} - -// responderForDeleteParent handles the response to the DeleteParent request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForDeleteParent(resp *http.Response) (result DeleteParentOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_get.go new file mode 100644 index 000000000000..4495bf5aa7c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_get.go @@ -0,0 +1,51 @@ +package configurationassignments + +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 *ConfigurationAssignment +} + +// Get ... +func (c ConfigurationAssignmentsClient) Get(ctx context.Context, id ScopedConfigurationAssignmentId) (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/maintenance/2022-07-01-preview/configurationassignments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_get_autorest.go deleted file mode 100644 index 0fd49cdd1c23..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package configurationassignments - -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 *ConfigurationAssignment -} - -// Get ... -func (c ConfigurationAssignmentsClient) Get(ctx context.Context, id ScopedConfigurationAssignmentId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ConfigurationAssignmentsClient) preparerForGet(ctx context.Context, id ScopedConfigurationAssignmentId) (*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 ConfigurationAssignmentsClient) 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/maintenance/2022-07-01-preview/configurationassignments/method_getparent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_getparent.go new file mode 100644 index 000000000000..befc97357316 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_getparent.go @@ -0,0 +1,51 @@ +package configurationassignments + +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 GetParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ConfigurationAssignment +} + +// GetParent ... +func (c ConfigurationAssignmentsClient) GetParent(ctx context.Context, id ScopedConfigurationAssignmentId) (result GetParentOperationResponse, 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/maintenance/2022-07-01-preview/configurationassignments/method_getparent_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_getparent_autorest.go deleted file mode 100644 index 94813d1501c8..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_getparent_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package configurationassignments - -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 GetParentOperationResponse struct { - HttpResponse *http.Response - Model *ConfigurationAssignment -} - -// GetParent ... -func (c ConfigurationAssignmentsClient) GetParent(ctx context.Context, id ScopedConfigurationAssignmentId) (result GetParentOperationResponse, err error) { - req, err := c.preparerForGetParent(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "GetParent", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "GetParent", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetParent(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "GetParent", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetParent prepares the GetParent request. -func (c ConfigurationAssignmentsClient) preparerForGetParent(ctx context.Context, id ScopedConfigurationAssignmentId) (*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)) -} - -// responderForGetParent handles the response to the GetParent request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForGetParent(resp *http.Response) (result GetParentOperationResponse, 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/maintenance/2022-07-01-preview/configurationassignments/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_list.go new file mode 100644 index 000000000000..d5e95e184112 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_list.go @@ -0,0 +1,53 @@ +package configurationassignments + +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 *ListConfigurationAssignmentsResult +} + +// List ... +func (c ConfigurationAssignmentsClient) List(ctx context.Context, id commonids.ScopeId) (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.Maintenance/configurationAssignments", 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/maintenance/2022-07-01-preview/configurationassignments/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_list_autorest.go deleted file mode 100644 index 80d29f90ed92..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package configurationassignments - -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 *ListConfigurationAssignmentsResult -} - -// List ... -func (c ConfigurationAssignmentsClient) List(ctx context.Context, id commonids.ScopeId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ConfigurationAssignmentsClient) preparerForList(ctx context.Context, id commonids.ScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/configurationAssignments", 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 ConfigurationAssignmentsClient) 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/maintenance/2022-07-01-preview/configurationassignments/method_listparent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_listparent.go new file mode 100644 index 000000000000..9156221f3292 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_listparent.go @@ -0,0 +1,53 @@ +package configurationassignments + +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 ListParentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ListConfigurationAssignmentsResult +} + +// ListParent ... +func (c ConfigurationAssignmentsClient) ListParent(ctx context.Context, id commonids.ScopeId) (result ListParentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Maintenance/configurationAssignments", 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/maintenance/2022-07-01-preview/configurationassignments/method_listparent_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_listparent_autorest.go deleted file mode 100644 index 2f7b459f2de9..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_listparent_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package configurationassignments - -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 ListParentOperationResponse struct { - HttpResponse *http.Response - Model *ListConfigurationAssignmentsResult -} - -// ListParent ... -func (c ConfigurationAssignmentsClient) ListParent(ctx context.Context, id commonids.ScopeId) (result ListParentOperationResponse, err error) { - req, err := c.preparerForListParent(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "ListParent", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "ListParent", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListParent(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "ListParent", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListParent prepares the ListParent request. -func (c ConfigurationAssignmentsClient) preparerForListParent(ctx context.Context, id commonids.ScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/configurationAssignments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListParent handles the response to the ListParent request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForListParent(resp *http.Response) (result ListParentOperationResponse, 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/maintenance/2022-07-01-preview/configurationassignments/method_withinsubscriptionlist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_withinsubscriptionlist.go new file mode 100644 index 000000000000..397cb7eaa370 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_withinsubscriptionlist.go @@ -0,0 +1,53 @@ +package configurationassignments + +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 WithinSubscriptionListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ListConfigurationAssignmentsResult +} + +// WithinSubscriptionList ... +func (c ConfigurationAssignmentsClient) WithinSubscriptionList(ctx context.Context, id commonids.SubscriptionId) (result WithinSubscriptionListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Maintenance/configurationAssignments", 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/maintenance/2022-07-01-preview/configurationassignments/method_withinsubscriptionlist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_withinsubscriptionlist_autorest.go deleted file mode 100644 index 428114ee2780..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/configurationassignments/method_withinsubscriptionlist_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package configurationassignments - -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 WithinSubscriptionListOperationResponse struct { - HttpResponse *http.Response - Model *ListConfigurationAssignmentsResult -} - -// WithinSubscriptionList ... -func (c ConfigurationAssignmentsClient) WithinSubscriptionList(ctx context.Context, id commonids.SubscriptionId) (result WithinSubscriptionListOperationResponse, err error) { - req, err := c.preparerForWithinSubscriptionList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "WithinSubscriptionList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "WithinSubscriptionList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForWithinSubscriptionList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "WithinSubscriptionList", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForWithinSubscriptionList prepares the WithinSubscriptionList request. -func (c ConfigurationAssignmentsClient) preparerForWithinSubscriptionList(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.Maintenance/configurationAssignments", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForWithinSubscriptionList handles the response to the WithinSubscriptionList request. The method always -// closes the http.Response Body. -func (c ConfigurationAssignmentsClient) responderForWithinSubscriptionList(resp *http.Response) (result WithinSubscriptionListOperationResponse, 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/maintenance/2022-07-01-preview/maintenanceconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/client.go index c955dc01ae80..4d799de617cf 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/client.go @@ -1,18 +1,26 @@ package maintenanceconfigurations -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 MaintenanceConfigurationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewMaintenanceConfigurationsClientWithBaseURI(endpoint string) MaintenanceConfigurationsClient { - return MaintenanceConfigurationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewMaintenanceConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*MaintenanceConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "maintenanceconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating MaintenanceConfigurationsClient: %+v", err) } + + return &MaintenanceConfigurationsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/constants.go index 15df316cce2b..fa773a76e0d5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/constants.go @@ -1,6 +1,10 @@ package maintenanceconfigurations -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 PossibleValuesForMaintenanceScope() []string { } } +func (s *MaintenanceScope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMaintenanceScope(input string) (*MaintenanceScope, error) { vals := map[string]MaintenanceScope{ "extension": MaintenanceScopeExtension, @@ -64,6 +81,19 @@ func PossibleValuesForRebootOptions() []string { } } +func (s *RebootOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebootOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseRebootOptions(input string) (*RebootOptions, error) { vals := map[string]RebootOptions{ "always": RebootOptionsAlways, @@ -93,6 +123,19 @@ func PossibleValuesForTaskScope() []string { } } +func (s *TaskScope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTaskScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTaskScope(input string) (*TaskScope, error) { vals := map[string]TaskScope{ "global": TaskScopeGlobal, @@ -121,6 +164,19 @@ func PossibleValuesForVisibility() []string { } } +func (s *Visibility) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVisibility(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVisibility(input string) (*Visibility, error) { vals := map[string]Visibility{ "custom": VisibilityCustom, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_createorupdate.go new file mode 100644 index 000000000000..884829064800 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_createorupdate.go @@ -0,0 +1,55 @@ +package maintenanceconfigurations + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MaintenanceConfiguration +} + +// CreateOrUpdate ... +func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_createorupdate_autorest.go deleted file mode 100644 index 57eb1a03ef4b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package maintenanceconfigurations - -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 CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *MaintenanceConfiguration -} - -// CreateOrUpdate ... -func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c MaintenanceConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*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)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, 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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_delete.go new file mode 100644 index 000000000000..57f6f2f1c89b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_delete.go @@ -0,0 +1,52 @@ +package maintenanceconfigurations + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MaintenanceConfiguration +} + +// Delete ... +func (c MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_delete_autorest.go deleted file mode 100644 index 4db05510870c..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_delete_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package maintenanceconfigurations - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DeleteOperationResponse struct { - HttpResponse *http.Response - Model *MaintenanceConfiguration -} - -// Delete ... -func (c MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c MaintenanceConfigurationsClient) preparerForDelete(ctx context.Context, id MaintenanceConfigurationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_forresourcegrouplist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_forresourcegrouplist.go new file mode 100644 index 000000000000..20a63655fdda --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_forresourcegrouplist.go @@ -0,0 +1,53 @@ +package maintenanceconfigurations + +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 ForResourceGroupListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ListMaintenanceConfigurationsResult +} + +// ForResourceGroupList ... +func (c MaintenanceConfigurationsClient) ForResourceGroupList(ctx context.Context, id commonids.ResourceGroupId) (result ForResourceGroupListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.Maintenance/maintenanceConfigurations", 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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_forresourcegrouplist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_forresourcegrouplist_autorest.go deleted file mode 100644 index ef931f5c0c62..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_forresourcegrouplist_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package maintenanceconfigurations - -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 ForResourceGroupListOperationResponse struct { - HttpResponse *http.Response - Model *ListMaintenanceConfigurationsResult -} - -// ForResourceGroupList ... -func (c MaintenanceConfigurationsClient) ForResourceGroupList(ctx context.Context, id commonids.ResourceGroupId) (result ForResourceGroupListOperationResponse, err error) { - req, err := c.preparerForForResourceGroupList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ForResourceGroupList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ForResourceGroupList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForForResourceGroupList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ForResourceGroupList", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForForResourceGroupList prepares the ForResourceGroupList request. -func (c MaintenanceConfigurationsClient) preparerForForResourceGroupList(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.Maintenance/maintenanceConfigurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForForResourceGroupList handles the response to the ForResourceGroupList request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForForResourceGroupList(resp *http.Response) (result ForResourceGroupListOperationResponse, 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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_get.go new file mode 100644 index 000000000000..9a6e4324c68e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_get.go @@ -0,0 +1,51 @@ +package maintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// Get ... +func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_get_autorest.go deleted file mode 100644 index 57a6eb55e01d..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package maintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// Get ... -func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c MaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id MaintenanceConfigurationId) (*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 MaintenanceConfigurationsClient) 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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_list.go new file mode 100644 index 000000000000..ca7fc47d16b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_list.go @@ -0,0 +1,53 @@ +package maintenanceconfigurations + +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 *ListMaintenanceConfigurationsResult +} + +// List ... +func (c MaintenanceConfigurationsClient) 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.Maintenance/maintenanceConfigurations", 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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_list_autorest.go deleted file mode 100644 index a804bec70ad3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package maintenanceconfigurations - -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 *ListMaintenanceConfigurationsResult -} - -// List ... -func (c MaintenanceConfigurationsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c MaintenanceConfigurationsClient) 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.Maintenance/maintenanceConfigurations", 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 MaintenanceConfigurationsClient) 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/maintenance/2022-07-01-preview/maintenanceconfigurations/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_update.go new file mode 100644 index 000000000000..b1558dfe42ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_update.go @@ -0,0 +1,55 @@ +package maintenanceconfigurations + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *MaintenanceConfiguration +} + +// Update ... +func (c MaintenanceConfigurationsClient) Update(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_update_autorest.go deleted file mode 100644 index 0410ac2e145f..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package maintenanceconfigurations - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *MaintenanceConfiguration -} - -// Update ... -func (c MaintenanceConfigurationsClient) Update(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c MaintenanceConfigurationsClient) preparerForUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c MaintenanceConfigurationsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/client.go index 94b34c9c260d..79ca5fc9e3ce 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/client.go @@ -1,18 +1,26 @@ package publicmaintenanceconfigurations -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 PublicMaintenanceConfigurationsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewPublicMaintenanceConfigurationsClientWithBaseURI(endpoint string) PublicMaintenanceConfigurationsClient { - return PublicMaintenanceConfigurationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewPublicMaintenanceConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*PublicMaintenanceConfigurationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "publicmaintenanceconfigurations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PublicMaintenanceConfigurationsClient: %+v", err) } + + return &PublicMaintenanceConfigurationsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/constants.go index fda205caf7e1..fac0aaca237e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/constants.go @@ -1,6 +1,10 @@ package publicmaintenanceconfigurations -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 PossibleValuesForMaintenanceScope() []string { } } +func (s *MaintenanceScope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseMaintenanceScope(input string) (*MaintenanceScope, error) { vals := map[string]MaintenanceScope{ "extension": MaintenanceScopeExtension, @@ -64,6 +81,19 @@ func PossibleValuesForRebootOptions() []string { } } +func (s *RebootOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebootOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseRebootOptions(input string) (*RebootOptions, error) { vals := map[string]RebootOptions{ "always": RebootOptionsAlways, @@ -93,6 +123,19 @@ func PossibleValuesForTaskScope() []string { } } +func (s *TaskScope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTaskScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseTaskScope(input string) (*TaskScope, error) { vals := map[string]TaskScope{ "global": TaskScopeGlobal, @@ -121,6 +164,19 @@ func PossibleValuesForVisibility() []string { } } +func (s *Visibility) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVisibility(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseVisibility(input string) (*Visibility, error) { vals := map[string]Visibility{ "custom": VisibilityCustom, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_get.go new file mode 100644 index 000000000000..a65fb2dc83e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_get.go @@ -0,0 +1,51 @@ +package publicmaintenanceconfigurations + +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 *MaintenanceConfiguration +} + +// Get ... +func (c PublicMaintenanceConfigurationsClient) Get(ctx context.Context, id PublicMaintenanceConfigurationId) (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/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_get_autorest.go deleted file mode 100644 index b2f4cafb7c04..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package publicmaintenanceconfigurations - -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 *MaintenanceConfiguration -} - -// Get ... -func (c PublicMaintenanceConfigurationsClient) Get(ctx context.Context, id PublicMaintenanceConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PublicMaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id PublicMaintenanceConfigurationId) (*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 PublicMaintenanceConfigurationsClient) 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/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_list.go new file mode 100644 index 000000000000..846c47a0ad2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_list.go @@ -0,0 +1,53 @@ +package publicmaintenanceconfigurations + +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 *ListMaintenanceConfigurationsResult +} + +// List ... +func (c PublicMaintenanceConfigurationsClient) 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.Maintenance/publicMaintenanceConfigurations", 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/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_list_autorest.go deleted file mode 100644 index 0716b1ccefeb..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/method_list_autorest.go +++ /dev/null @@ -1,70 +0,0 @@ -package publicmaintenanceconfigurations - -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 *ListMaintenanceConfigurationsResult -} - -// List ... -func (c PublicMaintenanceConfigurationsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c PublicMaintenanceConfigurationsClient) 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.Maintenance/publicMaintenanceConfigurations", 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 PublicMaintenanceConfigurationsClient) 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/sdk/client/client.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go index 5dc6879f87cd..b6689bbe77ce 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/client.go @@ -189,6 +189,11 @@ func (r *Response) Unmarshal(model interface{}) error { // Trim away a BOM if present respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + // In some cases the respBody is empty, but not nil, so don't attempt to unmarshal this + if len(respBody) == 0 { + return nil + } + // Unmarshal into provided model if err := json.Unmarshal(respBody, model); err != nil { return fmt.Errorf("unmarshaling response body: %+v", err) @@ -210,6 +215,11 @@ func (r *Response) Unmarshal(model interface{}) error { // Trim away a BOM if present respBody = bytes.TrimPrefix(respBody, []byte("\xef\xbb\xbf")) + // In some cases the respBody is empty, but not nil, so don't attempt to unmarshal this + if len(respBody) == 0 { + return nil + } + // Unmarshal into provided model if err := xml.Unmarshal(respBody, model); err != nil { return err @@ -289,6 +299,49 @@ func NewClient(baseUri string, serviceName, apiVersion string) *Client { } } +// SetAuthorizer configures the request authorizer for the client +func (c *Client) SetAuthorizer(authorizer auth.Authorizer) { + c.Authorizer = authorizer +} + +// SetUserAgent configures the user agent to be included in requests +func (c *Client) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} + +// GetUserAgent retrieves the configured user agent for the client +func (c *Client) GetUserAgent() string { + return c.UserAgent +} + +// AppendRequestMiddleware appends a request middleware function for the client +func (c *Client) AppendRequestMiddleware(f RequestMiddleware) { + if c.RequestMiddlewares == nil { + m := make([]RequestMiddleware, 0) + c.RequestMiddlewares = &m + } + *c.RequestMiddlewares = append(*c.RequestMiddlewares, f) +} + +// ClearRequestMiddlewares removes all request middleware functions for the client +func (c *Client) ClearRequestMiddlewares() { + c.RequestMiddlewares = nil +} + +// AppendResponseMiddleware appends a response middleware function for the client +func (c *Client) AppendResponseMiddleware(f ResponseMiddleware) { + if c.ResponseMiddlewares == nil { + m := make([]ResponseMiddleware, 0) + c.ResponseMiddlewares = &m + } + *c.ResponseMiddlewares = append(*c.ResponseMiddlewares, f) +} + +// ClearResponseMiddlewares removes all response middleware functions for the client +func (c *Client) ClearResponseMiddlewares() { + c.ResponseMiddlewares = nil +} + // NewRequest configures a new *Request func (c *Client) NewRequest(ctx context.Context, input RequestOptions) (*Request, error) { req := (&http.Request{}).WithContext(ctx) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go index da302e24adde..5886a19ff574 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/sdk/client/interface.go @@ -7,6 +7,7 @@ import ( "context" "net/http" + "github.com/hashicorp/go-azure-sdk/sdk/auth" "github.com/hashicorp/go-azure-sdk/sdk/odata" ) @@ -19,6 +20,27 @@ type BaseClient interface { // NewRequest constructs a *Request that can be passed to Execute or ExecutePaged NewRequest(ctx context.Context, input RequestOptions) (*Request, error) + + // SetAuthorizer configures the request authorizer for the client + SetAuthorizer(auth.Authorizer) + + // SetUserAgent configures the user agent to be included in requests + SetUserAgent(string) + + // GetUserAgent retrieves the configured user agent for the client + GetUserAgent() string + + // AppendRequestMiddleware appends a request middleware function for the client + AppendRequestMiddleware(RequestMiddleware) + + // ClearRequestMiddlewares removes all request middleware functions for the client + ClearRequestMiddlewares() + + // AppendResponseMiddleware appends a response middleware function for the client + AppendResponseMiddleware(ResponseMiddleware) + + // ClearResponseMiddlewares removes all response middleware functions for the client + ClearResponseMiddlewares() } // RequestRetryFunc is a function that determines whether an HTTP request has failed due to eventual consistency and should be retried diff --git a/vendor/modules.txt b/vendor/modules.txt index d3cb4622112a..f8b9b143ce20 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -153,7 +153,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/resource-manager v0.20240208.1095436 +# github.com/hashicorp/go-azure-sdk/resource-manager v0.20240209.1123314 ## 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 @@ -1043,7 +1043,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/resourceprovid github.com/hashicorp/go-azure-sdk/resource-manager/web/2023-01-01/webapps github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01 github.com/hashicorp/go-azure-sdk/resource-manager/webpubsub/2023-02-01/webpubsub -# github.com/hashicorp/go-azure-sdk/sdk v0.20240208.1095436 +# github.com/hashicorp/go-azure-sdk/sdk v0.20240209.1123314 ## explicit; go 1.21 github.com/hashicorp/go-azure-sdk/sdk/auth github.com/hashicorp/go-azure-sdk/sdk/auth/autorest