From d3a6fcb27e643b9bb2b52252081fa3f5cf4e8853 Mon Sep 17 00:00:00 2001 From: xuwu1 Date: Fri, 29 Jul 2022 17:12:33 +0800 Subject: [PATCH 1/2] update dscconfiguration api version to 2022-08-08 to fix GetContent issue --- internal/clients/client.go | 4 +- .../automation_dsc_configuration_resource.go | 2 +- ...omation_dsc_configuration_resource_test.go | 3 +- internal/services/automation/client/client.go | 17 +- .../2019-06-01/dscconfiguration/client.go | 18 -- .../method_createorupdate_autorest.go | 69 ------ .../method_delete_autorest.go | 66 ----- .../dscconfiguration/method_get_autorest.go | 68 ------ .../method_getcontent_autorest.go | 69 ------ ...method_listbyautomationaccount_autorest.go | 230 ------------------ .../method_update_autorest.go | 69 ------ .../dscconfiguration/README.md | 6 +- .../2022-08-08/dscconfiguration/client.go | 26 ++ .../dscconfiguration/constants.go | 45 +++- .../dscconfiguration/id_automationaccount.go | 0 .../dscconfiguration/id_configuration.go | 0 .../dscconfiguration/method_createorupdate.go | 56 +++++ .../dscconfiguration/method_delete.go | 47 ++++ .../2022-08-08/dscconfiguration/method_get.go | 51 ++++ .../dscconfiguration/method_getcontent.go | 52 ++++ .../method_listbyautomationaccount.go | 129 ++++++++++ .../dscconfiguration/method_update.go | 55 +++++ .../dscconfiguration/model_contenthash.go | 0 .../dscconfiguration/model_contentsource.go | 0 .../model_dscconfiguration.go | 0 ...scconfigurationcreateorupdateparameters.go | 0 ...scconfigurationcreateorupdateproperties.go | 0 .../model_dscconfigurationparameter.go | 0 .../model_dscconfigurationproperties.go | 0 .../model_dscconfigurationupdateparameters.go | 0 .../dscconfiguration/predicates.go | 0 .../dscconfiguration/version.go | 2 +- vendor/modules.txt | 2 +- 33 files changed, 481 insertions(+), 605 deletions(-) delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/client.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_createorupdate_autorest.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_delete_autorest.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_get_autorest.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_getcontent_autorest.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_listbyautomationaccount_autorest.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_update_autorest.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/README.md (95%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/client.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/constants.go (69%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/id_automationaccount.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/id_configuration.go (100%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_getcontent.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_listbyautomationaccount.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_update.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_contenthash.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_contentsource.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_dscconfiguration.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_dscconfigurationcreateorupdateparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_dscconfigurationcreateorupdateproperties.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_dscconfigurationparameter.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_dscconfigurationproperties.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/model_dscconfigurationupdateparameters.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/predicates.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/{2019-06-01 => 2022-08-08}/dscconfiguration/version.go (88%) diff --git a/internal/clients/client.go b/internal/clients/client.go index b0eaf388f6fc..0c8eca20e33e 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -305,7 +305,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error return fmt.Errorf("building clients for Authorization: %+v", err) } client.Automanage = automanage.NewClient(o) - client.Automation = automation.NewClient(o) + if client.Automation, err = automation.NewClient(o); err != nil { + return fmt.Errorf("building clients for Automation: %+v", err) + } client.AzureStackHCI = azureStackHCI.NewClient(o) if client.Batch, err = batch.NewClient(o); err != nil { return fmt.Errorf("building clients for Batch: %+v", err) diff --git a/internal/services/automation/automation_dsc_configuration_resource.go b/internal/services/automation/automation_dsc_configuration_resource.go index b4096886f18d..c56df3dc91c0 100644 --- a/internal/services/automation/automation_dsc_configuration_resource.go +++ b/internal/services/automation/automation_dsc_configuration_resource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/automation/automation_dsc_configuration_resource_test.go b/internal/services/automation/automation_dsc_configuration_resource_test.go index f5a6f03d6981..1d7a546761de 100644 --- a/internal/services/automation/automation_dsc_configuration_resource_test.go +++ b/internal/services/automation/automation_dsc_configuration_resource_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -61,7 +61,6 @@ func TestAccAutomationDscConfiguration_complete(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), }) } diff --git a/internal/services/automation/client/client.go b/internal/services/automation/client/client.go index dd4bb6a6ad0a..ff7e323561bf 100644 --- a/internal/services/automation/client/client.go +++ b/internal/services/automation/client/client.go @@ -1,9 +1,10 @@ package client import ( + "fmt" + "github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation" // nolint: staticcheck "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2015-10-31/webhook" - "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration" "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/runbook" "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/softwareupdateconfiguration" "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2020-01-13-preview/certificate" @@ -20,6 +21,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount" "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworker" "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworkergroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -47,7 +49,7 @@ type Client struct { WebhookClient *webhook.WebhookClient } -func NewClient(o *common.ClientOptions) *Client { +func NewClient(o *common.ClientOptions) (*Client, error) { accountClient := automationaccount.NewAutomationAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) @@ -66,8 +68,11 @@ func NewClient(o *common.ClientOptions) *Client { credentialClient := credential.NewCredentialClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&credentialClient.Client, o.ResourceManagerAuthorizer) - dscConfigurationClient := dscconfiguration.NewDscConfigurationClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&dscConfigurationClient.Client, o.ResourceManagerAuthorizer) + dscConfigurationClient, err := dscconfiguration.NewDscConfigurationClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("build dscConfigurationClient: %+v", err) + } + o.Configure(dscConfigurationClient.Client, o.Authorizers.ResourceManager) dscNodeConfigurationClient := dscnodeconfiguration.NewDscNodeConfigurationClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dscNodeConfigurationClient.Client, o.ResourceManagerAuthorizer) @@ -118,7 +123,7 @@ func NewClient(o *common.ClientOptions) *Client { ConnectionClient: &connectionClient, ConnectionTypeClient: &connectionTypeClient, CredentialClient: &credentialClient, - DscConfigurationClient: &dscConfigurationClient, + DscConfigurationClient: dscConfigurationClient, DscNodeConfigurationClient: &dscNodeConfigurationClient, JobScheduleClient: &jobScheduleClient, ModuleClient: &moduleClient, @@ -133,5 +138,5 @@ func NewClient(o *common.ClientOptions) *Client { VariableClient: &variableClient, WatcherClient: &watcherClient, WebhookClient: &webhookClient, - } + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/client.go deleted file mode 100644 index 178d3a94322e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package dscconfiguration - -import "github.com/Azure/go-autorest/autorest" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DscConfigurationClient struct { - Client autorest.Client - baseUri string -} - -func NewDscConfigurationClientWithBaseURI(endpoint string) DscConfigurationClient { - return DscConfigurationClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_createorupdate_autorest.go deleted file mode 100644 index 613c2cb2d5d3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_createorupdate_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package dscconfiguration - -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 *DscConfiguration -} - -// CreateOrUpdate ... -func (c DscConfigurationClient) CreateOrUpdate(ctx context.Context, id ConfigurationId, input DscConfigurationCreateOrUpdateParameters) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DscConfigurationClient) preparerForCreateOrUpdate(ctx context.Context, id ConfigurationId, input DscConfigurationCreateOrUpdateParameters) (*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 DscConfigurationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_delete_autorest.go deleted file mode 100644 index 986aa52f978e..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_delete_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package dscconfiguration - -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 -} - -// Delete ... -func (c DscConfigurationClient) Delete(ctx context.Context, id ConfigurationId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c DscConfigurationClient) preparerForDelete(ctx context.Context, id ConfigurationId) (*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 DscConfigurationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_get_autorest.go deleted file mode 100644 index 1a5c0b1b8dc6..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package dscconfiguration - -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 *DscConfiguration -} - -// Get ... -func (c DscConfigurationClient) Get(ctx context.Context, id ConfigurationId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DscConfigurationClient) preparerForGet(ctx context.Context, id ConfigurationId) (*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 DscConfigurationClient) 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/automation/2019-06-01/dscconfiguration/method_getcontent_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_getcontent_autorest.go deleted file mode 100644 index 1f10a3da1b34..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_getcontent_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package dscconfiguration - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetContentOperationResponse struct { - HttpResponse *http.Response - Model *string -} - -// GetContent ... -func (c DscConfigurationClient) GetContent(ctx context.Context, id ConfigurationId) (result GetContentOperationResponse, err error) { - req, err := c.preparerForGetContent(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "GetContent", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "GetContent", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetContent(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "GetContent", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetContent prepares the GetContent request. -func (c DscConfigurationClient) preparerForGetContent(ctx context.Context, id ConfigurationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("text/powershell"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/content", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetContent handles the response to the GetContent request. The method always -// closes the http.Response Body. -func (c DscConfigurationClient) responderForGetContent(resp *http.Response) (result GetContentOperationResponse, 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/automation/2019-06-01/dscconfiguration/method_listbyautomationaccount_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_listbyautomationaccount_autorest.go deleted file mode 100644 index ef2515c691a7..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_listbyautomationaccount_autorest.go +++ /dev/null @@ -1,230 +0,0 @@ -package dscconfiguration - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByAutomationAccountOperationResponse struct { - HttpResponse *http.Response - Model *[]DscConfiguration - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByAutomationAccountOperationResponse, error) -} - -type ListByAutomationAccountCompleteResult struct { - Items []DscConfiguration -} - -func (r ListByAutomationAccountOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByAutomationAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByAutomationAccountOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByAutomationAccountOperationOptions struct { - Filter *string - Inlinecount *string - Skip *int64 - Top *int64 -} - -func DefaultListByAutomationAccountOperationOptions() ListByAutomationAccountOperationOptions { - return ListByAutomationAccountOperationOptions{} -} - -func (o ListByAutomationAccountOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByAutomationAccountOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Inlinecount != nil { - out["$inlinecount"] = *o.Inlinecount - } - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByAutomationAccount ... -func (c DscConfigurationClient) ListByAutomationAccount(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions) (resp ListByAutomationAccountOperationResponse, err error) { - req, err := c.preparerForListByAutomationAccount(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "ListByAutomationAccount", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByAutomationAccount(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "ListByAutomationAccount", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByAutomationAccount prepares the ListByAutomationAccount request. -func (c DscConfigurationClient) preparerForListByAutomationAccount(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/configurations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByAutomationAccountWithNextLink prepares the ListByAutomationAccount request with the given nextLink token. -func (c DscConfigurationClient) preparerForListByAutomationAccountWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByAutomationAccount handles the response to the ListByAutomationAccount request. The method always -// closes the http.Response Body. -func (c DscConfigurationClient) responderForListByAutomationAccount(resp *http.Response) (result ListByAutomationAccountOperationResponse, err error) { - type page struct { - Values []DscConfiguration `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByAutomationAccountOperationResponse, err error) { - req, err := c.preparerForListByAutomationAccountWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "ListByAutomationAccount", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "ListByAutomationAccount", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByAutomationAccount(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "ListByAutomationAccount", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByAutomationAccountComplete retrieves all of the results into a single object -func (c DscConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions) (ListByAutomationAccountCompleteResult, error) { - return c.ListByAutomationAccountCompleteMatchingPredicate(ctx, id, options, DscConfigurationOperationPredicate{}) -} - -// ListByAutomationAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DscConfigurationClient) ListByAutomationAccountCompleteMatchingPredicate(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions, predicate DscConfigurationOperationPredicate) (resp ListByAutomationAccountCompleteResult, err error) { - items := make([]DscConfiguration, 0) - - page, err := c.ListByAutomationAccount(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByAutomationAccountCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_update_autorest.go deleted file mode 100644 index 58dea8c91113..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/method_update_autorest.go +++ /dev/null @@ -1,69 +0,0 @@ -package dscconfiguration - -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 *DscConfiguration -} - -// Update ... -func (c DscConfigurationClient) Update(ctx context.Context, id ConfigurationId, input DscConfigurationUpdateParameters) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "dscconfiguration.DscConfigurationClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c DscConfigurationClient) preparerForUpdate(ctx context.Context, id ConfigurationId, input DscConfigurationUpdateParameters) (*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 DscConfigurationClient) 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/automation/2019-06-01/dscconfiguration/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/README.md similarity index 95% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/README.md index 34ae0837c406..2796bb88fefa 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration` Documentation -The `dscconfiguration` SDK allows for interaction with the Azure Resource Manager Service `automation` (API Version `2019-06-01`). +The `dscconfiguration` SDK allows for interaction with the Azure Resource Manager Service `automation` (API Version `2022-08-08`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). ### Import Path ```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration" +import "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/client.go new file mode 100644 index 000000000000..e9fc8c53627a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/client.go @@ -0,0 +1,26 @@ +package dscconfiguration + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "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 DscConfigurationClient struct { + Client *resourcemanager.Client +} + +func NewDscConfigurationClientWithBaseURI(api environments.Api) (*DscConfigurationClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "dscconfiguration", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DscConfigurationClient: %+v", err) + } + + return &DscConfigurationClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/constants.go similarity index 69% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/constants.go index e8d1d57d7c86..49e2ce77152b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/constants.go @@ -1,6 +1,10 @@ package dscconfiguration -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForContentSourceType() []string { } } +func (s *ContentSourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseContentSourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseContentSourceType(input string) (*ContentSourceType, error) { vals := map[string]ContentSourceType{ "embeddedcontent": ContentSourceTypeEmbeddedContent, @@ -45,6 +62,19 @@ func PossibleValuesForDscConfigurationProvisioningState() []string { } } +func (s *DscConfigurationProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDscConfigurationProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDscConfigurationProvisioningState(input string) (*DscConfigurationProvisioningState, error) { vals := map[string]DscConfigurationProvisioningState{ "succeeded": DscConfigurationProvisioningStateSucceeded, @@ -74,6 +104,19 @@ func PossibleValuesForDscConfigurationState() []string { } } +func (s *DscConfigurationState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDscConfigurationState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseDscConfigurationState(input string) (*DscConfigurationState, error) { vals := map[string]DscConfigurationState{ "edit": DscConfigurationStateEdit, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/id_automationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/id_automationaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/id_automationaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/id_automationaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/id_configuration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/id_configuration.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/id_configuration.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/id_configuration.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_createorupdate.go new file mode 100644 index 000000000000..a342fb283799 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_createorupdate.go @@ -0,0 +1,56 @@ +package dscconfiguration + +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 *DscConfiguration +} + +// CreateOrUpdate ... +func (c DscConfigurationClient) CreateOrUpdate(ctx context.Context, id ConfigurationId, input DscConfigurationCreateOrUpdateParameters) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_delete.go new file mode 100644 index 000000000000..e570f872f5f3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_delete.go @@ -0,0 +1,47 @@ +package dscconfiguration + +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 +} + +// Delete ... +func (c DscConfigurationClient) Delete(ctx context.Context, id ConfigurationId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_get.go new file mode 100644 index 000000000000..92713152675b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_get.go @@ -0,0 +1,51 @@ +package dscconfiguration + +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 *DscConfiguration +} + +// Get ... +func (c DscConfigurationClient) Get(ctx context.Context, id ConfigurationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + 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/automation/2022-08-08/dscconfiguration/method_getcontent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_getcontent.go new file mode 100644 index 000000000000..8b0cbdf82297 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_getcontent.go @@ -0,0 +1,52 @@ +package dscconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetContentOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]byte +} + +// GetContent ... +func (c DscConfigurationClient) GetContent(ctx context.Context, id ConfigurationId) (result GetContentOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/content", 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/automation/2022-08-08/dscconfiguration/method_listbyautomationaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_listbyautomationaccount.go new file mode 100644 index 000000000000..ca49899364a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_listbyautomationaccount.go @@ -0,0 +1,129 @@ +package dscconfiguration + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByAutomationAccountOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DscConfiguration +} + +type ListByAutomationAccountCompleteResult struct { + Items []DscConfiguration +} + +type ListByAutomationAccountOperationOptions struct { + Filter *string + Inlinecount *string + Skip *int64 + Top *int64 +} + +func DefaultListByAutomationAccountOperationOptions() ListByAutomationAccountOperationOptions { + return ListByAutomationAccountOperationOptions{} +} + +func (o ListByAutomationAccountOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByAutomationAccountOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByAutomationAccountOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Inlinecount != nil { + out.Append("$inlinecount", fmt.Sprintf("%v", *o.Inlinecount)) + } + if o.Skip != nil { + out.Append("$skip", fmt.Sprintf("%v", *o.Skip)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListByAutomationAccount ... +func (c DscConfigurationClient) ListByAutomationAccount(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions) (result ListByAutomationAccountOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/configurations", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]DscConfiguration `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByAutomationAccountComplete retrieves all the results into a single object +func (c DscConfigurationClient) ListByAutomationAccountComplete(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions) (ListByAutomationAccountCompleteResult, error) { + return c.ListByAutomationAccountCompleteMatchingPredicate(ctx, id, options, DscConfigurationOperationPredicate{}) +} + +// ListByAutomationAccountCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DscConfigurationClient) ListByAutomationAccountCompleteMatchingPredicate(ctx context.Context, id AutomationAccountId, options ListByAutomationAccountOperationOptions, predicate DscConfigurationOperationPredicate) (result ListByAutomationAccountCompleteResult, err error) { + items := make([]DscConfiguration, 0) + + resp, err := c.ListByAutomationAccount(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByAutomationAccountCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_update.go new file mode 100644 index 000000000000..7a6860fca122 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/method_update.go @@ -0,0 +1,55 @@ +package dscconfiguration + +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 *DscConfiguration +} + +// Update ... +func (c DscConfigurationClient) Update(ctx context.Context, id ConfigurationId, input DscConfigurationUpdateParameters) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + 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/automation/2019-06-01/dscconfiguration/model_contenthash.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_contenthash.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_contenthash.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_contenthash.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_contentsource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_contentsource.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_contentsource.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_contentsource.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfiguration.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfiguration.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfiguration.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationcreateorupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationcreateorupdateparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationcreateorupdateparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationcreateorupdateparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationcreateorupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationcreateorupdateproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationcreateorupdateproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationcreateorupdateproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationparameter.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationparameter.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationparameter.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationupdateparameters.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationupdateparameters.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/model_dscconfigurationupdateparameters.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/model_dscconfigurationupdateparameters.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/version.go similarity index 88% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/version.go index ad3e1ae5bcb8..e2865cece22e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration/version.go @@ -5,7 +5,7 @@ import "fmt" // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2019-06-01" +const defaultApiVersion = "2022-08-08" func userAgent() string { return fmt.Sprintf("hashicorp/go-azure-sdk/dscconfiguration/%s", defaultApiVersion) diff --git a/vendor/modules.txt b/vendor/modules.txt index 2d0411ef035f..b5475ecd4867 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -158,7 +158,6 @@ github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/role github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests github.com/hashicorp/go-azure-sdk/resource-manager/automation/2015-10-31/webhook -github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/dscconfiguration github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/runbook github.com/hashicorp/go-azure-sdk/resource-manager/automation/2019-06-01/softwareupdateconfiguration github.com/hashicorp/go-azure-sdk/resource-manager/automation/2020-01-13-preview/certificate @@ -175,6 +174,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/automation/2020-01-13-preview github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworker github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/hybridrunbookworkergroup +github.com/hashicorp/go-azure-sdk/resource-manager/automation/2022-08-08/dscconfiguration github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01 github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/arcsettings github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2022-12-01/cluster From 4fc884bc38f096cc35b297c9f818d26607f68986 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Fri, 7 Jul 2023 13:30:38 +0200 Subject: [PATCH 2/2] r/automation_dsc_configuration: re-introducing the `Import` check --- .../automation/automation_dsc_configuration_resource_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/services/automation/automation_dsc_configuration_resource_test.go b/internal/services/automation/automation_dsc_configuration_resource_test.go index 1d7a546761de..3689aea5124a 100644 --- a/internal/services/automation/automation_dsc_configuration_resource_test.go +++ b/internal/services/automation/automation_dsc_configuration_resource_test.go @@ -61,6 +61,7 @@ func TestAccAutomationDscConfiguration_complete(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, + data.ImportStep(), }) }