From f63a44233fa52ad23b1a3b2670de176070a7285a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 26 Jul 2023 22:55:04 +0000 Subject: [PATCH] CodeGen from PR 24559 in Azure/azure-rest-api-specs Merge 9135665ce55669872eb9724a066a492febe5c8f6 into 1239132db8b04a0642202da6d47c68e302486c5f --- .../armdeploymentscripts/CHANGELOG.md | 4 + .../armdeploymentscripts/autorest.md | 6 +- .../resources/armdeploymentscripts/client.go | 78 +- .../client_example_test.go | 764 ------------------ .../armdeploymentscripts/client_factory.go | 3 +- .../armdeploymentscripts/constants.go | 5 +- .../resources/armdeploymentscripts/go.mod | 12 +- .../resources/armdeploymentscripts/go.sum | 20 +- .../armdeploymentscripts/interfaces.go | 18 + .../resources/armdeploymentscripts/models.go | 73 +- .../armdeploymentscripts/models_serde.go | 3 +- .../resources/armdeploymentscripts/options.go | 54 ++ .../polymorphic_helpers.go | 8 +- .../armdeploymentscripts/response_types.go | 10 +- .../armdeploymentscripts/time_rfc3339.go | 3 +- 15 files changed, 172 insertions(+), 889 deletions(-) delete mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/client_example_test.go create mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/interfaces.go create mode 100644 sdk/resourcemanager/resources/armdeploymentscripts/options.go diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md b/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md index e8b874b65876..24a927f75bb8 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md +++ b/sdk/resourcemanager/resources/armdeploymentscripts/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 2.0.2 (2023-07-26) +### Other Changes + + ## 2.0.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md b/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md index 74f1541b6636..bff62fb1d214 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md +++ b/sdk/resourcemanager/resources/armdeploymentscripts/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resources/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resources/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.1 +module-version: 2.0.2 package-deploymentscripts: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/client.go b/sdk/resourcemanager/resources/armdeploymentscripts/client.go index c5c9256ca740..51b59e46fe54 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/client.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts @@ -59,7 +58,8 @@ func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller[ClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,18 +70,20 @@ func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, // // Generated from API version 2020-10-01 func (client *Client) create(ctx context.Context, resourceGroupName string, scriptName string, deploymentScript DeploymentScriptClassification, options *ClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, scriptName, deploymentScript, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -107,7 +109,10 @@ func (client *Client) createCreateRequest(ctx context.Context, resourceGroupName reqQP.Set("api-version", "2020-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, deploymentScript) + if err := runtime.MarshalAsJSON(req, deploymentScript); err != nil { + return nil, err + } + return req, nil } // Delete - Deletes a deployment script. When operation completes, status code 200 returned without content. @@ -118,16 +123,18 @@ func (client *Client) createCreateRequest(ctx context.Context, resourceGroupName // - scriptName - Name of the deployment script. // - options - ClientDeleteOptions contains the optional parameters for the Client.Delete method. func (client *Client) Delete(ctx context.Context, resourceGroupName string, scriptName string, options *ClientDeleteOptions) (ClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, scriptName, options) if err != nil { return ClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ClientDeleteResponse{}, err } return ClientDeleteResponse{}, nil } @@ -166,18 +173,21 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // - scriptName - Name of the deployment script. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, scriptName string, options *ClientGetOptions) (ClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, scriptName, options) if err != nil { return ClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -223,18 +233,21 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // - scriptName - Name of the deployment script. // - options - ClientGetLogsOptions contains the optional parameters for the Client.GetLogs method. func (client *Client) GetLogs(ctx context.Context, resourceGroupName string, scriptName string, options *ClientGetLogsOptions) (ClientGetLogsResponse, error) { + var err error req, err := client.getLogsCreateRequest(ctx, resourceGroupName, scriptName, options) if err != nil { return ClientGetLogsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetLogsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetLogsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetLogsResponse{}, err } - return client.getLogsHandleResponse(resp) + resp, err := client.getLogsHandleResponse(httpResp) + return resp, err } // getLogsCreateRequest creates the GetLogs request. @@ -280,18 +293,21 @@ func (client *Client) getLogsHandleResponse(resp *http.Response) (ClientGetLogsR // - scriptName - Name of the deployment script. // - options - ClientGetLogsDefaultOptions contains the optional parameters for the Client.GetLogsDefault method. func (client *Client) GetLogsDefault(ctx context.Context, resourceGroupName string, scriptName string, options *ClientGetLogsDefaultOptions) (ClientGetLogsDefaultResponse, error) { + var err error req, err := client.getLogsDefaultCreateRequest(ctx, resourceGroupName, scriptName, options) if err != nil { return ClientGetLogsDefaultResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetLogsDefaultResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetLogsDefaultResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetLogsDefaultResponse{}, err } - return client.getLogsDefaultHandleResponse(resp) + resp, err := client.getLogsDefaultHandleResponse(httpResp) + return resp, err } // getLogsDefaultCreateRequest creates the GetLogsDefault request. @@ -464,18 +480,21 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // - scriptName - Name of the deployment script. // - options - ClientUpdateOptions contains the optional parameters for the Client.Update method. func (client *Client) Update(ctx context.Context, resourceGroupName string, scriptName string, options *ClientUpdateOptions) (ClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, scriptName, options) if err != nil { return ClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -502,7 +521,10 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.DeploymentScript != nil { - return req, runtime.MarshalAsJSON(req, *options.DeploymentScript) + if err := runtime.MarshalAsJSON(req, *options.DeploymentScript); err != nil { + return nil, err + } + return req, nil } return req, nil } diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/client_example_test.go b/sdk/resourcemanager/resources/armdeploymentscripts/client_example_test.go deleted file mode 100644 index 1ea0e3d5ebe9..000000000000 --- a/sdk/resourcemanager/resources/armdeploymentscripts/client_example_test.go +++ /dev/null @@ -1,764 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdeploymentscripts_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeploymentscripts/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Create.json -func ExampleClient_BeginCreate_deploymentScriptsCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreate(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.AzurePowerShellScript{ - Identity: &armdeploymentscripts.ManagedServiceIdentity{ - Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {}, - }, - }, - Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - Location: to.Ptr("westus"), - Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - RetentionInterval: to.Ptr("PT7D"), - ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - SupportingScriptUris: []*string{ - to.Ptr("https://uri1.to.supporting.script"), - to.Ptr("https://uri2.to.supporting.script")}, - Timeout: to.Ptr("PT1H"), - AzPowerShellVersion: to.Ptr("1.7.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientCreateResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // SupportingScriptUris: []*string{ - // to.Ptr("https://uri1.to.supporting.script"), - // to.Ptr("https://uri2.to.supporting.script")}, - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Create_No_UserManagedIdentity.json -func ExampleClient_BeginCreate_deploymentScriptsCreateNoUserManagedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreate(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.AzurePowerShellScript{ - Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - Location: to.Ptr("westus"), - Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - RetentionInterval: to.Ptr("PT7D"), - ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - SupportingScriptUris: []*string{ - to.Ptr("https://uri1.to.supporting.script"), - to.Ptr("https://uri2.to.supporting.script")}, - Timeout: to.Ptr("PT1H"), - AzPowerShellVersion: to.Ptr("1.7.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientCreateResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // SupportingScriptUris: []*string{ - // to.Ptr("https://uri1.to.supporting.script"), - // to.Ptr("https://uri2.to.supporting.script")}, - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Min_Create.json -func ExampleClient_BeginCreate_deploymentScriptsCreateMinCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreate(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.AzurePowerShellScript{ - Identity: &armdeploymentscripts.ManagedServiceIdentity{ - Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {}, - }, - }, - Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - Location: to.Ptr("westus"), - Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - RetentionInterval: to.Ptr("P7D"), - ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - AzPowerShellVersion: to.Ptr("1.7.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientCreateResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Create_Using_Custom_Aci_Name.json -func ExampleClient_BeginCreate_deploymentScriptsCreateUsingCustomAciName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreate(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.AzurePowerShellScript{ - Identity: &armdeploymentscripts.ManagedServiceIdentity{ - Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {}, - }, - }, - Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - Location: to.Ptr("westus"), - Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - ContainerSettings: &armdeploymentscripts.ContainerConfiguration{ - ContainerGroupName: to.Ptr("contoso-aci"), - }, - Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - RetentionInterval: to.Ptr("PT7D"), - ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - SupportingScriptUris: []*string{ - to.Ptr("https://uri1.to.supporting.script"), - to.Ptr("https://uri2.to.supporting.script")}, - Timeout: to.Ptr("PT1H"), - AzPowerShellVersion: to.Ptr("1.7.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientCreateResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // ContainerSettings: &armdeploymentscripts.ContainerConfiguration{ - // ContainerGroupName: to.Ptr("contoso-aci"), - // }, - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // SupportingScriptUris: []*string{ - // to.Ptr("https://uri1.to.supporting.script"), - // to.Ptr("https://uri2.to.supporting.script")}, - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Create_Using_Existing_StorageAccount.json -func ExampleClient_BeginCreate_deploymentScriptsCreateUsingExistingStorageAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreate(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.AzurePowerShellScript{ - Identity: &armdeploymentscripts.ManagedServiceIdentity{ - Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": {}, - }, - }, - Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - Location: to.Ptr("westus"), - Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - StorageAccountSettings: &armdeploymentscripts.StorageAccountConfiguration{ - StorageAccountKey: to.Ptr("contosostoragekey"), - StorageAccountName: to.Ptr("contosostorage"), - }, - Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - RetentionInterval: to.Ptr("PT7D"), - ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - SupportingScriptUris: []*string{ - to.Ptr("https://uri1.to.supporting.script"), - to.Ptr("https://uri2.to.supporting.script")}, - Timeout: to.Ptr("PT1H"), - AzPowerShellVersion: to.Ptr("1.7.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientCreateResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // StorageAccountSettings: &armdeploymentscripts.StorageAccountConfiguration{ - // StorageAccountName: to.Ptr("contosostorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // SupportingScriptUris: []*string{ - // to.Ptr("https://uri1.to.supporting.script"), - // to.Ptr("https://uri2.to.supporting.script")}, - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Update.json -func ExampleClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Update(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.ClientUpdateOptions{DeploymentScript: &armdeploymentscripts.DeploymentScriptUpdateParameter{ - Tags: map[string]*string{}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientUpdateResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // SystemData: &armdeploymentscripts.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // }, - // Tags: map[string]*string{ - // }, - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // SupportingScriptUris: []*string{ - // to.Ptr("https://uri1.to.supporting.script"), - // to.Ptr("https://uri2.to.supporting.script")}, - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Get.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "script-rg", "MyDeploymentScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdeploymentscripts.ClientGetResponse{ - // DeploymentScriptClassification: &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // SystemData: &armdeploymentscripts.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // }, - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("PT7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_Delete.json -func ExampleClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewClient().Delete(ctx, "script-rg", "MyDeploymentScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_ListBySubscription.json -func ExampleClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeploymentScriptListResult = armdeploymentscripts.DeploymentScriptListResult{ - // Value: []armdeploymentscripts.DeploymentScriptClassification{ - // &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // SystemData: &armdeploymentscripts.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // }, - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("PT7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogs.json -func ExampleClient_GetLogs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().GetLogs(ctx, "script-rg", "MyDeploymentScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScriptLogsList = armdeploymentscripts.ScriptLogsList{ - // Value: []*armdeploymentscripts.ScriptLog{ - // { - // Properties: &armdeploymentscripts.LogProperties{ - // Log: to.Ptr("script execution stdout/stderr logs"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogsDefault.json -func ExampleClient_GetLogsDefault_deploymentScriptsGetLogs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().GetLogsDefault(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.ClientGetLogsDefaultOptions{Tail: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScriptLog = armdeploymentscripts.ScriptLog{ - // Properties: &armdeploymentscripts.LogProperties{ - // Log: to.Ptr("script execution stdout/stderr logs"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_GetLogsDefaultWithTail.json -func ExampleClient_GetLogsDefault_deploymentScriptsGetLogsWithTail() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().GetLogsDefault(ctx, "script-rg", "MyDeploymentScript", &armdeploymentscripts.ClientGetLogsDefaultOptions{Tail: to.Ptr[int32](5)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScriptLog = armdeploymentscripts.ScriptLog{ - // Properties: &armdeploymentscripts.LogProperties{ - // Log: to.Ptr("script execution stdout/stderr logs"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/examples/DeploymentScripts_ListByResourceGroup.json -func ExampleClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeploymentscripts.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListByResourceGroupPager("script-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeploymentScriptListResult = armdeploymentscripts.DeploymentScriptListResult{ - // Value: []armdeploymentscripts.DeploymentScriptClassification{ - // &armdeploymentscripts.AzurePowerShellScript{ - // Identity: &armdeploymentscripts.ManagedServiceIdentity{ - // Type: to.Ptr(armdeploymentscripts.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdeploymentscripts.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai": &armdeploymentscripts.UserAssignedIdentity{ - // }, - // }, - // }, - // Kind: to.Ptr(armdeploymentscripts.ScriptTypeAzurePowerShell), - // Location: to.Ptr("westus"), - // SystemData: &armdeploymentscripts.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T01:01:01.1075056Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdeploymentscripts.CreatedByTypeApplication), - // }, - // Properties: &armdeploymentscripts.AzurePowerShellScriptProperties{ - // CleanupPreference: to.Ptr(armdeploymentscripts.CleanupOptionsAlways), - // Outputs: map[string]any{ - // "output1": "value1", - // }, - // ProvisioningState: to.Ptr(armdeploymentscripts.ScriptProvisioningStateSucceeded), - // Status: &armdeploymentscripts.ScriptStatus{ - // ContainerInstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ContainerInstance/containerGroups/scriptContainer"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-13T15:19:45-08:00"); return t}()), - // StorageAccountID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Storage/storageAccounts/scriptStorage"), - // }, - // Arguments: to.Ptr("-Location 'westus' -Name \"*rg2\""), - // RetentionInterval: to.Ptr("P7D"), - // ScriptContent: to.Ptr("Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name"), - // SupportingScriptUris: []*string{ - // to.Ptr("https://uri1.to.supporting.script"), - // to.Ptr("https://uri2.to.supporting.script")}, - // Timeout: to.Ptr("PT1H"), - // AzPowerShellVersion: to.Ptr("1.7.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/client_factory.go b/sdk/resourcemanager/resources/armdeploymentscripts/client_factory.go index 5367218c517a..9315fcb194be 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/client_factory.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/constants.go b/sdk/resourcemanager/resources/armdeploymentscripts/constants.go index 834b676b4482..2d7259f4c152 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/constants.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts const ( moduleName = "armdeploymentscripts" - moduleVersion = "v2.0.1" + moduleVersion = "v2.0.2" ) // CleanupOptions - The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/go.mod b/sdk/resourcemanager/resources/armdeploymentscripts/go.mod index 8d7224d04757..a61b36e5cb74 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/go.mod +++ b/sdk/resourcemanager/resources/armdeploymentscripts/go.mod @@ -3,8 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeploy go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.6.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armdeploymentscripts v1.0.0 @@ -12,7 +11,8 @@ require ( ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -23,9 +23,9 @@ require ( github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/go.sum b/sdk/resourcemanager/resources/armdeploymentscripts/go.sum index 958a9fbbe974..85e0da7b3387 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/go.sum +++ b/sdk/resourcemanager/resources/armdeploymentscripts/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v0.6.0 h1:zSHpZY39hfFpVNixDoFOUeLwBBX0SIRe32HaWg03R8k= @@ -35,12 +35,12 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/interfaces.go b/sdk/resourcemanager/resources/armdeploymentscripts/interfaces.go new file mode 100644 index 000000000000..cde83547adc2 --- /dev/null +++ b/sdk/resourcemanager/resources/armdeploymentscripts/interfaces.go @@ -0,0 +1,18 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdeploymentscripts + +// DeploymentScriptClassification provides polymorphic access to related types. +// Call the interface's GetDeploymentScript() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureCliScript, *AzurePowerShellScript, *DeploymentScript +type DeploymentScriptClassification interface { + // GetDeploymentScript returns the DeploymentScript content of the underlying type. + GetDeploymentScript() *DeploymentScript +} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/models.go b/sdk/resourcemanager/resources/armdeploymentscripts/models.go index a42559fc0d62..8722a4717a31 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/models.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts @@ -44,13 +43,13 @@ type AzureCliScript struct { // GetDeploymentScript implements the DeploymentScriptClassification interface for type AzureCliScript. func (a *AzureCliScript) GetDeploymentScript() *DeploymentScript { return &DeploymentScript{ + ID: a.ID, Identity: a.Identity, - Location: a.Location, - Tags: a.Tags, Kind: a.Kind, - SystemData: a.SystemData, - ID: a.ID, + Location: a.Location, Name: a.Name, + SystemData: a.SystemData, + Tags: a.Tags, Type: a.Type, } } @@ -139,13 +138,13 @@ type AzurePowerShellScript struct { // GetDeploymentScript implements the DeploymentScriptClassification interface for type AzurePowerShellScript. func (a *AzurePowerShellScript) GetDeploymentScript() *DeploymentScript { return &DeploymentScript{ + ID: a.ID, Identity: a.Identity, - Location: a.Location, - Tags: a.Tags, Kind: a.Kind, - SystemData: a.SystemData, - ID: a.ID, + Location: a.Location, Name: a.Name, + SystemData: a.SystemData, + Tags: a.Tags, Type: a.Type, } } @@ -213,51 +212,6 @@ type AzureResourceBase struct { Type *string } -// ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. -type ClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientDeleteOptions contains the optional parameters for the Client.Delete method. -type ClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ClientGetLogsDefaultOptions contains the optional parameters for the Client.GetLogsDefault method. -type ClientGetLogsDefaultOptions struct { - // The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If - // 'tail' is not provided, all available logs are shown up to container instance - // log capacity of 4mb. - Tail *int32 -} - -// ClientGetLogsOptions contains the optional parameters for the Client.GetLogs method. -type ClientGetLogsOptions struct { - // placeholder for future optional parameters -} - -// ClientGetOptions contains the optional parameters for the Client.Get method. -type ClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. -type ClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. -type ClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ClientUpdateOptions contains the optional parameters for the Client.Update method. -type ClientUpdateOptions struct { - // Deployment script resource with the tags to be updated. - DeploymentScript *DeploymentScriptUpdateParameter -} - // ContainerConfiguration - Settings to customize ACI container instance. type ContainerConfiguration struct { // Container group name, if not specified then the name will get auto-generated. Not specifying a 'containerGroupName' indicates @@ -272,15 +226,6 @@ type ContainerConfiguration struct { ContainerGroupName *string } -// DeploymentScriptClassification provides polymorphic access to related types. -// Call the interface's GetDeploymentScript() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureCliScript, *AzurePowerShellScript, *DeploymentScript -type DeploymentScriptClassification interface { - // GetDeploymentScript returns the DeploymentScript content of the underlying type. - GetDeploymentScript() *DeploymentScript -} - // DeploymentScript - Deployment script object. type DeploymentScript struct { // REQUIRED; Type of the script. diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/models_serde.go b/sdk/resourcemanager/resources/armdeploymentscripts/models_serde.go index 4895a4b68cbe..e60c493a1591 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/models_serde.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/options.go b/sdk/resourcemanager/resources/armdeploymentscripts/options.go new file mode 100644 index 000000000000..6dd22298aef2 --- /dev/null +++ b/sdk/resourcemanager/resources/armdeploymentscripts/options.go @@ -0,0 +1,54 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdeploymentscripts + +// ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. +type ClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientDeleteOptions contains the optional parameters for the Client.Delete method. +type ClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ClientGetLogsDefaultOptions contains the optional parameters for the Client.GetLogsDefault method. +type ClientGetLogsDefaultOptions struct { + // The number of lines to show from the tail of the deployment script log. Valid value is a positive number up to 1000. If + // 'tail' is not provided, all available logs are shown up to container instance + // log capacity of 4mb. + Tail *int32 +} + +// ClientGetLogsOptions contains the optional parameters for the Client.GetLogs method. +type ClientGetLogsOptions struct { + // placeholder for future optional parameters +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. +type ClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. +type ClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClientUpdateOptions contains the optional parameters for the Client.Update method. +type ClientUpdateOptions struct { + // Deployment script resource with the tags to be updated. + DeploymentScript *DeploymentScriptUpdateParameter +} diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/polymorphic_helpers.go b/sdk/resourcemanager/resources/armdeploymentscripts/polymorphic_helpers.go index 075085c19b5a..ab6bf154a2d5 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/polymorphic_helpers.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/polymorphic_helpers.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts @@ -28,7 +27,10 @@ func unmarshalDeploymentScriptClassification(rawMsg json.RawMessage) (Deployment default: b = &DeploymentScript{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDeploymentScriptClassificationArray(rawMsg json.RawMessage) ([]DeploymentScriptClassification, error) { diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/response_types.go b/sdk/resourcemanager/resources/armdeploymentscripts/response_types.go index c7f81c91b346..ebd6ec0de9fa 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/response_types.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/response_types.go @@ -3,14 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts // ClientCreateResponse contains the response from method Client.BeginCreate. type ClientCreateResponse struct { + // Deployment script object. DeploymentScriptClassification } @@ -31,16 +31,19 @@ type ClientDeleteResponse struct { // ClientGetLogsDefaultResponse contains the response from method Client.GetLogsDefault. type ClientGetLogsDefaultResponse struct { + // Script execution log object. ScriptLog } // ClientGetLogsResponse contains the response from method Client.GetLogs. type ClientGetLogsResponse struct { + // Deployment script execution logs. ScriptLogsList } // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { + // Deployment script object. DeploymentScriptClassification } @@ -56,16 +59,19 @@ func (c *ClientGetResponse) UnmarshalJSON(data []byte) error { // ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. type ClientListByResourceGroupResponse struct { + // List of deployment scripts. DeploymentScriptListResult } // ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager. type ClientListBySubscriptionResponse struct { + // List of deployment scripts. DeploymentScriptListResult } // ClientUpdateResponse contains the response from method Client.Update. type ClientUpdateResponse struct { + // Deployment script object. DeploymentScriptClassification } diff --git a/sdk/resourcemanager/resources/armdeploymentscripts/time_rfc3339.go b/sdk/resourcemanager/resources/armdeploymentscripts/time_rfc3339.go index 0fe44893872d..270b23fa1986 100644 --- a/sdk/resourcemanager/resources/armdeploymentscripts/time_rfc3339.go +++ b/sdk/resourcemanager/resources/armdeploymentscripts/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdeploymentscripts