From 21e965082c5892f92cd751b8fdf134df57466cb8 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 5 Dec 2022 06:14:07 +0000 Subject: [PATCH] CodeGen from PR 21422 in Azure/azure-rest-api-specs Merge d787456ff736897536f61727f8d243bbc2b89ca5 into 5dedb96183ff83552172039606e67eccf0b7ee20 --- .../armsqlvirtualmachine/CHANGELOG.md | 18 + .../armsqlvirtualmachine/autorest.md | 6 +- .../availabilitygrouplisteners_client.go | 29 +- ...ilitygrouplisteners_client_example_test.go | 165 ------ .../armsqlvirtualmachine/constants.go | 18 +- .../armsqlvirtualmachine/go.mod | 14 +- .../armsqlvirtualmachine/go.sum | 24 +- .../armsqlvirtualmachine/groups_client.go | 43 +- .../groups_client_example_test.go | 175 ------ .../armsqlvirtualmachine/models.go | 81 ++- .../armsqlvirtualmachine/models_serde.go | 179 ++++++ .../armsqlvirtualmachine/operations_client.go | 4 +- .../operations_client_example_test.go | 41 -- .../armsqlvirtualmachine/response_types.go | 5 + .../sqlvirtualmachines_client.go | 77 +-- .../sqlvirtualmachines_client_example_test.go | 520 ------------------ .../troubleshoot_client.go | 123 +++++ 17 files changed, 516 insertions(+), 1006 deletions(-) delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go create mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md index ea9b2a677639..fab97d5e4b05 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md @@ -1,5 +1,23 @@ # Release History +## 0.8.0 (2022-12-05) +### Features Added + +- New value `LeastPrivilegeModeNotSet` added to type alias `LeastPrivilegeMode` +- New type alias `TroubleshootingScenario` with values `TroubleshootingScenarioUnhealthyReplica` +- New function `NewTroubleshootClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TroubleshootClient, error)` +- New function `*TroubleshootClient.BeginTroubleshoot(context.Context, string, string, SQLVMTroubleshooting, *TroubleshootClientBeginTroubleshootOptions) (*runtime.Poller[TroubleshootClientTroubleshootResponse], error)` +- New struct `AADAuthenticationSettings` +- New struct `SQLVMTroubleshooting` +- New struct `TroubleshootClient` +- New struct `TroubleshootClientTroubleshootResponse` +- New struct `TroubleshootingAdditionalProperties` +- New struct `TroubleshootingStatus` +- New struct `UnhealthyReplicaInfo` +- New field `TroubleshootingStatus` in struct `Properties` +- New field `AzureAdAuthenticationSettings` in struct `ServerConfigurationsManagementSettings` + + ## 0.7.0 (2022-09-17) ### Features Added diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md index 203ed84f15b3..636d2a51f077 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/sqlvirtualmachine/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/sqlvirtualmachine/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 +module-version: 0.8.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go index 33e3ea905920..ea1584097ecf 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go @@ -57,7 +57,7 @@ func NewAvailabilityGroupListenersClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Creates or updates an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -71,7 +71,9 @@ func (client *AvailabilityGroupListenersClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[AvailabilityGroupListenersClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AvailabilityGroupListenersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[AvailabilityGroupListenersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -79,7 +81,7 @@ func (client *AvailabilityGroupListenersClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Creates or updates an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *AvailabilityGroupListenersClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, parameters AvailabilityGroupListener, options *AvailabilityGroupListenersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, parameters, options) if err != nil { @@ -119,7 +121,7 @@ func (client *AvailabilityGroupListenersClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -127,7 +129,7 @@ func (client *AvailabilityGroupListenersClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -140,7 +142,9 @@ func (client *AvailabilityGroupListenersClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[AvailabilityGroupListenersClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AvailabilityGroupListenersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[AvailabilityGroupListenersClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -148,7 +152,7 @@ func (client *AvailabilityGroupListenersClient) BeginDelete(ctx context.Context, // Delete - Deletes an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *AvailabilityGroupListenersClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, options *AvailabilityGroupListenersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, options) if err != nil { @@ -188,14 +192,15 @@ func (client *AvailabilityGroupListenersClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -244,7 +249,7 @@ func (client *AvailabilityGroupListenersClient) getCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,7 +265,7 @@ func (client *AvailabilityGroupListenersClient) getHandleResponse(resp *http.Res } // NewListByGroupPager - Lists all availability group listeners in a SQL virtual machine group. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -314,7 +319,7 @@ func (client *AvailabilityGroupListenersClient) listByGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go deleted file mode 100644 index 7c131f45bacd..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go +++ /dev/null @@ -1,165 +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. - -package armsqlvirtualmachine_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/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "testvmgroup", "agl-test", &armsqlvirtualmachine.AvailabilityGroupListenersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate_createsOrUpdatesAnAvailabilityGroupListenerUsingLoadBalancerThisIsUsedForVMsPresentInSingleSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", "agl-test", armsqlvirtualmachine.AvailabilityGroupListener{ - Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ - AvailabilityGroupName: to.Ptr("ag-test"), - LoadBalancerConfigurations: []*armsqlvirtualmachine.LoadBalancerConfiguration{ - { - LoadBalancerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb-test"), - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.1.0.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - ProbePort: to.Ptr[int32](59983), - SQLVirtualMachineInstances: []*string{ - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm3")}, - }}, - Port: to.Ptr[int32](1433), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateAvailabilityGroupListenerWithMultiSubnet.json -func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate_createsOrUpdatesAnAvailabilityGroupListenerThisIsUsedForVMsPresentInMultiSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", "agl-test", armsqlvirtualmachine.AvailabilityGroupListener{ - Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ - AvailabilityGroupName: to.Ptr("ag-test"), - MultiSubnetIPConfigurations: []*armsqlvirtualmachine.MultiSubnetIPConfiguration{ - { - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.0.0.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - SQLVirtualMachineInstance: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), - }, - { - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.0.1.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/alternate"), - }, - SQLVirtualMachineInstance: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm1"), - }}, - Port: to.Ptr[int32](1433), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "testvmgroup", "agl-test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByGroupAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_NewListByGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGroupPager("testrg", "testvmgroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go index 906f96e8d36a..8bd4f27d4ec5 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go @@ -11,7 +11,7 @@ package armsqlvirtualmachine const ( moduleName = "armsqlvirtualmachine" - moduleVersion = "v0.7.0" + moduleVersion = "v0.8.0" ) // AssessmentDayOfWeek - Day of the week to run assessment. @@ -280,12 +280,14 @@ type LeastPrivilegeMode string const ( LeastPrivilegeModeEnabled LeastPrivilegeMode = "Enabled" + LeastPrivilegeModeNotSet LeastPrivilegeMode = "NotSet" ) // PossibleLeastPrivilegeModeValues returns the possible values for the LeastPrivilegeMode const type. func PossibleLeastPrivilegeModeValues() []LeastPrivilegeMode { return []LeastPrivilegeMode{ LeastPrivilegeModeEnabled, + LeastPrivilegeModeNotSet, } } @@ -462,3 +464,17 @@ func PossibleStorageWorkloadTypeValues() []StorageWorkloadType { StorageWorkloadTypeOLTP, } } + +// TroubleshootingScenario - SQL VM troubleshooting scenario. +type TroubleshootingScenario string + +const ( + TroubleshootingScenarioUnhealthyReplica TroubleshootingScenario = "UnhealthyReplica" +) + +// PossibleTroubleshootingScenarioValues returns the possible values for the TroubleshootingScenario const type. +func PossibleTroubleshootingScenarioValues() []TroubleshootingScenario { + return []TroubleshootingScenario{ + TroubleshootingScenarioUnhealthyReplica, + } +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod index fd6005fb3a68..c422025ad953 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/a go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -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.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go index cedf520cf3bb..621bf40881fb 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go @@ -57,7 +57,7 @@ func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Creates or updates a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -70,7 +70,9 @@ func (client *GroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[GroupsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[GroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -78,7 +80,7 @@ func (client *GroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Creates or updates a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *GroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters Group, options *GroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { @@ -114,7 +116,7 @@ func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,7 +124,7 @@ func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Deletes a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -133,7 +135,9 @@ func (client *GroupsClient) BeginDelete(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[GroupsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[GroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -141,7 +145,7 @@ func (client *GroupsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *GroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, options *GroupsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, options) if err != nil { @@ -177,14 +181,15 @@ func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -224,7 +229,7 @@ func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,7 +245,7 @@ func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClient } // NewListPager - Gets all SQL virtual machine groups in a subscription. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // options - GroupsClientListOptions contains the optional parameters for the GroupsClient.List method. func (client *GroupsClient) NewListPager(options *GroupsClientListOptions) *runtime.Pager[GroupsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GroupsClientListResponse]{ @@ -282,7 +287,7 @@ func (client *GroupsClient) listCreateRequest(ctx context.Context, options *Grou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -298,7 +303,7 @@ func (client *GroupsClient) listHandleResponse(resp *http.Response) (GroupsClien } // NewListByResourceGroupPager - Gets all SQL virtual machine groups in a resource group. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // options - GroupsClientListByResourceGroupOptions contains the optional parameters for the GroupsClient.ListByResourceGroup @@ -347,7 +352,7 @@ func (client *GroupsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -364,7 +369,7 @@ func (client *GroupsClient) listByResourceGroupHandleResponse(resp *http.Respons // BeginUpdate - Updates SQL virtual machine group tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -376,7 +381,9 @@ func (client *GroupsClient) BeginUpdate(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[GroupsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[GroupsClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -384,7 +391,7 @@ func (client *GroupsClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates SQL virtual machine group tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *GroupsClient) update(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters GroupUpdate, options *GroupsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { @@ -420,7 +427,7 @@ func (client *GroupsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go deleted file mode 100644 index 22fd39c711be..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go +++ /dev/null @@ -1,175 +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. - -package armsqlvirtualmachine_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/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetSqlVirtualMachineGroup.json -func ExampleGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "testvmgroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json -func ExampleGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", armsqlvirtualmachine.Group{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - Properties: &armsqlvirtualmachine.GroupProperties{ - SQLImageOffer: to.Ptr("SQL2016-WS2016"), - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLVMGroupImageSKUEnterprise), - WsfcDomainProfile: &armsqlvirtualmachine.WsfcDomainProfile{ - ClusterBootstrapAccount: to.Ptr("testrpadmin"), - ClusterOperatorAccount: to.Ptr("testrp@testdomain.com"), - ClusterSubnetType: to.Ptr(armsqlvirtualmachine.ClusterSubnetTypeMultiSubnet), - DomainFqdn: to.Ptr("testdomain.com"), - OuPath: to.Ptr("OU=WSCluster,DC=testdomain,DC=com"), - SQLServiceAccount: to.Ptr("sqlservice@testdomain.com"), - StorageAccountPrimaryKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://storgact.blob.core.windows.net/"), - }, - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteSqlVirtualMachineGroup.json -func ExampleGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "testvmgroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/UpdateSqlVirtualMachineGroup.json -func ExampleGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "testrg", "testvmgroup", armsqlvirtualmachine.GroupUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json -func ExampleGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json -func ExampleGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go index c7402032b9a2..b3a5d8f51e04 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go @@ -11,6 +11,13 @@ package armsqlvirtualmachine import "time" +// AADAuthenticationSettings - Enable AAD authentication for SQL VM. +type AADAuthenticationSettings struct { + // The client Id of the Managed Identity to query Microsoft Graph API. An empty string must be used for the system assigned + // Managed Identity + ClientID *string `json:"clientId,omitempty"` +} + // AdditionalFeaturesServerConfigurations - Additional SQL Server feature settings. type AdditionalFeaturesServerConfigurations struct { // Enable or disable R services (SQL 2016 onwards). @@ -41,15 +48,15 @@ type AgReplica struct { SQLVirtualMachineInstanceID *string `json:"sqlVirtualMachineInstanceId,omitempty"` } -// AssessmentSettings - Configure assessment for databases in your SQL virtual machine. +// AssessmentSettings - Configure SQL best practices Assessment for databases in your SQL virtual machine. type AssessmentSettings struct { - // Enable or disable assessment feature on SQL virtual machine. + // Enable or disable SQL best practices Assessment feature on SQL virtual machine. Enable *bool `json:"enable,omitempty"` - // Run assessment immediately on SQL virtual machine. + // Run SQL best practices Assessment immediately on SQL virtual machine. RunImmediately *bool `json:"runImmediately,omitempty"` - // Schedule for Assessment. + // Schedule for SQL best practices Assessment. Schedule *Schedule `json:"schedule,omitempty"` } @@ -397,7 +404,7 @@ type PrivateIPAddress struct { // Properties - The SQL virtual machine properties. type Properties struct { - // Assessment Settings. + // SQL best practices Assessment Settings. AssessmentSettings *AssessmentSettings `json:"assessmentSettings,omitempty"` // Auto backup settings for SQL Server. @@ -447,6 +454,9 @@ type Properties struct { // READ-ONLY; Provisioning state to track the async operation status. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Troubleshooting status + TroubleshootingStatus *TroubleshootingStatus `json:"troubleshootingStatus,omitempty" azure:"ro"` } // ResourceIdentity - Azure Active Directory identity configuration for a resource. @@ -552,6 +562,24 @@ type SQLTempDbSettings struct { PersistFolderPath *string `json:"persistFolderPath,omitempty"` } +// SQLVMTroubleshooting - Details required for SQL VM troubleshooting +type SQLVMTroubleshooting struct { + // End time in UTC timezone. + EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"` + + // Troubleshooting properties + Properties *TroubleshootingAdditionalProperties `json:"properties,omitempty"` + + // Start time in UTC timezone. + StartTimeUTC *time.Time `json:"startTimeUtc,omitempty"` + + // SQL VM troubleshooting scenario. + TroubleshootingScenario *TroubleshootingScenario `json:"troubleshootingScenario,omitempty"` + + // READ-ONLY; Virtual machine resource id for response. + VirtualMachineResourceID *string `json:"virtualMachineResourceId,omitempty" azure:"ro"` +} + // SQLVirtualMachine - A SQL virtual machine. type SQLVirtualMachine struct { // REQUIRED; Resource location. @@ -667,6 +695,9 @@ type ServerConfigurationsManagementSettings struct { // Additional SQL feature settings. AdditionalFeaturesServerConfigurations *AdditionalFeaturesServerConfigurations `json:"additionalFeaturesServerConfigurations,omitempty"` + // Azure AD authentication Settings. + AzureAdAuthenticationSettings *AADAuthenticationSettings `json:"azureAdAuthenticationSettings,omitempty"` + // SQL connectivity type settings. SQLConnectivityUpdateSettings *SQLConnectivityUpdateSettings `json:"sqlConnectivityUpdateSettings,omitempty"` @@ -722,6 +753,46 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } +// TroubleshootClientBeginTroubleshootOptions contains the optional parameters for the TroubleshootClient.BeginTroubleshoot +// method. +type TroubleshootClientBeginTroubleshootOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TroubleshootingAdditionalProperties - SQL VM Troubleshooting additional properties. +type TroubleshootingAdditionalProperties struct { + // The unhealthy replica information + UnhealthyReplicaInfo *UnhealthyReplicaInfo `json:"unhealthyReplicaInfo,omitempty"` +} + +// TroubleshootingStatus - Status of last troubleshooting operation on this SQL VM +type TroubleshootingStatus struct { + // READ-ONLY; End time in UTC timezone. + EndTimeUTC *time.Time `json:"endTimeUtc,omitempty" azure:"ro"` + + // READ-ONLY; Last troubleshooting trigger time in UTC timezone + LastTriggerTimeUTC *time.Time `json:"lastTriggerTimeUtc,omitempty" azure:"ro"` + + // READ-ONLY; Troubleshooting properties + Properties *TroubleshootingAdditionalProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; Root cause of the issue + RootCause *string `json:"rootCause,omitempty" azure:"ro"` + + // READ-ONLY; Start time in UTC timezone. + StartTimeUTC *time.Time `json:"startTimeUtc,omitempty" azure:"ro"` + + // READ-ONLY; SQL VM troubleshooting scenario. + TroubleshootingScenario *TroubleshootingScenario `json:"troubleshootingScenario,omitempty" azure:"ro"` +} + +// UnhealthyReplicaInfo - SQL VM Troubleshoot UnhealthyReplica scenario information. +type UnhealthyReplicaInfo struct { + // The name of the availability group + AvailabilityGroupName *string `json:"availabilityGroupName,omitempty"` +} + // Update - An update to a SQL virtual machine. type Update struct { // Resource tags. diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go index fe970d8a5c14..5ef6cdc979c9 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go @@ -16,6 +16,33 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AADAuthenticationSettings. +func (a AADAuthenticationSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", a.ClientID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADAuthenticationSettings. +func (a *AADAuthenticationSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AdditionalFeaturesServerConfigurations. func (a AdditionalFeaturesServerConfigurations) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -856,6 +883,7 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "sqlVirtualMachineGroupResourceId", p.SQLVirtualMachineGroupResourceID) populate(objectMap, "serverConfigurationsManagementSettings", p.ServerConfigurationsManagementSettings) populate(objectMap, "storageConfigurationSettings", p.StorageConfigurationSettings) + populate(objectMap, "troubleshootingStatus", p.TroubleshootingStatus) populate(objectMap, "virtualMachineResourceId", p.VirtualMachineResourceID) populate(objectMap, "wsfcDomainCredentials", p.WsfcDomainCredentials) populate(objectMap, "wsfcStaticIp", p.WsfcStaticIP) @@ -913,6 +941,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "storageConfigurationSettings": err = unpopulate(val, "StorageConfigurationSettings", &p.StorageConfigurationSettings) delete(rawMsg, key) + case "troubleshootingStatus": + err = unpopulate(val, "TroubleshootingStatus", &p.TroubleshootingStatus) + delete(rawMsg, key) case "virtualMachineResourceId": err = unpopulate(val, "VirtualMachineResourceID", &p.VirtualMachineResourceID) delete(rawMsg, key) @@ -1180,6 +1211,49 @@ func (s *SQLTempDbSettings) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SQLVMTroubleshooting. +func (s SQLVMTroubleshooting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + populate(objectMap, "properties", s.Properties) + populateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populate(objectMap, "troubleshootingScenario", s.TroubleshootingScenario) + populate(objectMap, "virtualMachineResourceId", s.VirtualMachineResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVMTroubleshooting. +func (s *SQLVMTroubleshooting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "troubleshootingScenario": + err = unpopulate(val, "TroubleshootingScenario", &s.TroubleshootingScenario) + delete(rawMsg, key) + case "virtualMachineResourceId": + err = unpopulate(val, "VirtualMachineResourceID", &s.VirtualMachineResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SQLVirtualMachine. func (s SQLVirtualMachine) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1309,6 +1383,7 @@ func (s *Schedule) UnmarshalJSON(data []byte) error { func (s ServerConfigurationsManagementSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "additionalFeaturesServerConfigurations", s.AdditionalFeaturesServerConfigurations) + populate(objectMap, "azureAdAuthenticationSettings", s.AzureAdAuthenticationSettings) populate(objectMap, "sqlConnectivityUpdateSettings", s.SQLConnectivityUpdateSettings) populate(objectMap, "sqlInstanceSettings", s.SQLInstanceSettings) populate(objectMap, "sqlStorageUpdateSettings", s.SQLStorageUpdateSettings) @@ -1328,6 +1403,9 @@ func (s *ServerConfigurationsManagementSettings) UnmarshalJSON(data []byte) erro case "additionalFeaturesServerConfigurations": err = unpopulate(val, "AdditionalFeaturesServerConfigurations", &s.AdditionalFeaturesServerConfigurations) delete(rawMsg, key) + case "azureAdAuthenticationSettings": + err = unpopulate(val, "AzureAdAuthenticationSettings", &s.AzureAdAuthenticationSettings) + delete(rawMsg, key) case "sqlConnectivityUpdateSettings": err = unpopulate(val, "SQLConnectivityUpdateSettings", &s.SQLConnectivityUpdateSettings) delete(rawMsg, key) @@ -1442,6 +1520,107 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingAdditionalProperties. +func (t TroubleshootingAdditionalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "unhealthyReplicaInfo", t.UnhealthyReplicaInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingAdditionalProperties. +func (t *TroubleshootingAdditionalProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "unhealthyReplicaInfo": + err = unpopulate(val, "UnhealthyReplicaInfo", &t.UnhealthyReplicaInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingStatus. +func (t TroubleshootingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTimeUtc", t.EndTimeUTC) + populateTimeRFC3339(objectMap, "lastTriggerTimeUtc", t.LastTriggerTimeUTC) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "rootCause", t.RootCause) + populateTimeRFC3339(objectMap, "startTimeUtc", t.StartTimeUTC) + populate(objectMap, "troubleshootingScenario", t.TroubleshootingScenario) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingStatus. +func (t *TroubleshootingStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &t.EndTimeUTC) + delete(rawMsg, key) + case "lastTriggerTimeUtc": + err = unpopulateTimeRFC3339(val, "LastTriggerTimeUTC", &t.LastTriggerTimeUTC) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "rootCause": + err = unpopulate(val, "RootCause", &t.RootCause) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &t.StartTimeUTC) + delete(rawMsg, key) + case "troubleshootingScenario": + err = unpopulate(val, "TroubleshootingScenario", &t.TroubleshootingScenario) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UnhealthyReplicaInfo. +func (u UnhealthyReplicaInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityGroupName", u.AvailabilityGroupName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UnhealthyReplicaInfo. +func (u *UnhealthyReplicaInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &u.AvailabilityGroupName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Update. func (u Update) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go index 8796edc6a6ba..8a237a0efb54 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go @@ -50,7 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available SQL Virtual Machine Rest API operations. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go deleted file mode 100644 index dae17c934bac..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go +++ /dev/null @@ -1,41 +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. - -package armsqlvirtualmachine_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListOperation.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go index 51b028b96de8..625810fa5c93 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go @@ -108,3 +108,8 @@ type SQLVirtualMachinesClientStartAssessmentResponse struct { type SQLVirtualMachinesClientUpdateResponse struct { SQLVirtualMachine } + +// TroubleshootClientTroubleshootResponse contains the response from method TroubleshootClient.Troubleshoot. +type TroubleshootClientTroubleshootResponse struct { + SQLVMTroubleshooting +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go index 08306e25cb8c..4c6e8c470c34 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go @@ -57,7 +57,7 @@ func NewSQLVirtualMachinesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Creates or updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -70,7 +70,9 @@ func (client *SQLVirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -78,7 +80,7 @@ func (client *SQLVirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVirtualMachine, options *SQLVirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { @@ -114,7 +116,7 @@ func (client *SQLVirtualMachinesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,7 +124,7 @@ func (client *SQLVirtualMachinesClient) createOrUpdateCreateRequest(ctx context. // BeginDelete - Deletes a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -134,7 +136,9 @@ func (client *SQLVirtualMachinesClient) BeginDelete(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -142,7 +146,7 @@ func (client *SQLVirtualMachinesClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -178,14 +182,15 @@ func (client *SQLVirtualMachinesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -228,7 +233,7 @@ func (client *SQLVirtualMachinesClient) getCreateRequest(ctx context.Context, re if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -244,7 +249,7 @@ func (client *SQLVirtualMachinesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets all SQL virtual machines in a subscription. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // options - SQLVirtualMachinesClientListOptions contains the optional parameters for the SQLVirtualMachinesClient.List method. func (client *SQLVirtualMachinesClient) NewListPager(options *SQLVirtualMachinesClientListOptions) *runtime.Pager[SQLVirtualMachinesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SQLVirtualMachinesClientListResponse]{ @@ -286,7 +291,7 @@ func (client *SQLVirtualMachinesClient) listCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +307,7 @@ func (client *SQLVirtualMachinesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all SQL virtual machines in a resource group. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // options - SQLVirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.ListByResourceGroup @@ -351,7 +356,7 @@ func (client *SQLVirtualMachinesClient) listByResourceGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +372,7 @@ func (client *SQLVirtualMachinesClient) listByResourceGroupHandleResponse(resp * } // NewListBySQLVMGroupPager - Gets the list of sql virtual machines in a SQL virtual machine group. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineGroupName - Name of the SQL virtual machine group. @@ -421,7 +426,7 @@ func (client *SQLVirtualMachinesClient) listBySQLVMGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -436,9 +441,9 @@ func (client *SQLVirtualMachinesClient) listBySQLVMGroupHandleResponse(resp *htt return result, nil } -// BeginRedeploy - Uninstalls and reinstalls the SQL Iaas Extension. +// BeginRedeploy - Uninstalls and reinstalls the SQL IaaS Extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -450,15 +455,17 @@ func (client *SQLVirtualMachinesClient) BeginRedeploy(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientRedeployResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientRedeployResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientRedeployResponse](options.ResumeToken, client.pl, nil) } } -// Redeploy - Uninstalls and reinstalls the SQL Iaas Extension. +// Redeploy - Uninstalls and reinstalls the SQL IaaS Extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -494,14 +501,15 @@ func (client *SQLVirtualMachinesClient) redeployCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// BeginStartAssessment - Starts Assessment on SQL virtual machine. +// BeginStartAssessment - Starts SQL best practices Assessment on SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -513,15 +521,17 @@ func (client *SQLVirtualMachinesClient) BeginStartAssessment(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientStartAssessmentResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientStartAssessmentResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientStartAssessmentResponse](options.ResumeToken, client.pl, nil) } } -// StartAssessment - Starts Assessment on SQL virtual machine. +// StartAssessment - Starts SQL best practices Assessment on SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) startAssessment(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginStartAssessmentOptions) (*http.Response, error) { req, err := client.startAssessmentCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -557,14 +567,15 @@ func (client *SQLVirtualMachinesClient) startAssessmentCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginUpdate - Updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview // resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource // Manager API or the portal. // sqlVirtualMachineName - Name of the SQL virtual machine. @@ -577,7 +588,9 @@ func (client *SQLVirtualMachinesClient) BeginUpdate(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -585,7 +598,7 @@ func (client *SQLVirtualMachinesClient) BeginUpdate(ctx context.Context, resourc // Update - Updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) update(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters Update, options *SQLVirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { @@ -621,7 +634,7 @@ func (client *SQLVirtualMachinesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go deleted file mode 100644 index 42956b4e6c4a..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go +++ /dev/null @@ -1,520 +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. - -package armsqlvirtualmachine_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/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListBySQLVMGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySQLVMGroupPager("testrg", "testvm", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListSubscriptionSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginStartAssessment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartAssessment(ctx, "testrg", "testvm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/RedeploySqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginRedeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "testrg", "testvm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "testvm", &armsqlvirtualmachine.SQLVirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineAndJoinsItToASqlVirtualMachineGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - SQLVirtualMachineGroupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/testvmgroup"), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm2"), - WsfcDomainCredentials: &armsqlvirtualmachine.WsfcDomainCredentials{ - ClusterBootstrapAccountPassword: to.Ptr(""), - ClusterOperatorAccountPassword: to.Ptr(""), - SQLServiceAccountPassword: to.Ptr(""), - }, - WsfcStaticIP: to.Ptr("10.0.0.7"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForAutomatedBackUpSettingsWithWeeklyAndDaysOfTheWeekToRunTheBackUp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - AutoBackupSettings: &armsqlvirtualmachine.AutoBackupSettings{ - BackupScheduleType: to.Ptr(armsqlvirtualmachine.BackupScheduleTypeManual), - BackupSystemDbs: to.Ptr(true), - DaysOfWeek: []*armsqlvirtualmachine.AutoBackupDaysOfWeek{ - to.Ptr(armsqlvirtualmachine.AutoBackupDaysOfWeekMonday), - to.Ptr(armsqlvirtualmachine.AutoBackupDaysOfWeekFriday)}, - Enable: to.Ptr(true), - EnableEncryption: to.Ptr(true), - FullBackupFrequency: to.Ptr(armsqlvirtualmachine.FullBackupFrequencyTypeWeekly), - FullBackupStartTime: to.Ptr[int32](6), - FullBackupWindowHours: to.Ptr[int32](11), - LogBackupFrequency: to.Ptr[int32](10), - Password: to.Ptr(""), - RetentionPeriod: to.Ptr[int32](17), - StorageAccessKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://teststorage.blob.core.windows.net/"), - StorageContainerName: to.Ptr("testcontainer"), - }, - AutoPatchingSettings: &armsqlvirtualmachine.AutoPatchingSettings{ - DayOfWeek: to.Ptr(armsqlvirtualmachine.DayOfWeekSunday), - Enable: to.Ptr(true), - MaintenanceWindowDuration: to.Ptr[int32](60), - MaintenanceWindowStartingHour: to.Ptr[int32](2), - }, - KeyVaultCredentialSettings: &armsqlvirtualmachine.KeyVaultCredentialSettings{ - Enable: to.Ptr(false), - }, - ServerConfigurationsManagementSettings: &armsqlvirtualmachine.ServerConfigurationsManagementSettings{ - AdditionalFeaturesServerConfigurations: &armsqlvirtualmachine.AdditionalFeaturesServerConfigurations{ - IsRServicesEnabled: to.Ptr(false), - }, - SQLConnectivityUpdateSettings: &armsqlvirtualmachine.SQLConnectivityUpdateSettings{ - ConnectivityType: to.Ptr(armsqlvirtualmachine.ConnectivityTypePRIVATE), - Port: to.Ptr[int32](1433), - SQLAuthUpdatePassword: to.Ptr(""), - SQLAuthUpdateUserName: to.Ptr("sqllogin"), - }, - SQLStorageUpdateSettings: &armsqlvirtualmachine.SQLStorageUpdateSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), - DiskCount: to.Ptr[int32](1), - StartingDeviceID: to.Ptr[int32](2), - }, - SQLWorkloadTypeUpdateSettings: &armsqlvirtualmachine.SQLWorkloadTypeUpdateSettings{ - SQLWorkloadType: to.Ptr(armsqlvirtualmachine.SQLWorkloadTypeOLTP), - }, - }, - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLImageSKUEnterprise), - SQLManagement: to.Ptr(armsqlvirtualmachine.SQLManagementModeFull), - SQLServerLicenseType: to.Ptr(armsqlvirtualmachine.SQLServerLicenseTypePAYG), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForStorageConfigurationSettingsToExtendDataLogOrTempDbStoragePool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - StorageConfigurationSettings: &armsqlvirtualmachine.StorageConfigurationSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeEXTEND), - SQLDataSettings: &armsqlvirtualmachine.SQLStorageSettings{ - Luns: []*int32{ - to.Ptr[int32](2)}, - }, - }, - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForStorageConfigurationSettingsToNewDataLogAndTempDbStoragePool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - StorageConfigurationSettings: &armsqlvirtualmachine.StorageConfigurationSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), - SQLDataSettings: &armsqlvirtualmachine.SQLStorageSettings{ - DefaultFilePath: to.Ptr("F:\\folderpath\\"), - Luns: []*int32{ - to.Ptr[int32](0)}, - }, - SQLLogSettings: &armsqlvirtualmachine.SQLStorageSettings{ - DefaultFilePath: to.Ptr("G:\\folderpath\\"), - Luns: []*int32{ - to.Ptr[int32](1)}, - }, - SQLSystemDbOnDataDisk: to.Ptr(true), - SQLTempDbSettings: &armsqlvirtualmachine.SQLTempDbSettings{ - DataFileCount: to.Ptr[int32](8), - DataFileSize: to.Ptr[int32](256), - DataGrowth: to.Ptr[int32](512), - DefaultFilePath: to.Ptr("D:\\TEMP"), - LogFileSize: to.Ptr[int32](256), - LogGrowth: to.Ptr[int32](512), - }, - StorageWorkloadType: to.Ptr(armsqlvirtualmachine.StorageWorkloadTypeOLTP), - }, - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineWithMaxParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - AssessmentSettings: &armsqlvirtualmachine.AssessmentSettings{ - Enable: to.Ptr(true), - RunImmediately: to.Ptr(true), - Schedule: &armsqlvirtualmachine.Schedule{ - DayOfWeek: to.Ptr(armsqlvirtualmachine.AssessmentDayOfWeekSunday), - Enable: to.Ptr(true), - StartTime: to.Ptr("23:17"), - WeeklyInterval: to.Ptr[int32](1), - }, - }, - AutoBackupSettings: &armsqlvirtualmachine.AutoBackupSettings{ - BackupScheduleType: to.Ptr(armsqlvirtualmachine.BackupScheduleTypeManual), - BackupSystemDbs: to.Ptr(true), - Enable: to.Ptr(true), - EnableEncryption: to.Ptr(true), - FullBackupFrequency: to.Ptr(armsqlvirtualmachine.FullBackupFrequencyTypeDaily), - FullBackupStartTime: to.Ptr[int32](6), - FullBackupWindowHours: to.Ptr[int32](11), - LogBackupFrequency: to.Ptr[int32](10), - Password: to.Ptr(""), - RetentionPeriod: to.Ptr[int32](17), - StorageAccessKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://teststorage.blob.core.windows.net/"), - StorageContainerName: to.Ptr("testcontainer"), - }, - AutoPatchingSettings: &armsqlvirtualmachine.AutoPatchingSettings{ - DayOfWeek: to.Ptr(armsqlvirtualmachine.DayOfWeekSunday), - Enable: to.Ptr(true), - MaintenanceWindowDuration: to.Ptr[int32](60), - MaintenanceWindowStartingHour: to.Ptr[int32](2), - }, - EnableAutomaticUpgrade: to.Ptr(true), - KeyVaultCredentialSettings: &armsqlvirtualmachine.KeyVaultCredentialSettings{ - Enable: to.Ptr(false), - }, - LeastPrivilegeMode: to.Ptr(armsqlvirtualmachine.LeastPrivilegeModeEnabled), - ServerConfigurationsManagementSettings: &armsqlvirtualmachine.ServerConfigurationsManagementSettings{ - AdditionalFeaturesServerConfigurations: &armsqlvirtualmachine.AdditionalFeaturesServerConfigurations{ - IsRServicesEnabled: to.Ptr(false), - }, - SQLConnectivityUpdateSettings: &armsqlvirtualmachine.SQLConnectivityUpdateSettings{ - ConnectivityType: to.Ptr(armsqlvirtualmachine.ConnectivityTypePRIVATE), - Port: to.Ptr[int32](1433), - SQLAuthUpdatePassword: to.Ptr(""), - SQLAuthUpdateUserName: to.Ptr("sqllogin"), - }, - SQLInstanceSettings: &armsqlvirtualmachine.SQLInstanceSettings{ - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - IsIfiEnabled: to.Ptr(true), - IsLpimEnabled: to.Ptr(true), - IsOptimizeForAdHocWorkloadsEnabled: to.Ptr(true), - MaxDop: to.Ptr[int32](8), - MaxServerMemoryMB: to.Ptr[int32](128), - MinServerMemoryMB: to.Ptr[int32](0), - }, - SQLStorageUpdateSettings: &armsqlvirtualmachine.SQLStorageUpdateSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), - DiskCount: to.Ptr[int32](1), - StartingDeviceID: to.Ptr[int32](2), - }, - SQLWorkloadTypeUpdateSettings: &armsqlvirtualmachine.SQLWorkloadTypeUpdateSettings{ - SQLWorkloadType: to.Ptr(armsqlvirtualmachine.SQLWorkloadTypeOLTP), - }, - }, - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLImageSKUEnterprise), - SQLManagement: to.Ptr(armsqlvirtualmachine.SQLManagementModeFull), - SQLServerLicenseType: to.Ptr(armsqlvirtualmachine.SQLServerLicenseTypePAYG), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineWithMinParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "testvm1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/UpdateSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.Update{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go new file mode 100644 index 000000000000..c2c39589515b --- /dev/null +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go @@ -0,0 +1,123 @@ +//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 armsqlvirtualmachine + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TroubleshootClient contains the methods for the SQLVirtualMachineTroubleshoot group. +// Don't use this type directly, use NewTroubleshootClient() instead. +type TroubleshootClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewTroubleshootClient creates a new instance of TroubleshootClient with the specified values. +// subscriptionID - Subscription ID that identifies an Azure subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewTroubleshootClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TroubleshootClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &TroubleshootClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginTroubleshoot - Starts SQL virtual machine troubleshooting. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01-preview +// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// sqlVirtualMachineName - Name of the SQL virtual machine. +// parameters - The SQL virtual machine troubleshooting entity. +// options - TroubleshootClientBeginTroubleshootOptions contains the optional parameters for the TroubleshootClient.BeginTroubleshoot +// method. +func (client *TroubleshootClient) BeginTroubleshoot(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVMTroubleshooting, options *TroubleshootClientBeginTroubleshootOptions) (*runtime.Poller[TroubleshootClientTroubleshootResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.troubleshoot(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[TroubleshootClientTroubleshootResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[TroubleshootClientTroubleshootResponse](options.ResumeToken, client.pl, nil) + } +} + +// Troubleshoot - Starts SQL virtual machine troubleshooting. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-08-01-preview +func (client *TroubleshootClient) troubleshoot(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVMTroubleshooting, options *TroubleshootClientBeginTroubleshootOptions) (*http.Response, error) { + req, err := client.troubleshootCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// troubleshootCreateRequest creates the Troubleshoot request. +func (client *TroubleshootClient) troubleshootCreateRequest(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVMTroubleshooting, options *TroubleshootClientBeginTroubleshootOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/troubleshoot" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlVirtualMachineName == "" { + return nil, errors.New("parameter sqlVirtualMachineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlVirtualMachineName}", url.PathEscape(sqlVirtualMachineName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +}