From 68c1d0ec6a833898b5f50fbb2c24baa76f5ffcb3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 21 Sep 2023 01:37:49 +0000 Subject: [PATCH] CodeGen from PR 25875 in Azure/azure-rest-api-specs Merge e0966eb64ceba97a08ff30df91c04c0bffb65f60 into 68d03f91ea7c30e1ab28fb9d35c13f81bc85b724 --- .../armmysqlflexibleservers/CHANGELOG.md | 56 + .../mysql/armmysqlflexibleservers/autorest.md | 7 +- .../azureadadministrators_client.go | 79 +- ...ureadadministrators_client_example_test.go | 156 --- .../backupandexport_client.go | 50 +- .../backupandexport_client_example_test.go | 96 -- .../armmysqlflexibleservers/backups_client.go | 48 +- .../backups_client_example_test.go | 216 --- .../checknameavailability_client.go | 28 +- ...ecknameavailability_client_example_test.go | 47 - ...knameavailabilitywithoutlocation_client.go | 29 +- ...litywithoutlocation_client_example_test.go | 47 - .../checkvirtualnetworksubnetusage_client.go | 28 +- ...lnetworksubnetusage_client_example_test.go | 54 - .../armmysqlflexibleservers/client_factory.go | 60 +- .../configurations_client.go | 111 +- .../configurations_client_example_test.go | 376 ----- .../armmysqlflexibleservers/constants.go | 107 +- .../databases_client.go | 79 +- .../databases_client_example_test.go | 153 -- .../firewallrules_client.go | 79 +- .../firewallrules_client_example_test.go | 153 -- .../getprivatednszonesuffix_client.go | 18 +- ...rivatednszonesuffix_client_example_test.go | 41 - .../mysql/armmysqlflexibleservers/go.mod | 20 +- .../mysql/armmysqlflexibleservers/go.sum | 38 +- .../armmysqlflexibleservers/interfaces.go | 18 + .../locationbasedcapabilities_client.go | 12 +- ...onbasedcapabilities_client_example_test.go | 1138 --------------- .../locationbasedcapabilityset_client.go | 164 +++ .../logfiles_client.go | 12 +- .../logfiles_client_example_test.go | 58 - .../mysql/armmysqlflexibleservers/models.go | 575 ++++---- .../armmysqlflexibleservers/models_serde.go | 651 ++++++++- .../operationresults_client.go | 101 ++ .../operations_client.go | 7 +- .../operations_client_example_test.go | 223 --- .../mysql/armmysqlflexibleservers/options.go | 282 ++++ .../polymorphic_helpers.go | 8 +- .../replicas_client.go | 12 +- .../replicas_client_example_test.go | 128 -- .../armmysqlflexibleservers/response_types.go | 59 +- .../armmysqlflexibleservers/servers_client.go | 233 ++-- .../servers_client_example_test.go | 1238 ----------------- .../serversmigration_client.go | 111 ++ .../armmysqlflexibleservers/time_rfc3339.go | 3 +- 46 files changed, 2241 insertions(+), 4968 deletions(-) delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/interfaces.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilityset_client.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/operationresults_client.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/serversmigration_client.go diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md index 78a1919f0b1d..64dbedf8c1f6 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md @@ -1,5 +1,61 @@ # Release History +## 2.0.0-beta.2 (2023-09-21) +### Breaking Changes + +- Type of `BackupAndExportResponse.Error` has been changed from `*ErrorResponse` to `*ErrorDetail` +- Type of `Server.Identity` has been changed from `*Identity` to `*MySQLServerIdentity` +- Type of `Server.SKU` has been changed from `*SKU` to `*MySQLServerSKU` +- Type of `ServerForUpdate.Identity` has been changed from `*Identity` to `*MySQLServerIdentity` +- Type of `ServerForUpdate.SKU` has been changed from `*SKU` to `*MySQLServerSKU` +- `BackupFormatNone` from enum `BackupFormat` has been removed +- Enum `SKUTier` has been removed +- Struct `Identity` has been removed +- Struct `SKU` has been removed +- Field `AdditionalInfo`, `Code`, `Details`, `Message`, `Target` of struct `ErrorResponse` has been removed + +### Features Added + +- New value `BackupFormatRaw` added to enum type `BackupFormat` +- New enum type `ImportSourceStorageType` with values `ImportSourceStorageTypeAzureBlob` +- New enum type `PrivateEndpointConnectionProvisioningState` with values `PrivateEndpointConnectionProvisioningStateCreating`, `PrivateEndpointConnectionProvisioningStateDeleting`, `PrivateEndpointConnectionProvisioningStateFailed`, `PrivateEndpointConnectionProvisioningStateSucceeded` +- New enum type `PrivateEndpointServiceConnectionStatus` with values `PrivateEndpointServiceConnectionStatusApproved`, `PrivateEndpointServiceConnectionStatusPending`, `PrivateEndpointServiceConnectionStatusRejected` +- New enum type `ServerSKUTier` with values `ServerSKUTierBurstable`, `ServerSKUTierGeneralPurpose`, `ServerSKUTierMemoryOptimized` +- New function `*ClientFactory.NewLocationBasedCapabilitySetClient() *LocationBasedCapabilitySetClient` +- New function `*ClientFactory.NewOperationResultsClient() *OperationResultsClient` +- New function `*ClientFactory.NewServersMigrationClient() *ServersMigrationClient` +- New function `NewLocationBasedCapabilitySetClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LocationBasedCapabilitySetClient, error)` +- New function `*LocationBasedCapabilitySetClient.Get(context.Context, string, string, *LocationBasedCapabilitySetClientGetOptions) (LocationBasedCapabilitySetClientGetResponse, error)` +- New function `*LocationBasedCapabilitySetClient.NewListPager(string, *LocationBasedCapabilitySetClientListOptions) *runtime.Pager[LocationBasedCapabilitySetClientListResponse]` +- New function `NewOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationResultsClient, error)` +- New function `*OperationResultsClient.Get(context.Context, string, string, *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` +- New function `NewServersMigrationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ServersMigrationClient, error)` +- New function `*ServersMigrationClient.BeginCutoverMigration(context.Context, string, string, *ServersMigrationClientBeginCutoverMigrationOptions) (*runtime.Poller[ServersMigrationClientCutoverMigrationResponse], error)` +- New struct `Capability` +- New struct `CapabilityPropertiesV2` +- New struct `CapabilitySetsList` +- New struct `ErrorDetail` +- New struct `ImportSourceProperties` +- New struct `MySQLServerIdentity` +- New struct `MySQLServerSKU` +- New struct `OperationStatusExtendedResult` +- New struct `OperationStatusResult` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateLinkServiceConnectionState` +- New struct `SKUCapabilityV2` +- New struct `ServerEditionCapabilityV2` +- New struct `ServerVersionCapabilityV2` +- New field `SystemData` in struct `BackupAndExportResponse` +- New field `Error` in struct `ErrorResponse` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `ImportSourceProperties`, `PrivateEndpointConnections` in struct `ServerProperties` +- New field `Network` in struct `ServerPropertiesForUpdate` +- New field `SystemData` in struct `TrackedResource` + + ## 2.0.0-beta.1 (2023-05-26) ### Breaking Changes diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md index 3f8b67318523..31b653435338 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md @@ -5,10 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mysql/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mysql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0-beta.1 +module-version: 2.0.0-beta.2 package-flexibleservers: true -tag: package-flexibleserver-2022-09-30-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go index 3bf0e8ec7506..d7927ec1a3d1 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type AzureADAdministratorsClient struct { } // NewAzureADAdministratorsClient creates a new instance of AzureADAdministratorsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAzureADAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureADAdministratorsClient, error) { @@ -47,7 +46,7 @@ func NewAzureADAdministratorsClient(subscriptionID string, credential azcore.Tok // BeginCreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - administratorName - The name of the Azure AD Administrator. @@ -60,7 +59,8 @@ func (client *AzureADAdministratorsClient) BeginCreateOrUpdate(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[AzureADAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[AzureADAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[AzureADAdministratorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,28 +69,27 @@ func (client *AzureADAdministratorsClient) BeginCreateOrUpdate(ctx context.Conte // CreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *AzureADAdministratorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, administratorName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *AzureADAdministratorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -109,16 +108,19 @@ func (client *AzureADAdministratorsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes an Azure AD Administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - administratorName - The name of the Azure AD Administrator. @@ -130,9 +132,10 @@ func (client *AzureADAdministratorsClient) BeginDelete(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureADAdministratorsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureADAdministratorsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AzureADAdministratorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,28 +144,27 @@ func (client *AzureADAdministratorsClient) BeginDelete(ctx context.Context, reso // Delete - Deletes an Azure AD Administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *AzureADAdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *AzureADAdministratorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -181,7 +183,7 @@ func (client *AzureADAdministratorsClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,33 +192,33 @@ func (client *AzureADAdministratorsClient) deleteCreateRequest(ctx context.Conte // Get - Gets information about an azure ad administrator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - administratorName - The name of the Azure AD Administrator. // - options - AzureADAdministratorsClientGetOptions contains the optional parameters for the AzureADAdministratorsClient.Get // method. func (client *AzureADAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientGetOptions) (AzureADAdministratorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) if err != nil { return AzureADAdministratorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AzureADAdministratorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AzureADAdministratorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AzureADAdministratorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *AzureADAdministratorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators/{administratorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -235,7 +237,7 @@ func (client *AzureADAdministratorsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +254,7 @@ func (client *AzureADAdministratorsClient) getHandleResponse(resp *http.Response // NewListByServerPager - List all the AAD administrators in a given server. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - AzureADAdministratorsClientListByServerOptions contains the optional parameters for the AzureADAdministratorsClient.NewListByServerPager @@ -288,9 +290,6 @@ func (client *AzureADAdministratorsClient) NewListByServerPager(resourceGroupNam // listByServerCreateRequest creates the ListByServer request. func (client *AzureADAdministratorsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *AzureADAdministratorsClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/administrators" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -305,7 +304,7 @@ func (client *AzureADAdministratorsClient) listByServerCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go deleted file mode 100644 index 1d4259771715..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client_example_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorCreate.json -func ExampleAzureADAdministratorsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureADAdministratorsClient().BeginCreateOrUpdate(ctx, "testrg", "mysqltestsvc4", armmysqlflexibleservers.AdministratorNameActiveDirectory, armmysqlflexibleservers.AzureADAdministrator{ - Properties: &armmysqlflexibleservers.AdministratorProperties{ - AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), - IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), - Login: to.Ptr("bob@contoso.com"), - Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureADAdministrator = armmysqlflexibleservers.AzureADAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc4/administrators/ActiveDirectory"), - // Properties: &armmysqlflexibleservers.AdministratorProperties{ - // AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), - // IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorDelete.json -func ExampleAzureADAdministratorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAzureADAdministratorsClient().BeginDelete(ctx, "testrg", "mysqltestsvc4", armmysqlflexibleservers.AdministratorNameActiveDirectory, 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorGet.json -func ExampleAzureADAdministratorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureADAdministratorsClient().Get(ctx, "testrg", "mysqltestsvc4", armmysqlflexibleservers.AdministratorNameActiveDirectory, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureADAdministrator = armmysqlflexibleservers.AzureADAdministrator{ - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc4/administrators/ActiveDirectory"), - // Properties: &armmysqlflexibleservers.AdministratorProperties{ - // AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), - // IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/AAD/preview/2021-12-01-preview/examples/AzureADAdministratorsListByServer.json -func ExampleAzureADAdministratorsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureADAdministratorsClient().NewListByServerPager("testrg", "mysqltestsvc4", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AdministratorListResult = armmysqlflexibleservers.AdministratorListResult{ - // Value: []*armmysqlflexibleservers.AzureADAdministrator{ - // { - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc4/administrators/ActiveDirectory"), - // Properties: &armmysqlflexibleservers.AdministratorProperties{ - // AdministratorType: to.Ptr(armmysqlflexibleservers.AdministratorTypeActiveDirectory), - // IdentityResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/test-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-umi"), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c12b7025-bfe2-46c1-b463-993b5e4cd467"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go index f04049aefa06..7976ec227fb7 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type BackupAndExportClient struct { } // NewBackupAndExportClient creates a new instance of BackupAndExportClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewBackupAndExportClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupAndExportClient, error) { @@ -47,7 +46,7 @@ func NewBackupAndExportClient(subscriptionID string, credential azcore.TokenCred // BeginCreate - Exports the backup of the given server by creating a backup if not existing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for creating and exporting backup of the given server. @@ -59,9 +58,10 @@ func (client *BackupAndExportClient) BeginCreate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupAndExportClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupAndExportClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupAndExportClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,28 +70,27 @@ func (client *BackupAndExportClient) BeginCreate(ctx context.Context, resourceGr // Create - Exports the backup of the given server by creating a backup if not existing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *BackupAndExportClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. func (client *BackupAndExportClient) createCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backupAndExport" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -106,41 +105,44 @@ func (client *BackupAndExportClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // ValidateBackup - Validates if backup can be performed for given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - BackupAndExportClientValidateBackupOptions contains the optional parameters for the BackupAndExportClient.ValidateBackup // method. func (client *BackupAndExportClient) ValidateBackup(ctx context.Context, resourceGroupName string, serverName string, options *BackupAndExportClientValidateBackupOptions) (BackupAndExportClientValidateBackupResponse, error) { + var err error req, err := client.validateBackupCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return BackupAndExportClientValidateBackupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupAndExportClientValidateBackupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupAndExportClientValidateBackupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupAndExportClientValidateBackupResponse{}, err } - return client.validateBackupHandleResponse(resp) + resp, err := client.validateBackupHandleResponse(httpResp) + return resp, err } // validateBackupCreateRequest creates the ValidateBackup request. func (client *BackupAndExportClient) validateBackupCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *BackupAndExportClientValidateBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/validateBackup" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -155,7 +157,7 @@ func (client *BackupAndExportClient) validateBackupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go deleted file mode 100644 index e5b828900e63..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupAndExport.json -func ExampleBackupAndExportClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupAndExportClient().BeginCreate(ctx, "TestGroup", "mysqltestserver", armmysqlflexibleservers.BackupAndExportRequest{ - BackupSettings: &armmysqlflexibleservers.BackupSettings{ - BackupName: to.Ptr("customer-backup-name"), - }, - TargetDetails: &armmysqlflexibleservers.FullBackupStoreDetails{ - ObjectType: to.Ptr("FullBackupStoreDetails"), - SasURIList: []*string{ - to.Ptr("sasuri1"), - to.Ptr("sasuri2")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupAndExportResponse = armmysqlflexibleservers.BackupAndExportResponse{ - // Name: to.Ptr("custom-backup101"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backupAndExport"), - // ID: to.Ptr("/subscriptions/cb9d743d-2140-4e73-b871-cd31abab1d2f/resourceGroups/mrgsumitkumatest1/providers/Microsoft.DBforMySQL/flexibleServers/servermysql-01/backupAndExport/custom-backup101"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-29T07:37:05.6406008Z"); return t}()), - // Error: &armmysqlflexibleservers.ErrorResponse{ - // Code: to.Ptr("AggregateException"), - // Message: to.Ptr("System.AggregateException: One or more errors occurred. (Mismatch in count of number of Commited-Blocks from service.)"), - // }, - // PercentComplete: to.Ptr[float64](100), - // Properties: &armmysqlflexibleservers.BackupAndExportResponseProperties{ - // BackupMetadata: to.Ptr("{\"key1\":\"value1\",\"key2\":\"value2\"}"), - // DataTransferredInBytes: to.Ptr[int64](1024), - // DatasourceSizeInBytes: to.Ptr[int64](1024), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-29T07:34:02.328326Z"); return t}()), - // Status: to.Ptr(armmysqlflexibleservers.OperationStatusFailed), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/ValidateBackup.json -func ExampleBackupAndExportClient_ValidateBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupAndExportClient().ValidateBackup(ctx, "TestGroup", "mysqltestserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ValidateBackupResponse = armmysqlflexibleservers.ValidateBackupResponse{ - // Properties: &armmysqlflexibleservers.ValidateBackupResponseProperties{ - // NumberOfContainers: to.Ptr[int32](1), - // }, - // } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go index 045ac801865f..36289ccf3f5a 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type BackupsClient struct { } // NewBackupsClient creates a new instance of BackupsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsClient, error) { @@ -47,32 +46,32 @@ func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, // Get - List all the backups for a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - backupName - The name of the backup. // - options - BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. func (client *BackupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientGetOptions) (BackupsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, backupName, options) if err != nil { return BackupsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backups/{backupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -91,7 +90,7 @@ func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +107,7 @@ func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsClie // NewListByServerPager - List all the backups for a given server. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - BackupsClientListByServerOptions contains the optional parameters for the BackupsClient.NewListByServerPager @@ -144,9 +143,6 @@ func (client *BackupsClient) NewListByServerPager(resourceGroupName string, serv // listByServerCreateRequest creates the ListByServer request. func (client *BackupsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *BackupsClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backups" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -161,7 +157,7 @@ func (client *BackupsClient) listByServerCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,32 +175,32 @@ func (client *BackupsClient) listByServerHandleResponse(resp *http.Response) (Ba // Put - Create backup for a given server with specified backup name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - backupName - The name of the backup. // - options - BackupsClientPutOptions contains the optional parameters for the BackupsClient.Put method. func (client *BackupsClient) Put(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientPutOptions) (BackupsClientPutResponse, error) { + var err error req, err := client.putCreateRequest(ctx, resourceGroupName, serverName, backupName, options) if err != nil { return BackupsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. func (client *BackupsClient) putCreateRequest(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientPutOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/backups/{backupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -223,7 +219,7 @@ func (client *BackupsClient) putCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go deleted file mode 100644 index e20e46f78d18..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go +++ /dev/null @@ -1,216 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupPut.json -func ExampleBackupsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupsClient().Put(ctx, "TestGroup", "mysqltestserver", "mybackup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerBackup = armmysqlflexibleservers.ServerBackup{ - // Name: to.Ptr("customer_20220507t073755_bb392c3b-17c6-4d3f-9742-8479ca87b3ac_mybackup"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/customer_20220507t073755_bb392c3b-17c6-4d3f-9742-8479ca87b3ac_mybackup"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-07T07:38:01.1498043+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupGet.json -func ExampleBackupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupsClient().Get(ctx, "TestGroup", "mysqltestserver", "daily_20210615T160516", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerBackup = armmysqlflexibleservers.ServerBackup{ - // Name: to.Ptr("daily_20210615T160516"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210615T160516"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T16:05:19.902522+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Backups/preview/2022-09-30-preview/examples/BackupsListByServer.json -func ExampleBackupsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupsClient().NewListByServerPager("TestGroup", "mysqltestserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerBackupListResult = armmysqlflexibleservers.ServerBackupListResult{ - // Value: []*armmysqlflexibleservers.ServerBackup{ - // { - // Name: to.Ptr("daily_20210615T160516"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210615T160516"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T16:05:19.902522+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210616T160520"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210616T160520"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T16:05:23.9243453+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210617T160525"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210617T160525"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T16:05:28.1247488+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210618T160529"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210618T160529"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-18T16:05:32.2736701+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210619T160533"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210619T160533"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-19T16:05:36.8603354+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210620T160538"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210620T160538"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-20T16:05:41.9200138+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210621T160543"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210621T160543"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-21T16:05:48.8528447+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210622T160803"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210622T160803"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-22T16:08:06.3121688+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210622T210807"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210622T210807"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-22T21:08:10.5057354+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210623T212413"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210623T212413"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-23T21:24:16.9401531+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }, - // { - // Name: to.Ptr("daily_20210624T061328"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/backups"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/backups/daily_20210624T061328"), - // Properties: &armmysqlflexibleservers.ServerBackupProperties{ - // BackupType: to.Ptr("FULL"), - // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T06:13:31.4962137+00:00"); return t}()), - // Source: to.Ptr("Automatic"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go index 6b5adcb75442..12424ff156f8 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type CheckNameAvailabilityClient struct { } // NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { @@ -47,32 +46,32 @@ func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.Tok // Execute - Check the availability of name for server // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - locationName - The name of the location. // - nameAvailabilityRequest - The required parameters for checking if server name is available. // - options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute // method. func (client *CheckNameAvailabilityClient) Execute(ctx context.Context, locationName string, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (CheckNameAvailabilityClientExecuteResponse, error) { + var err error req, err := client.executeCreateRequest(ctx, locationName, nameAvailabilityRequest, options) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CheckNameAvailabilityClientExecuteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityClientExecuteResponse{}, err } - return client.executeHandleResponse(resp) + resp, err := client.executeHandleResponse(httpResp) + return resp, err } // executeCreateRequest creates the Execute request. func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Context, locationName string, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkNameAvailability" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if locationName == "" { return nil, errors.New("parameter locationName cannot be empty") @@ -83,10 +82,13 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) + if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { + return nil, err + } + return req, nil } // executeHandleResponse handles the Execute response. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go deleted file mode 100644 index daa51d2550f1..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckNameAvailability.json -func ExampleCheckNameAvailabilityClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckNameAvailabilityClient().Execute(ctx, "SouthEastAsia", armmysqlflexibleservers.NameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailability = armmysqlflexibleservers.NameAvailability{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go index 3a421accdc5d..a28d2875f9c1 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go @@ -3,15 +3,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers import ( "context" - "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -29,7 +27,7 @@ type CheckNameAvailabilityWithoutLocationClient struct { } // NewCheckNameAvailabilityWithoutLocationClient creates a new instance of CheckNameAvailabilityWithoutLocationClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCheckNameAvailabilityWithoutLocationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityWithoutLocationClient, error) { @@ -47,41 +45,44 @@ func NewCheckNameAvailabilityWithoutLocationClient(subscriptionID string, creden // Execute - Check the availability of name for server // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - nameAvailabilityRequest - The required parameters for checking if server name is available. // - options - CheckNameAvailabilityWithoutLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithoutLocationClient.Execute // method. func (client *CheckNameAvailabilityWithoutLocationClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityWithoutLocationClientExecuteOptions) (CheckNameAvailabilityWithoutLocationClientExecuteResponse, error) { + var err error req, err := client.executeCreateRequest(ctx, nameAvailabilityRequest, options) if err != nil { return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err } - return client.executeHandleResponse(resp) + resp, err := client.executeHandleResponse(httpResp) + return resp, err } // executeCreateRequest creates the Execute request. func (client *CheckNameAvailabilityWithoutLocationClient) executeCreateRequest(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityWithoutLocationClientExecuteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability" - 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.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) + if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { + return nil, err + } + return req, nil } // executeHandleResponse handles the Execute response. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go deleted file mode 100644 index d90d25bc94e1..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckNameAvailability.json -func ExampleCheckNameAvailabilityWithoutLocationClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckNameAvailabilityWithoutLocationClient().Execute(ctx, armmysqlflexibleservers.NameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailability = armmysqlflexibleservers.NameAvailability{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go index 31ea182af63e..85d7fcdbab01 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type CheckVirtualNetworkSubnetUsageClient struct { } // NewCheckVirtualNetworkSubnetUsageClient creates a new instance of CheckVirtualNetworkSubnetUsageClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCheckVirtualNetworkSubnetUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckVirtualNetworkSubnetUsageClient, error) { @@ -47,32 +46,32 @@ func NewCheckVirtualNetworkSubnetUsageClient(subscriptionID string, credential a // Execute - Get virtual network subnet usage for a given vNet resource id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - locationName - The name of the location. // - parameters - The required parameters for creating or updating a server. // - options - CheckVirtualNetworkSubnetUsageClientExecuteOptions contains the optional parameters for the CheckVirtualNetworkSubnetUsageClient.Execute // method. func (client *CheckVirtualNetworkSubnetUsageClient) Execute(ctx context.Context, locationName string, parameters VirtualNetworkSubnetUsageParameter, options *CheckVirtualNetworkSubnetUsageClientExecuteOptions) (CheckVirtualNetworkSubnetUsageClientExecuteResponse, error) { + var err error req, err := client.executeCreateRequest(ctx, locationName, parameters, options) if err != nil { return CheckVirtualNetworkSubnetUsageClientExecuteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CheckVirtualNetworkSubnetUsageClientExecuteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CheckVirtualNetworkSubnetUsageClientExecuteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckVirtualNetworkSubnetUsageClientExecuteResponse{}, err } - return client.executeHandleResponse(resp) + resp, err := client.executeHandleResponse(httpResp) + return resp, err } // executeCreateRequest creates the Execute request. func (client *CheckVirtualNetworkSubnetUsageClient) executeCreateRequest(ctx context.Context, locationName string, parameters VirtualNetworkSubnetUsageParameter, options *CheckVirtualNetworkSubnetUsageClientExecuteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/checkVirtualNetworkSubnetUsage" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if locationName == "" { return nil, errors.New("parameter locationName cannot be empty") @@ -83,10 +82,13 @@ func (client *CheckVirtualNetworkSubnetUsageClient) executeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // executeHandleResponse handles the Execute response. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go deleted file mode 100644 index 6cf3a994aea2..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CheckVirtualNetworkSubnetUsage.json -func ExampleCheckVirtualNetworkSubnetUsageClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckVirtualNetworkSubnetUsageClient().Execute(ctx, "WestUS", armmysqlflexibleservers.VirtualNetworkSubnetUsageParameter{ - VirtualNetworkResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkSubnetUsageResult = armmysqlflexibleservers.VirtualNetworkSubnetUsageResult{ - // DelegatedSubnetsUsage: []*armmysqlflexibleservers.DelegatedSubnetUsage{ - // { - // SubnetName: to.Ptr("test-subnet-1"), - // Usage: to.Ptr[int64](2), - // }, - // { - // SubnetName: to.Ptr("test-subnet-2"), - // Usage: to.Ptr[int64](3), - // }}, - // Location: to.Ptr("WestUS"), - // SubscriptionID: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"), - // } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go index 820ba49f823c..2842361e9ce6 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -24,7 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -43,13 +42,28 @@ func (c *ClientFactory) NewAzureADAdministratorsClient() *AzureADAdministratorsC return subClient } +func (c *ClientFactory) NewBackupAndExportClient() *BackupAndExportClient { + subClient, _ := NewBackupAndExportClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewBackupsClient() *BackupsClient { subClient, _ := NewBackupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupAndExportClient() *BackupAndExportClient { - subClient, _ := NewBackupAndExportClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCheckNameAvailabilityWithoutLocationClient() *CheckNameAvailabilityWithoutLocationClient { + subClient, _ := NewCheckNameAvailabilityWithoutLocationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCheckVirtualNetworkSubnetUsageClient() *CheckVirtualNetworkSubnetUsageClient { + subClient, _ := NewCheckVirtualNetworkSubnetUsageClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -68,47 +82,47 @@ func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { return subClient } -func (c *ClientFactory) NewServersClient() *ServersClient { - subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewGetPrivateDNSZoneSuffixClient() *GetPrivateDNSZoneSuffixClient { + subClient, _ := NewGetPrivateDNSZoneSuffixClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationBasedCapabilitiesClient() *LocationBasedCapabilitiesClient { + subClient, _ := NewLocationBasedCapabilitiesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { - subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationBasedCapabilitySetClient() *LocationBasedCapabilitySetClient { + subClient, _ := NewLocationBasedCapabilitySetClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLocationBasedCapabilitiesClient() *LocationBasedCapabilitiesClient { - subClient, _ := NewLocationBasedCapabilitiesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { + subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCheckVirtualNetworkSubnetUsageClient() *CheckVirtualNetworkSubnetUsageClient { - subClient, _ := NewCheckVirtualNetworkSubnetUsageClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationResultsClient() *OperationResultsClient { + subClient, _ := NewOperationResultsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { - subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewCheckNameAvailabilityWithoutLocationClient() *CheckNameAvailabilityWithoutLocationClient { - subClient, _ := NewCheckNameAvailabilityWithoutLocationClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewReplicasClient() *ReplicasClient { + subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewGetPrivateDNSZoneSuffixClient() *GetPrivateDNSZoneSuffixClient { - subClient, _ := NewGetPrivateDNSZoneSuffixClient(c.credential, c.options) +func (c *ClientFactory) NewServersClient() *ServersClient { + subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewServersMigrationClient() *ServersMigrationClient { + subClient, _ := NewServersMigrationClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go index 62eea28b0379..5fdd5a0ef50f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -30,7 +29,7 @@ type ConfigurationsClient struct { } // NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error) { @@ -48,7 +47,7 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // BeginBatchUpdate - Update a list of configurations in a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The parameters for updating a list of server configuration. @@ -60,9 +59,10 @@ func (client *ConfigurationsClient) BeginBatchUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationsClientBatchUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationsClientBatchUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ConfigurationsClientBatchUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,28 +71,27 @@ func (client *ConfigurationsClient) BeginBatchUpdate(ctx context.Context, resour // BatchUpdate - Update a list of configurations in a given server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *ConfigurationsClient) batchUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ConfigurationListForBatchUpdate, options *ConfigurationsClientBeginBatchUpdateOptions) (*http.Response, error) { + var err error req, err := client.batchUpdateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // batchUpdateCreateRequest creates the BatchUpdate request. func (client *ConfigurationsClient) batchUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ConfigurationListForBatchUpdate, options *ConfigurationsClientBeginBatchUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/updateConfigurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -107,16 +106,19 @@ func (client *ConfigurationsClient) batchUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdate - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - configurationName - The name of the server configuration. @@ -129,7 +131,8 @@ func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[ConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,28 +141,27 @@ func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -178,41 +180,44 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets information about a configuration of server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - configurationName - The name of the server configuration. // - options - ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. func (client *ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string, options *ConfigurationsClientGetOptions) (ConfigurationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, configurationName, options) if err != nil { return ConfigurationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConfigurationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, configurationName string, options *ConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -231,7 +236,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +253,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // NewListByServerPager - List all the configurations in a given server. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager @@ -284,9 +289,6 @@ func (client *ConfigurationsClient) NewListByServerPager(resourceGroupName strin // listByServerCreateRequest creates the ListByServer request. func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ConfigurationsClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -301,7 +303,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") if options != nil && options.Tags != nil { reqQP.Set("tags", *options.Tags) } @@ -331,7 +333,7 @@ func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Respon // BeginUpdate - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - configurationName - The name of the server configuration. @@ -344,7 +346,8 @@ func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller[ConfigurationsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ConfigurationsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ConfigurationsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -353,28 +356,27 @@ func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/configurations/{configurationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -393,8 +395,11 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go deleted file mode 100644 index 09800f288994..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go +++ /dev/null @@ -1,376 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationCreateOrUpdate.json -func ExampleConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "event_scheduler", armmysqlflexibleservers.Configuration{ - Properties: &armmysqlflexibleservers.ConfigurationProperties{ - Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), - Value: to.Ptr("off"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Configuration = armmysqlflexibleservers.Configuration{ - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/configurations/event_scheduler"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler."), - // AllowedValues: to.Ptr("ON,OFF,DISABLED"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), - // Value: to.Ptr("ON"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationUpdate.json -func ExampleConfigurationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginUpdate(ctx, "testrg", "testserver", "event_scheduler", armmysqlflexibleservers.Configuration{ - Properties: &armmysqlflexibleservers.ConfigurationProperties{ - Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), - Value: to.Ptr("on"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Configuration = armmysqlflexibleservers.Configuration{ - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/configurations/event_scheduler"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler. It is always OFF for a replica server to keep the replication consistency."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), - // Value: to.Ptr("ON"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationGet.json -func ExampleConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().Get(ctx, "TestGroup", "testserver", "event_scheduler", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Configuration = armmysqlflexibleservers.Configuration{ - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/configurations/event_scheduler"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler. It is always OFF for a replica server to keep the replication consistency."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("OFF"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationsBatchUpdate.json -func ExampleConfigurationsClient_BeginBatchUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginBatchUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ConfigurationListForBatchUpdate{ - ResetAllToDefault: to.Ptr(armmysqlflexibleservers.ResetAllToDefaultFalse), - Value: []*armmysqlflexibleservers.ConfigurationForBatchUpdate{ - { - Name: to.Ptr("event_scheduler"), - Properties: &armmysqlflexibleservers.ConfigurationForBatchUpdateProperties{ - Value: to.Ptr("OFF"), - }, - }, - { - Name: to.Ptr("div_precision_increment"), - Properties: &armmysqlflexibleservers.ConfigurationForBatchUpdateProperties{ - Value: to.Ptr("8"), - }, - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationListResult = armmysqlflexibleservers.ConfigurationListResult{ - // Value: []*armmysqlflexibleservers.Configuration{ - // { - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/event_scheduler"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler. It is always OFF for a replica server to keep the replication consistency."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), - // Value: to.Ptr("ON"), - // }, - // }, - // { - // Name: to.Ptr("div_precision_increment"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/div_precision_increment"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Number of digits by which to increase the scale of the result of division operations."), - // AllowedValues: to.Ptr("0-30"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("4"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceUserOverride), - // Value: to.Ptr("8"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Configurations/preview/2021-12-01-preview/examples/ConfigurationsListByServer.json -func ExampleConfigurationsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationsClient().NewListByServerPager("testrg", "mysqltestserver", &armmysqlflexibleservers.ConfigurationsClientListByServerOptions{Tags: nil, - Keyword: nil, - Page: to.Ptr[int32](1), - PageSize: to.Ptr[int32](8), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConfigurationListResult = armmysqlflexibleservers.ConfigurationListResult{ - // Value: []*armmysqlflexibleservers.Configuration{ - // { - // Name: to.Ptr("archive"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/archive"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Tell the server to enable or disable archive engine."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigFalse), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyTrue), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("audit_log_enabled"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/audit_log_enabled"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Allow to audit the log."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("audit_log_events"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/audit_log_events"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Select the events to audit logs."), - // AllowedValues: to.Ptr("DDL,DML_SELECT,DML_NONSELECT,DCL,ADMIN,DML,GENERAL,CONNECTION,TABLE_ACCESS"), - // DataType: to.Ptr("Set"), - // DefaultValue: to.Ptr("CONNECTION"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("CONNECTION"), - // }, - // }, - // { - // Name: to.Ptr("audit_log_exclude_users"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/audit_log_exclude_users"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("The comma-separated user list whose commands will not be in the audit logs."), - // AllowedValues: to.Ptr(""), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr("azure_superuser"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("azure_superuser"), - // }, - // }, - // { - // Name: to.Ptr("audit_log_include_users"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/audit_log_include_users"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("The comma-separated user list whose commands will be in the audit logs. It takes higher priority if the same user name is found in audit_log_exclude_users."), - // AllowedValues: to.Ptr(""), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr(""), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr(""), - // }, - // }, - // { - // Name: to.Ptr("audit_slow_log_enabled"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/audit_slow_log_enabled"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Allow to audit the slow log."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("ON"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyTrue), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("ON"), - // }, - // }, - // { - // Name: to.Ptr("auto_generate_certs"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/auto_generate_certs"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("Controls whether the server autogenerates SSL key and certificate files in the data directory, if they do not already exist."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigFalse), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyTrue), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("auto_increment_increment"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver/configurations/auto_increment_increment"), - // Properties: &armmysqlflexibleservers.ConfigurationProperties{ - // Description: to.Ptr("The auto_increment_increment is intended for use with source-to-source replication, and can be used to control the operation of AUTO_INCREMENT columns."), - // AllowedValues: to.Ptr("1-65535"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1"), - // IsConfigPendingRestart: to.Ptr(armmysqlflexibleservers.IsConfigPendingRestartFalse), - // IsDynamicConfig: to.Ptr(armmysqlflexibleservers.IsDynamicConfigTrue), - // IsReadOnly: to.Ptr(armmysqlflexibleservers.IsReadOnlyFalse), - // Source: to.Ptr(armmysqlflexibleservers.ConfigurationSourceSystemDefault), - // Value: to.Ptr("1"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go index 83e2f7fad93f..ee0642c90cff 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers const ( moduleName = "armmysqlflexibleservers" - moduleVersion = "v2.0.0-beta.1" + moduleVersion = "v2.0.0-beta.2" ) type AdministratorName string @@ -46,14 +45,14 @@ type BackupFormat string const ( BackupFormatCollatedFormat BackupFormat = "CollatedFormat" - BackupFormatNone BackupFormat = "None" + BackupFormatRaw BackupFormat = "Raw" ) // PossibleBackupFormatValues returns the possible values for the BackupFormat const type. func PossibleBackupFormatValues() []BackupFormat { return []BackupFormat{ BackupFormatCollatedFormat, - BackupFormatNone, + BackupFormatRaw, } } @@ -185,6 +184,20 @@ func PossibleHighAvailabilityStateValues() []HighAvailabilityState { } } +// ImportSourceStorageType - Storage type of import source. +type ImportSourceStorageType string + +const ( + ImportSourceStorageTypeAzureBlob ImportSourceStorageType = "AzureBlob" +) + +// PossibleImportSourceStorageTypeValues returns the possible values for the ImportSourceStorageType const type. +func PossibleImportSourceStorageTypeValues() []ImportSourceStorageType { + return []ImportSourceStorageType{ + ImportSourceStorageTypeAzureBlob, + } +} + // IsConfigPendingRestart - If is the configuration pending restart or not. type IsConfigPendingRestart string @@ -251,29 +264,67 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { type OperationStatus string const ( - // OperationStatusPending - The operation has been accepted but hasn't started. - OperationStatusPending OperationStatus = "Pending" - // OperationStatusInProgress - The operation is running - OperationStatusInProgress OperationStatus = "InProgress" - // OperationStatusSucceeded - The operation Succeeded - OperationStatusSucceeded OperationStatus = "Succeeded" - // OperationStatusFailed - The operation Failed - OperationStatusFailed OperationStatus = "Failed" // OperationStatusCancelInProgress - The cancellation in progress OperationStatusCancelInProgress OperationStatus = "CancelInProgress" // OperationStatusCanceled - The operation has been Canceled OperationStatusCanceled OperationStatus = "Canceled" + // OperationStatusFailed - The operation Failed + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress - The operation is running + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusPending - The operation has been accepted but hasn't started. + OperationStatusPending OperationStatus = "Pending" + // OperationStatusSucceeded - The operation Succeeded + OperationStatusSucceeded OperationStatus = "Succeeded" ) // PossibleOperationStatusValues returns the possible values for the OperationStatus const type. func PossibleOperationStatusValues() []OperationStatus { return []OperationStatus{ - OperationStatusPending, - OperationStatusInProgress, - OperationStatusSucceeded, - OperationStatusFailed, OperationStatusCancelInProgress, OperationStatusCanceled, + OperationStatusFailed, + OperationStatusInProgress, + OperationStatusPending, + OperationStatusSucceeded, + } +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, } } @@ -311,21 +362,21 @@ func PossibleResetAllToDefaultValues() []ResetAllToDefault { } } -// SKUTier - The tier of the particular SKU, e.g. GeneralPurpose. -type SKUTier string +// ServerSKUTier - The tier of the particular SKU, e.g. GeneralPurpose. +type ServerSKUTier string const ( - SKUTierBurstable SKUTier = "Burstable" - SKUTierGeneralPurpose SKUTier = "GeneralPurpose" - SKUTierMemoryOptimized SKUTier = "MemoryOptimized" + ServerSKUTierBurstable ServerSKUTier = "Burstable" + ServerSKUTierGeneralPurpose ServerSKUTier = "GeneralPurpose" + ServerSKUTierMemoryOptimized ServerSKUTier = "MemoryOptimized" ) -// PossibleSKUTierValues returns the possible values for the SKUTier const type. -func PossibleSKUTierValues() []SKUTier { - return []SKUTier{ - SKUTierBurstable, - SKUTierGeneralPurpose, - SKUTierMemoryOptimized, +// PossibleServerSKUTierValues returns the possible values for the ServerSKUTier const type. +func PossibleServerSKUTierValues() []ServerSKUTier { + return []ServerSKUTier{ + ServerSKUTierBurstable, + ServerSKUTierGeneralPurpose, + ServerSKUTierMemoryOptimized, } } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go index 2f2de50daa32..b85f386d6830 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type DatabasesClient struct { } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabasesClient, error) { @@ -47,7 +46,7 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - databaseName - The name of the database. @@ -60,7 +59,8 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,28 +69,27 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/databases/{databaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -109,16 +108,19 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - databaseName - The name of the database. @@ -129,7 +131,8 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,28 +141,27 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/databases/{databaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -178,7 +180,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,32 +189,32 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets information about a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - databaseName - The name of the database. // - options - DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientGetOptions) (DatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return DatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/databases/{databaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -231,7 +233,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +250,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases // NewListByServerPager - List all the databases in a given server. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager @@ -284,9 +286,6 @@ func (client *DatabasesClient) NewListByServerPager(resourceGroupName string, se // listByServerCreateRequest creates the ListByServer request. func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *DatabasesClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/databases" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -301,7 +300,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go deleted file mode 100644 index ef77b6ef696f..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseCreate.json -func ExampleDatabasesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "db1", armmysqlflexibleservers.Database{ - Properties: &armmysqlflexibleservers.DatabaseProperties{ - Charset: to.Ptr("utf8"), - Collation: to.Ptr("utf8_general_ci"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armmysqlflexibleservers.Database{ - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/databases/db1"), - // Properties: &armmysqlflexibleservers.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseDelete.json -func ExampleDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "TestGroup", "testserver", "db1", 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabaseGet.json -func ExampleDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "TestGroup", "testserver", "db1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armmysqlflexibleservers.Database{ - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/databases/db1"), - // Properties: &armmysqlflexibleservers.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Databases/preview/2021-12-01-preview/examples/DatabasesListByServer.json -func ExampleDatabasesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListByServerPager("TestGroup", "testserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseListResult = armmysqlflexibleservers.DatabaseListResult{ - // Value: []*armmysqlflexibleservers.Database{ - // { - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/databases/db1"), - // Properties: &armmysqlflexibleservers.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // }, - // { - // Name: to.Ptr("db2"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/databases/db2"), - // Properties: &armmysqlflexibleservers.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go index 31c7024f852b..f1a301086c18 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error) { @@ -47,7 +46,7 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - firewallRuleName - The name of the server firewall rule. @@ -60,7 +59,8 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,28 +69,27 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -109,16 +108,19 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - firewallRuleName - The name of the server firewall rule. @@ -130,7 +132,8 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,28 +142,27 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -179,7 +181,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,32 +190,32 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets information about a server firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - firewallRuleName - The name of the server firewall rule. // - options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return FirewallRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FirewallRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FirewallRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -232,7 +234,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +251,7 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew // NewListByServerPager - List all the firewall rules in a given server. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager @@ -285,9 +287,6 @@ func (client *FirewallRulesClient) NewListByServerPager(resourceGroupName string // listByServerCreateRequest creates the ListByServer request. func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *FirewallRulesClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/firewallRules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -302,7 +301,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go deleted file mode 100644 index dd4eb2d03a4c..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleCreate.json -func ExampleFirewallRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallRulesClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "rule1", armmysqlflexibleservers.FirewallRule{ - Properties: &armmysqlflexibleservers.FirewallRuleProperties{ - EndIPAddress: to.Ptr("255.255.255.255"), - StartIPAddress: to.Ptr("0.0.0.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armmysqlflexibleservers.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/firewallRules/rule1"), - // Properties: &armmysqlflexibleservers.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleDelete.json -func ExampleFirewallRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallRulesClient().BeginDelete(ctx, "TestGroup", "testserver", "rule1", 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRuleGet.json -func ExampleFirewallRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallRulesClient().Get(ctx, "TestGroup", "testserver", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armmysqlflexibleservers.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/firewallRules/rule1"), - // Properties: &armmysqlflexibleservers.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/Firewall/preview/2021-12-01-preview/examples/FirewallRulesListByServer.json -func ExampleFirewallRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallRulesClient().NewListByServerPager("TestGroup", "testserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallRuleListResult = armmysqlflexibleservers.FirewallRuleListResult{ - // Value: []*armmysqlflexibleservers.FirewallRule{ - // { - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/firewallRules/rule1"), - // Properties: &armmysqlflexibleservers.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // }, - // { - // Name: to.Ptr("rule2"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/testserver/firewallRules/rule2"), - // Properties: &armmysqlflexibleservers.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.0.0.0"), - // StartIPAddress: to.Ptr("1.0.0.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go index 2eafb540f197..38bda8fcde22 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -41,22 +40,25 @@ func NewGetPrivateDNSZoneSuffixClient(credential azcore.TokenCredential, options // Execute - Get private DNS zone suffix in the cloud. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - options - GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute // method. func (client *GetPrivateDNSZoneSuffixClient) Execute(ctx context.Context, options *GetPrivateDNSZoneSuffixClientExecuteOptions) (GetPrivateDNSZoneSuffixClientExecuteResponse, error) { + var err error req, err := client.executeCreateRequest(ctx, options) if err != nil { return GetPrivateDNSZoneSuffixClientExecuteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetPrivateDNSZoneSuffixClientExecuteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetPrivateDNSZoneSuffixClientExecuteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetPrivateDNSZoneSuffixClientExecuteResponse{}, err } - return client.executeHandleResponse(resp) + resp, err := client.executeHandleResponse(httpResp) + return resp, err } // executeCreateRequest creates the Execute request. @@ -67,7 +69,7 @@ func (client *GetPrivateDNSZoneSuffixClient) executeCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client_example_test.go deleted file mode 100644 index dfaa4386b012..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_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. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/GetPrivateDnsZoneSuffix.json -func ExampleGetPrivateDNSZoneSuffixClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGetPrivateDNSZoneSuffixClient().Execute(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GetPrivateDNSZoneSuffixResponse = armmysqlflexibleservers.GetPrivateDNSZoneSuffixResponse{ - // PrivateDNSZoneSuffix: to.Ptr("suffix-example"), - // } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod index 521a5db0631d..a84d071a8c5b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexi go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/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/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/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/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +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.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/mysql/armmysqlflexibleservers/interfaces.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/interfaces.go new file mode 100644 index 000000000000..117de631ec56 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/interfaces.go @@ -0,0 +1,18 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +// BackupStoreDetailsClassification provides polymorphic access to related types. +// Call the interface's GetBackupStoreDetails() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupStoreDetails, *FullBackupStoreDetails +type BackupStoreDetailsClassification interface { + // GetBackupStoreDetails returns the BackupStoreDetails content of the underlying type. + GetBackupStoreDetails() *BackupStoreDetails +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go index f74c9212886c..f6d0c1132f2a 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type LocationBasedCapabilitiesClient struct { } // NewLocationBasedCapabilitiesClient creates a new instance of LocationBasedCapabilitiesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedCapabilitiesClient, error) { @@ -46,7 +45,7 @@ func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore // NewListPager - Get capabilities at specified location in a given subscription. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - locationName - The name of the location. // - options - LocationBasedCapabilitiesClientListOptions contains the optional parameters for the LocationBasedCapabilitiesClient.NewListPager // method. @@ -81,9 +80,6 @@ func (client *LocationBasedCapabilitiesClient) NewListPager(locationName string, // listCreateRequest creates the List request. func (client *LocationBasedCapabilitiesClient) listCreateRequest(ctx context.Context, locationName string, options *LocationBasedCapabilitiesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilities" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if locationName == "" { return nil, errors.New("parameter locationName cannot be empty") @@ -94,7 +90,7 @@ func (client *LocationBasedCapabilitiesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go deleted file mode 100644 index 2d5295544e3c..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go +++ /dev/null @@ -1,1138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/CapabilitiesByLocationList.json -func ExampleLocationBasedCapabilitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLocationBasedCapabilitiesClient().NewListPager("WestUS", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapabilitiesListResult = armmysqlflexibleservers.CapabilitiesListResult{ - // Value: []*armmysqlflexibleservers.CapabilityProperties{ - // { - // SupportedFlexibleServerEditions: []*armmysqlflexibleservers.ServerEditionCapability{ - // { - // Name: to.Ptr("Burstable"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("GeneralPurpose"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("MemoryOptimized"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }}, - // SupportedGeoBackupRegions: []*string{ - // }, - // SupportedHAMode: []*string{ - // to.Ptr("SameZone"), - // to.Ptr("ZoneRedundant")}, - // Zone: to.Ptr("none"), - // }, - // { - // SupportedFlexibleServerEditions: []*armmysqlflexibleservers.ServerEditionCapability{ - // { - // Name: to.Ptr("Burstable"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("GeneralPurpose"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("MemoryOptimized"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }}, - // SupportedGeoBackupRegions: []*string{ - // }, - // SupportedHAMode: []*string{ - // to.Ptr("SameZone"), - // to.Ptr("ZoneRedundant")}, - // Zone: to.Ptr("1"), - // }, - // { - // SupportedFlexibleServerEditions: []*armmysqlflexibleservers.ServerEditionCapability{ - // { - // Name: to.Ptr("Burstable"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("GeneralPurpose"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("MemoryOptimized"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }}, - // SupportedGeoBackupRegions: []*string{ - // }, - // SupportedHAMode: []*string{ - // to.Ptr("SameZone"), - // to.Ptr("ZoneRedundant")}, - // Zone: to.Ptr("2"), - // }, - // { - // SupportedFlexibleServerEditions: []*armmysqlflexibleservers.ServerEditionCapability{ - // { - // Name: to.Ptr("Burstable"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_B1s"), - // SupportedIops: to.Ptr[int64](400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](1024), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B1ms"), - // SupportedIops: to.Ptr[int64](640), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](1), - // }, - // { - // Name: to.Ptr("Standard_B2s"), - // SupportedIops: to.Ptr[int64](1280), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](2048), - // VCores: to.Ptr[int64](2), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("GeneralPurpose"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_D2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_D4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_D8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_D16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_D32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_D48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_D64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](4096), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }, - // { - // Name: to.Ptr("MemoryOptimized"), - // SupportedServerVersions: []*armmysqlflexibleservers.ServerVersionCapability{ - // { - // Name: to.Ptr("5.7"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }, - // { - // Name: to.Ptr("8.0.21"), - // SupportedSKUs: []*armmysqlflexibleservers.SKUCapability{ - // { - // Name: to.Ptr("Standard_E2ds_v4"), - // SupportedIops: to.Ptr[int64](3200), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](2), - // }, - // { - // Name: to.Ptr("Standard_E4ds_v4"), - // SupportedIops: to.Ptr[int64](6400), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](4), - // }, - // { - // Name: to.Ptr("Standard_E8ds_v4"), - // SupportedIops: to.Ptr[int64](12800), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](8), - // }, - // { - // Name: to.Ptr("Standard_E16ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](16), - // }, - // { - // Name: to.Ptr("Standard_E32ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](32), - // }, - // { - // Name: to.Ptr("Standard_E48ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](48), - // }, - // { - // Name: to.Ptr("Standard_E64ds_v4"), - // SupportedIops: to.Ptr[int64](20000), - // SupportedMemoryPerVCoreMB: to.Ptr[int64](8192), - // VCores: to.Ptr[int64](64), - // }}, - // }}, - // SupportedStorageEditions: []*armmysqlflexibleservers.StorageEditionCapability{ - // { - // Name: to.Ptr("Premium"), - // MaxBackupRetentionDays: to.Ptr[int64](35), - // MaxStorageSize: to.Ptr[int64](16777216), - // MinBackupRetentionDays: to.Ptr[int64](7), - // MinStorageSize: to.Ptr[int64](20480), - // }}, - // }}, - // SupportedGeoBackupRegions: []*string{ - // }, - // SupportedHAMode: []*string{ - // to.Ptr("SameZone"), - // to.Ptr("ZoneRedundant")}, - // Zone: to.Ptr("3"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilityset_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilityset_client.go new file mode 100644 index 000000000000..05b39edf65da --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilityset_client.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// LocationBasedCapabilitySetClient contains the methods for the LocationBasedCapabilitySet group. +// Don't use this type directly, use NewLocationBasedCapabilitySetClient() instead. +type LocationBasedCapabilitySetClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLocationBasedCapabilitySetClient creates a new instance of LocationBasedCapabilitySetClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewLocationBasedCapabilitySetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedCapabilitySetClient, error) { + cl, err := arm.NewClient(moduleName+".LocationBasedCapabilitySetClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LocationBasedCapabilitySetClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get capabilities at specified location in a given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - locationName - The name of the location. +// - capabilitySetName - Name of capability set +// - options - LocationBasedCapabilitySetClientGetOptions contains the optional parameters for the LocationBasedCapabilitySetClient.Get +// method. +func (client *LocationBasedCapabilitySetClient) Get(ctx context.Context, locationName string, capabilitySetName string, options *LocationBasedCapabilitySetClientGetOptions) (LocationBasedCapabilitySetClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, locationName, capabilitySetName, options) + if err != nil { + return LocationBasedCapabilitySetClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocationBasedCapabilitySetClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocationBasedCapabilitySetClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *LocationBasedCapabilitySetClient) getCreateRequest(ctx context.Context, locationName string, capabilitySetName string, options *LocationBasedCapabilitySetClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets/{capabilitySetName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if capabilitySetName == "" { + return nil, errors.New("parameter capabilitySetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilitySetName}", url.PathEscape(capabilitySetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LocationBasedCapabilitySetClient) getHandleResponse(resp *http.Response) (LocationBasedCapabilitySetClientGetResponse, error) { + result := LocationBasedCapabilitySetClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Capability); err != nil { + return LocationBasedCapabilitySetClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get capabilities at specified location in a given subscription. +// +// Generated from API version 2023-06-01-preview +// - locationName - The name of the location. +// - options - LocationBasedCapabilitySetClientListOptions contains the optional parameters for the LocationBasedCapabilitySetClient.NewListPager +// method. +func (client *LocationBasedCapabilitySetClient) NewListPager(locationName string, options *LocationBasedCapabilitySetClientListOptions) *runtime.Pager[LocationBasedCapabilitySetClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[LocationBasedCapabilitySetClientListResponse]{ + More: func(page LocationBasedCapabilitySetClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LocationBasedCapabilitySetClientListResponse) (LocationBasedCapabilitySetClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, locationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LocationBasedCapabilitySetClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocationBasedCapabilitySetClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocationBasedCapabilitySetClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *LocationBasedCapabilitySetClient) listCreateRequest(ctx context.Context, locationName string, options *LocationBasedCapabilitySetClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LocationBasedCapabilitySetClient) listHandleResponse(resp *http.Response) (LocationBasedCapabilitySetClientListResponse, error) { + result := LocationBasedCapabilitySetClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapabilitySetsList); err != nil { + return LocationBasedCapabilitySetClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go index 37bf7fd8285e..58015a895905 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type LogFilesClient struct { } // NewLogFilesClient creates a new instance of LogFilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogFilesClient, error) { @@ -46,7 +45,7 @@ func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, // NewListByServerPager - List all the server log files in a given server. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager @@ -82,9 +81,6 @@ func (client *LogFilesClient) NewListByServerPager(resourceGroupName string, ser // listByServerCreateRequest creates the ListByServer request. func (client *LogFilesClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *LogFilesClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/logFiles" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -99,7 +95,7 @@ func (client *LogFilesClient) listByServerCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go deleted file mode 100644 index 4e08a958ed1b..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/LogFiles/preview/2021-12-01-preview/examples/LogFilesListByServer.json -func ExampleLogFilesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogFilesClient().NewListByServerPager("testrg", "mysqltestsvc1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogFileListResult = armmysqlflexibleservers.LogFileListResult{ - // Value: []*armmysqlflexibleservers.LogFile{ - // { - // Name: to.Ptr("mysql-slow-mysqltestsvc1-2018022823.log"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers/logFiles"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestsvc1/logFiles/mysql-slow-mysqltestsvc1-2018022823.log"), - // Properties: &armmysqlflexibleservers.LogFileProperties{ - // Type: to.Ptr("slowlog"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00+00:00"); return t}()), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-01T06:09:20+00:00"); return t}()), - // SizeInKB: to.Ptr[int64](1), - // URL: to.Ptr("https://wasd2prodwus1afse42.file.core.windows.net/833c99b2f36c47349e5554b903fe0440/serverlogs/mysql-slow-mysqltestsvc1-2018022823.log?sv=2015-04-05&sr=f&sig=D9Ga4N5Pa%2BPe5Bmjpvs7A0TPD%2FF7IZpk9e4KWR0jgpM%3D&se=2018-03-01T07%3A12%3A13Z&sp=r"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go index 2d5ddf12603e..af953687a28b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -43,44 +42,19 @@ type AzureADAdministrator struct { // The properties of an administrator. Properties *AdministratorProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// AzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureADAdministratorsClient.BeginCreateOrUpdate -// method. -type AzureADAdministratorsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the AzureADAdministratorsClient.BeginDelete -// method. -type AzureADAdministratorsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AzureADAdministratorsClientGetOptions contains the optional parameters for the AzureADAdministratorsClient.Get method. -type AzureADAdministratorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AzureADAdministratorsClientListByServerOptions contains the optional parameters for the AzureADAdministratorsClient.NewListByServerPager -// method. -type AzureADAdministratorsClientListByServerOptions struct { - // placeholder for future optional parameters -} - // Backup - Storage Profile properties of a server type Backup struct { // Backup retention days for the server. @@ -93,18 +67,6 @@ type Backup struct { EarliestRestoreDate *time.Time } -// BackupAndExportClientBeginCreateOptions contains the optional parameters for the BackupAndExportClient.BeginCreate method. -type BackupAndExportClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupAndExportClientValidateBackupOptions contains the optional parameters for the BackupAndExportClient.ValidateBackup -// method. -type BackupAndExportClientValidateBackupOptions struct { - // placeholder for future optional parameters -} - // BackupAndExportRequest - BackupAndExport API Request type BackupAndExportRequest struct { // REQUIRED; Backup Settings @@ -119,8 +81,8 @@ type BackupAndExportResponse struct { // End time EndTime *time.Time - // The BackupAndExport operation error response. - Error *ErrorResponse + // The error object. + Error *ErrorDetail // Operation progress (0-100). PercentComplete *float64 @@ -134,12 +96,15 @@ type BackupAndExportResponse struct { // The operation status Status *OperationStatus - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -171,15 +136,6 @@ type BackupSettings struct { BackupFormat *BackupFormat } -// BackupStoreDetailsClassification provides polymorphic access to related types. -// Call the interface's GetBackupStoreDetails() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BackupStoreDetails, *FullBackupStoreDetails -type BackupStoreDetailsClassification interface { - // GetBackupStoreDetails returns the BackupStoreDetails content of the underlying type. - GetBackupStoreDetails() *BackupStoreDetails -} - // BackupStoreDetails - Details about the target where the backup content will be stored. type BackupStoreDetails struct { // REQUIRED; Type of the specific object - used for deserializing @@ -189,21 +145,6 @@ type BackupStoreDetails struct { // GetBackupStoreDetails implements the BackupStoreDetailsClassification interface for type BackupStoreDetails. func (b *BackupStoreDetails) GetBackupStoreDetails() *BackupStoreDetails { return b } -// BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. -type BackupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupsClientListByServerOptions contains the optional parameters for the BackupsClient.NewListByServerPager method. -type BackupsClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// BackupsClientPutOptions contains the optional parameters for the BackupsClient.Put method. -type BackupsClientPutOptions struct { - // placeholder for future optional parameters -} - // CapabilitiesListResult - location capability type CapabilitiesListResult struct { // READ-ONLY; Link to retrieve next page of results. @@ -213,6 +154,24 @@ type CapabilitiesListResult struct { Value []*CapabilityProperties } +// Capability - Represents a location capability set. +type Capability struct { + // The properties of a location capability set. + Properties *CapabilityPropertiesV2 + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // CapabilityProperties - Location capabilities. type CapabilityProperties struct { // READ-ONLY; A list of supported flexible server editions. @@ -228,22 +187,25 @@ type CapabilityProperties struct { Zone *string } -// CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute -// method. -type CheckNameAvailabilityClientExecuteOptions struct { - // placeholder for future optional parameters -} +// CapabilityPropertiesV2 - Location capability. +type CapabilityPropertiesV2 struct { + // READ-ONLY; A list of supported flexible server editions. + SupportedFlexibleServerEditions []*ServerEditionCapabilityV2 -// CheckNameAvailabilityWithoutLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithoutLocationClient.Execute -// method. -type CheckNameAvailabilityWithoutLocationClientExecuteOptions struct { - // placeholder for future optional parameters + // READ-ONLY; supported geo backup regions + SupportedGeoBackupRegions []*string + + // READ-ONLY; A list of supported server versions. + SupportedServerVersions []*ServerVersionCapabilityV2 } -// CheckVirtualNetworkSubnetUsageClientExecuteOptions contains the optional parameters for the CheckVirtualNetworkSubnetUsageClient.Execute -// method. -type CheckVirtualNetworkSubnetUsageClientExecuteOptions struct { - // placeholder for future optional parameters +// CapabilitySetsList - location capability set +type CapabilitySetsList struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string + + // READ-ONLY; A list of supported capability sets. + Value []*Capability } // Configuration - Represents a Configuration. @@ -251,13 +213,13 @@ type Configuration struct { // The properties of a configuration. Properties *ConfigurationProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -336,44 +298,6 @@ type ConfigurationProperties struct { IsReadOnly *IsReadOnly } -// ConfigurationsClientBeginBatchUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginBatchUpdate -// method. -type ConfigurationsClientBeginBatchUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate -// method. -type ConfigurationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate method. -type ConfigurationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. -type ConfigurationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager -// method. -type ConfigurationsClientListByServerOptions struct { - // The keyword of the server configuration. - Keyword *string - // The page of the server configuration. - Page *int32 - // The pageSize of the server configuration. - PageSize *int32 - // The tags of the server configuration. - Tags *string -} - // DataEncryption - The date encryption for cmk. type DataEncryption struct { // Geo backup key uri as key vault can't cross region, need cmk in same region as geo backup @@ -397,13 +321,13 @@ type Database struct { // The properties of a database. Properties *DatabaseProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -428,29 +352,6 @@ type DatabaseProperties struct { Collation *string } -// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate -// method. -type DatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. -type DatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. -type DatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager method. -type DatabasesClientListByServerOptions struct { - // placeholder for future optional parameters -} - // DelegatedSubnetUsage - Delegated subnet usage data. type DelegatedSubnetUsage struct { // READ-ONLY; name of the subnet @@ -469,9 +370,8 @@ type ErrorAdditionalInfo struct { Type *string } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.) -type ErrorResponse struct { +// ErrorDetail - The error detail. +type ErrorDetail struct { // READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo @@ -479,7 +379,7 @@ type ErrorResponse struct { Code *string // READ-ONLY; The error details. - Details []*ErrorResponse + Details []*ErrorDetail // READ-ONLY; The error message. Message *string @@ -488,18 +388,25 @@ type ErrorResponse struct { Target *string } +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail +} + // FirewallRule - Represents a server firewall rule. type FirewallRule struct { // REQUIRED; The properties of a firewall rule. Properties *FirewallRuleProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -524,30 +431,6 @@ type FirewallRuleProperties struct { StartIPAddress *string } -// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate -// method. -type FirewallRulesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. -type FirewallRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. -type FirewallRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager -// method. -type FirewallRulesClientListByServerOptions struct { - // placeholder for future optional parameters -} - // FullBackupStoreDetails is used for scenarios where backup data is streamed/copied over to a storage destination. type FullBackupStoreDetails struct { // REQUIRED; Type of the specific object - used for deserializing @@ -564,12 +447,6 @@ func (f *FullBackupStoreDetails) GetBackupStoreDetails() *BackupStoreDetails { } } -// GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute -// method. -type GetPrivateDNSZoneSuffixClientExecuteOptions struct { - // placeholder for future optional parameters -} - // GetPrivateDNSZoneSuffixResponse - The response of get private dns zone suffix. type GetPrivateDNSZoneSuffixResponse struct { // Represents the private DNS zone suffix. @@ -588,25 +465,19 @@ type HighAvailability struct { State *HighAvailabilityState } -// Identity - Properties to configure Identity for Bring your Own Keys -type Identity struct { - // Type of managed service identity. - Type *ManagedServiceIdentityType - - // Metadata of user assigned identity. - UserAssignedIdentities map[string]any +// ImportSourceProperties - Import source related properties. +type ImportSourceProperties struct { + // Relative path of data directory in storage. + DataDirPath *string - // READ-ONLY; ObjectId from the KeyVault - PrincipalID *string + // Sas token for accessing source storage. Read and list permissions are required for sas token. + SasToken *string - // READ-ONLY; TenantId from the KeyVault - TenantID *string -} + // Storage type of import source. + StorageType *ImportSourceStorageType -// LocationBasedCapabilitiesClientListOptions contains the optional parameters for the LocationBasedCapabilitiesClient.NewListPager -// method. -type LocationBasedCapabilitiesClientListOptions struct { - // placeholder for future optional parameters + // Uri of the import source storage. + StorageURL *string } // LogFile - Represents a logFile. @@ -614,13 +485,13 @@ type LogFile struct { // The properties of a logFile. Properties *LogFileProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -654,11 +525,6 @@ type LogFileProperties struct { URL *string } -// LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager method. -type LogFilesClientListByServerOptions struct { - // placeholder for future optional parameters -} - // MaintenanceWindow - Maintenance window of a server. type MaintenanceWindow struct { // indicates whether custom window is enabled or disabled @@ -674,6 +540,30 @@ type MaintenanceWindow struct { StartMinute *int32 } +// MySQLServerIdentity - Properties to configure Identity for Bring your Own Keys +type MySQLServerIdentity struct { + // Type of managed service identity. + Type *ManagedServiceIdentityType + + // Metadata of user assigned identity. + UserAssignedIdentities map[string]any + + // READ-ONLY; ObjectId from the KeyVault + PrincipalID *string + + // READ-ONLY; TenantId from the KeyVault + TenantID *string +} + +// MySQLServerSKU - Billing information related properties of a server. +type MySQLServerSKU struct { + // REQUIRED; The name of the sku, e.g. StandardD32sv3. + Name *string + + // REQUIRED; The tier of the particular SKU, e.g. GeneralPurpose. + Tier *ServerSKUTier +} + // NameAvailability - Represents a resource name availability. type NameAvailability struct { // Error Message. @@ -746,61 +636,184 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters +// OperationStatusExtendedResult - Represents Operation Results API Response +type OperationStatusExtendedResult struct { + // REQUIRED; Operation status. + Status *string + + // The end time of the operation. + EndTime *time.Time + + // If present, details of the operation error. + Error *ErrorDetail + + // Fully qualified ID for the async operation. + ID *string + + // Name of the async operation. + Name *string + + // The operations list. + Operations []*OperationStatusResult + + // Percent of the operation that is complete. + PercentComplete *float32 + + // The extended properties of Operation Results + Properties map[string]any + + // The start time of the operation. + StartTime *time.Time + + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string +} + +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string + + // The end time of the operation. + EndTime *time.Time + + // If present, details of the operation error. + Error *ErrorDetail + + // Fully qualified ID for the async operation. + ID *string + + // Name of the async operation. + Name *string + + // The operations list. + Operations []*OperationStatusResult + + // Percent of the operation that is complete. + PercentComplete *float32 + + // The start time of the operation. + StartTime *time.Time + + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string +} + +// PrivateEndpoint - The private endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for private endpoint. + ID *string +} + +// PrivateEndpointConnection - The private endpoint connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The private endpoint resource. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus } // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.NewListByServerPager method. -type ReplicasClientListByServerOptions struct { - // placeholder for future optional parameters -} - // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// SKU - Billing information related properties of a server. -type SKU struct { - // REQUIRED; The name of the sku, e.g. StandardD32sv3. +// SKUCapability - Sku capability +type SKUCapability struct { + // READ-ONLY; vCore name Name *string - // REQUIRED; The tier of the particular SKU, e.g. GeneralPurpose. - Tier *SKUTier + // READ-ONLY; supported IOPS + SupportedIops *int64 + + // READ-ONLY; supported memory per vCore in MB + SupportedMemoryPerVCoreMB *int64 + + // READ-ONLY; supported vCores + VCores *int64 } -// SKUCapability - Sku capability -type SKUCapability struct { +// SKUCapabilityV2 - Sku capability +type SKUCapabilityV2 struct { // READ-ONLY; vCore name Name *string + // READ-ONLY; Supported high availability mode + SupportedHAMode []*string + // READ-ONLY; supported IOPS SupportedIops *int64 // READ-ONLY; supported memory per vCore in MB SupportedMemoryPerVCoreMB *int64 + // READ-ONLY; Supported zones + SupportedZones []*string + // READ-ONLY; supported vCores VCores *int64 } @@ -811,24 +824,24 @@ type Server struct { Location *string // The cmk identity for the server. - Identity *Identity + Identity *MySQLServerIdentity // Properties of the server. Properties *ServerProperties // The SKU (pricing tier) of the server. - SKU *SKU + SKU *MySQLServerSKU // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -840,13 +853,13 @@ type ServerBackup struct { // The properties of a server backup. Properties *ServerBackupProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -886,24 +899,42 @@ type ServerEditionCapability struct { SupportedStorageEditions []*StorageEditionCapability } +// ServerEditionCapabilityV2 - Server edition capabilities. +type ServerEditionCapabilityV2 struct { + // READ-ONLY; Default Sku name + DefaultSKU *string + + // READ-ONLY; Default storage size + DefaultStorageSize *int32 + + // READ-ONLY; Server edition name + Name *string + + // READ-ONLY; A list of supported Skus + SupportedSKUs []*SKUCapabilityV2 + + // READ-ONLY; A list of supported storage editions + SupportedStorageEditions []*StorageEditionCapability +} + // ServerForUpdate - Parameters allowed to update for a server. type ServerForUpdate struct { // The cmk identity for the server. - Identity *Identity + Identity *MySQLServerIdentity // The properties that can be updated for a server. Properties *ServerPropertiesForUpdate // The SKU (pricing tier) of the server. - SKU *SKU + SKU *MySQLServerSKU // Application-specific metadata in the form of key-value pairs. Tags map[string]*string } -// ServerGtidSetParameter - Server gtid set parameters. +// ServerGtidSetParameter - Server Gtid set parameters. type ServerGtidSetParameter struct { - // The gtid set of server. + // The Gtid set of server. GtidSet *string } @@ -940,6 +971,9 @@ type ServerProperties struct { // High availability related properties of a server. HighAvailability *HighAvailability + // Source properties for import from storage. + ImportSourceProperties *ImportSourceProperties + // Maintenance window of a server. MaintenanceWindow *MaintenanceWindow @@ -964,6 +998,9 @@ type ServerProperties struct { // READ-ONLY; The fully qualified domain name of a server. FullyQualifiedDomainName *string + // READ-ONLY; PrivateEndpointConnections related properties of a server. + PrivateEndpointConnections []*PrivateEndpointConnection + // READ-ONLY; The maximum number of replicas that a primary server can have. ReplicaCapacity *int32 @@ -988,6 +1025,9 @@ type ServerPropertiesForUpdate struct { // Maintenance window of a server. MaintenanceWindow *MaintenanceWindow + // Network related properties of a server + Network *Network + // The replication role of the server. ReplicationRole *ReplicationRole @@ -1016,68 +1056,10 @@ type ServerVersionCapability struct { SupportedSKUs []*SKUCapability } -// ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. -type ServersClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. -type ServersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginFailoverOptions contains the optional parameters for the ServersClient.BeginFailover method. -type ServersClientBeginFailoverOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginResetGtidOptions contains the optional parameters for the ServersClient.BeginResetGtid method. -type ServersClientBeginResetGtidOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. -type ServersClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. -type ServersClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. -type ServersClientBeginStopOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. -type ServersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. -type ServersClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager -// method. -type ServersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. -type ServersClientListOptions struct { - // placeholder for future optional parameters +// ServerVersionCapabilityV2 - Server version capabilities. +type ServerVersionCapabilityV2 struct { + // READ-ONLY; server version + Name *string } // Storage Profile properties of a server @@ -1149,12 +1131,15 @@ type TrackedResource struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go index 69d72d4a673d..a29188d9b2dd 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -210,6 +209,7 @@ func (b BackupAndExportResponse) MarshalJSON() ([]byte, error) { populate(objectMap, "properties", b.Properties) populateTimeRFC3339(objectMap, "startTime", b.StartTime) populate(objectMap, "status", b.Status) + populate(objectMap, "systemData", b.SystemData) populate(objectMap, "type", b.Type) return json.Marshal(objectMap) } @@ -247,6 +247,9 @@ func (b *BackupAndExportResponse) UnmarshalJSON(data []byte) error { case "status": err = unpopulate(val, "Status", &b.Status) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &b.Type) delete(rawMsg, key) @@ -409,6 +412,49 @@ func (c *CapabilitiesListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Capability. +func (c Capability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Capability. +func (c *Capability) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CapabilityProperties. func (c CapabilityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -448,6 +494,72 @@ func (c *CapabilityProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CapabilityPropertiesV2. +func (c CapabilityPropertiesV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "supportedFlexibleServerEditions", c.SupportedFlexibleServerEditions) + populate(objectMap, "supportedGeoBackupRegions", c.SupportedGeoBackupRegions) + populate(objectMap, "supportedServerVersions", c.SupportedServerVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityPropertiesV2. +func (c *CapabilityPropertiesV2) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "supportedFlexibleServerEditions": + err = unpopulate(val, "SupportedFlexibleServerEditions", &c.SupportedFlexibleServerEditions) + delete(rawMsg, key) + case "supportedGeoBackupRegions": + err = unpopulate(val, "SupportedGeoBackupRegions", &c.SupportedGeoBackupRegions) + delete(rawMsg, key) + case "supportedServerVersions": + err = unpopulate(val, "SupportedServerVersions", &c.SupportedServerVersions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapabilitySetsList. +func (c CapabilitySetsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapabilitySetsList. +func (c *CapabilitySetsList) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Configuration. func (c Configuration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -892,8 +1004,8 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) @@ -903,8 +1015,8 @@ func (e ErrorResponse) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) 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", e, err) @@ -935,6 +1047,33 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FirewallRule. func (f FirewallRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1133,18 +1272,18 @@ func (h *HighAvailability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImportSourceProperties. +func (i ImportSourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + populate(objectMap, "dataDirPath", i.DataDirPath) + populate(objectMap, "sasToken", i.SasToken) + populate(objectMap, "storageType", i.StorageType) + populate(objectMap, "storageUrl", i.StorageURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceProperties. +func (i *ImportSourceProperties) 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", i, err) @@ -1152,17 +1291,17 @@ func (i *Identity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "dataDirPath": + err = unpopulate(val, "DataDirPath", &i.DataDirPath) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "sasToken": + err = unpopulate(val, "SasToken", &i.SasToken) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "storageType": + err = unpopulate(val, "StorageType", &i.StorageType) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + case "storageUrl": + err = unpopulate(val, "StorageURL", &i.StorageURL) delete(rawMsg, key) } if err != nil { @@ -1328,6 +1467,76 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MySQLServerIdentity. +func (m MySQLServerIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MySQLServerIdentity. +func (m *MySQLServerIdentity) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MySQLServerSKU. +func (m MySQLServerSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + populate(objectMap, "tier", m.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MySQLServerSKU. +func (m *MySQLServerSKU) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &m.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type NameAvailability. func (n NameAvailability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1538,11 +1747,278 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationStatusExtendedResult. +func (o OperationStatusExtendedResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "resourceId", o.ResourceID) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusExtendedResult. +func (o *OperationStatusExtendedResult) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "resourceId", o.ResourceID) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1562,6 +2038,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1578,6 +2057,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -1597,6 +2077,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -1608,16 +2091,18 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SKU. -func (s SKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKUCapability. +func (s SKUCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", s.Name) - populate(objectMap, "tier", s.Tier) + populate(objectMap, "supportedIops", s.SupportedIops) + populate(objectMap, "supportedMemoryPerVCoreMB", s.SupportedMemoryPerVCoreMB) + populate(objectMap, "vCores", s.VCores) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. -func (s *SKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability. +func (s *SKUCapability) 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) @@ -1628,8 +2113,14 @@ func (s *SKU) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &s.Tier) + case "supportedIops": + err = unpopulate(val, "SupportedIops", &s.SupportedIops) + delete(rawMsg, key) + case "supportedMemoryPerVCoreMB": + err = unpopulate(val, "SupportedMemoryPerVCoreMB", &s.SupportedMemoryPerVCoreMB) + delete(rawMsg, key) + case "vCores": + err = unpopulate(val, "VCores", &s.VCores) delete(rawMsg, key) } if err != nil { @@ -1639,18 +2130,20 @@ func (s *SKU) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SKUCapability. -func (s SKUCapability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKUCapabilityV2. +func (s SKUCapabilityV2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", s.Name) + populate(objectMap, "supportedHAMode", s.SupportedHAMode) populate(objectMap, "supportedIops", s.SupportedIops) populate(objectMap, "supportedMemoryPerVCoreMB", s.SupportedMemoryPerVCoreMB) + populate(objectMap, "supportedZones", s.SupportedZones) populate(objectMap, "vCores", s.VCores) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapability. -func (s *SKUCapability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUCapabilityV2. +func (s *SKUCapabilityV2) 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) @@ -1661,12 +2154,18 @@ func (s *SKUCapability) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) + case "supportedHAMode": + err = unpopulate(val, "SupportedHAMode", &s.SupportedHAMode) + delete(rawMsg, key) case "supportedIops": err = unpopulate(val, "SupportedIops", &s.SupportedIops) delete(rawMsg, key) case "supportedMemoryPerVCoreMB": err = unpopulate(val, "SupportedMemoryPerVCoreMB", &s.SupportedMemoryPerVCoreMB) delete(rawMsg, key) + case "supportedZones": + err = unpopulate(val, "SupportedZones", &s.SupportedZones) + delete(rawMsg, key) case "vCores": err = unpopulate(val, "VCores", &s.VCores) delete(rawMsg, key) @@ -1881,6 +2380,49 @@ func (s *ServerEditionCapability) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServerEditionCapabilityV2. +func (s ServerEditionCapabilityV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultSku", s.DefaultSKU) + populate(objectMap, "defaultStorageSize", s.DefaultStorageSize) + populate(objectMap, "name", s.Name) + populate(objectMap, "supportedSkus", s.SupportedSKUs) + populate(objectMap, "supportedStorageEditions", s.SupportedStorageEditions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerEditionCapabilityV2. +func (s *ServerEditionCapabilityV2) 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 "defaultSku": + err = unpopulate(val, "DefaultSKU", &s.DefaultSKU) + delete(rawMsg, key) + case "defaultStorageSize": + err = unpopulate(val, "DefaultStorageSize", &s.DefaultStorageSize) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "supportedSkus": + err = unpopulate(val, "SupportedSKUs", &s.SupportedSKUs) + delete(rawMsg, key) + case "supportedStorageEditions": + err = unpopulate(val, "SupportedStorageEditions", &s.SupportedStorageEditions) + 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 ServerForUpdate. func (s ServerForUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1989,8 +2531,10 @@ func (s ServerProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "dataEncryption", s.DataEncryption) populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) populate(objectMap, "highAvailability", s.HighAvailability) + populate(objectMap, "importSourceProperties", s.ImportSourceProperties) populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) populate(objectMap, "network", s.Network) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) populate(objectMap, "replicaCapacity", s.ReplicaCapacity) populate(objectMap, "replicationRole", s.ReplicationRole) populateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) @@ -2034,12 +2578,18 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { case "highAvailability": err = unpopulate(val, "HighAvailability", &s.HighAvailability) delete(rawMsg, key) + case "importSourceProperties": + err = unpopulate(val, "ImportSourceProperties", &s.ImportSourceProperties) + delete(rawMsg, key) case "maintenanceWindow": err = unpopulate(val, "MaintenanceWindow", &s.MaintenanceWindow) delete(rawMsg, key) case "network": err = unpopulate(val, "Network", &s.Network) delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &s.PrivateEndpointConnections) + delete(rawMsg, key) case "replicaCapacity": err = unpopulate(val, "ReplicaCapacity", &s.ReplicaCapacity) delete(rawMsg, key) @@ -2077,6 +2627,7 @@ func (s ServerPropertiesForUpdate) MarshalJSON() ([]byte, error) { populate(objectMap, "dataEncryption", s.DataEncryption) populate(objectMap, "highAvailability", s.HighAvailability) populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) + populate(objectMap, "network", s.Network) populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "storage", s.Storage) populate(objectMap, "version", s.Version) @@ -2107,6 +2658,9 @@ func (s *ServerPropertiesForUpdate) UnmarshalJSON(data []byte) error { case "maintenanceWindow": err = unpopulate(val, "MaintenanceWindow", &s.MaintenanceWindow) delete(rawMsg, key) + case "network": + err = unpopulate(val, "Network", &s.Network) + delete(rawMsg, key) case "replicationRole": err = unpopulate(val, "ReplicationRole", &s.ReplicationRole) delete(rawMsg, key) @@ -2186,6 +2740,33 @@ func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServerVersionCapabilityV2. +func (s ServerVersionCapabilityV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVersionCapabilityV2. +func (s *ServerVersionCapabilityV2) 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 "name": + err = unpopulate(val, "Name", &s.Name) + 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 Storage. func (s Storage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2329,6 +2910,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -2352,6 +2934,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operationresults_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operationresults_client.go new file mode 100644 index 000000000000..8b930f1f19d8 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operationresults_client.go @@ -0,0 +1,101 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationResultsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationResultsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get the operation result for a long running operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - locationName - The name of the location. +// - operationID - The operation Id. +// - options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +func (client *OperationResultsClient) Get(ctx context.Context, locationName string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, locationName, operationID, options) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationResultsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, locationName string, operationID string, options *OperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/operationResults/{operationId}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { + result := OperationResultsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatusExtendedResult); err != nil { + return OperationResultsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go index 6a41d144936e..ecf3607e532e 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations. // -// Generated from API version 2021-12-01-preview +// Generated from API version 2023-06-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-12-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go deleted file mode 100644 index 0744ec661e32..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go +++ /dev/null @@ -1,223 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/ServiceOperations/preview/2021-12-01-preview/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armmysqlflexibleservers.OperationListResult{ - // Value: []*armmysqlflexibleservers.Operation{ - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules/read"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Return the list of firewall rules for a server or gets the properties for the specified firewall rule."), - // Operation: to.Ptr("List/Get Firewall Rules"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules/write"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Creates a firewall rule with the specified parameters or update an existing rule."), - // Operation: to.Ptr("Create/Update Firewall Rule"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/firewallRules/delete"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Deletes an existing firewall rule."), - // Operation: to.Ptr("Delete Firewall Rule"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/read"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Return the list of servers or gets the properties for the specified server."), - // Operation: to.Ptr("List/Get MySQL Servers"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/write"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Creates a server with the specified parameters or update the properties or tags for the specified server."), - // Operation: to.Ptr("Create/Update MySQL Server"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/delete"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Deletes an existing server."), - // Operation: to.Ptr("Delete MySQL Server"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Return types of metrics that are available for databases"), - // Operation: to.Ptr("Get database metric definitions"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // Properties: map[string]any{ - // "serviceSpecification": map[string]any{ - // "metricSpecifications":[]any{ - // map[string]any{ - // "name": "cpu_percent", - // "aggregationType": "Average", - // "displayDescription": "CPU percent", - // "displayName": "CPU percent", - // "fillGapWithZero": true, - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "memory_percent", - // "aggregationType": "Average", - // "displayDescription": "Memory percent", - // "displayName": "Memory percent", - // "fillGapWithZero": true, - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "io_consumption_percent", - // "aggregationType": "Average", - // "displayDescription": "IO percent", - // "displayName": "IO percent", - // "fillGapWithZero": true, - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "storage_percent", - // "aggregationType": "Average", - // "displayDescription": "Storage percentage", - // "displayName": "Storage percentage", - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "storage_used", - // "aggregationType": "Average", - // "displayDescription": "Storage used", - // "displayName": "Storage used", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "storage_limit", - // "aggregationType": "Average", - // "displayDescription": "Storage limit", - // "displayName": "Storage limit", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "serverlog_storage_percent", - // "aggregationType": "Average", - // "displayDescription": "Server Log storage percent", - // "displayName": "Server Log storage percent", - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "serverlog_storage_usage", - // "aggregationType": "Average", - // "displayDescription": "Server Log storage used", - // "displayName": "Server Log storage used", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "serverlog_storage_limit", - // "aggregationType": "Average", - // "displayDescription": "Server Log storage limit", - // "displayName": "Server Log storage limit", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "active_connections", - // "aggregationType": "Average", - // "displayDescription": "Total active connections", - // "displayName": "Total active connections", - // "fillGapWithZero": true, - // "unit": "Count", - // }, - // map[string]any{ - // "name": "connections_failed", - // "aggregationType": "Average", - // "displayDescription": "Total failed connections", - // "displayName": "Total failed connections", - // "fillGapWithZero": true, - // "unit": "Count", - // }, - // map[string]any{ - // "name": "seconds_behind_master", - // "aggregationType": "Average", - // "displayDescription": "Replication lag in seconds", - // "displayName": "Replication lag in seconds", - // "fillGapWithZero": true, - // "unit": "Count", - // }, - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/providers/Microsoft.Insights/diagnosticSettings/read"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Gets the disagnostic setting for the resource"), - // Operation: to.Ptr("Read diagnostic setting"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/flexibleServers/providers/Microsoft.Insights/diagnosticSettings/write"), - // Display: &armmysqlflexibleservers.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diagnostic setting for the resource"), - // Operation: to.Ptr("Write diagnostic setting"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go new file mode 100644 index 000000000000..00667f6db929 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/options.go @@ -0,0 +1,282 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +// AzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureADAdministratorsClient.BeginCreateOrUpdate +// method. +type AzureADAdministratorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the AzureADAdministratorsClient.BeginDelete +// method. +type AzureADAdministratorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AzureADAdministratorsClientGetOptions contains the optional parameters for the AzureADAdministratorsClient.Get method. +type AzureADAdministratorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureADAdministratorsClientListByServerOptions contains the optional parameters for the AzureADAdministratorsClient.NewListByServerPager +// method. +type AzureADAdministratorsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// BackupAndExportClientBeginCreateOptions contains the optional parameters for the BackupAndExportClient.BeginCreate method. +type BackupAndExportClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupAndExportClientValidateBackupOptions contains the optional parameters for the BackupAndExportClient.ValidateBackup +// method. +type BackupAndExportClientValidateBackupOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. +type BackupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientListByServerOptions contains the optional parameters for the BackupsClient.NewListByServerPager method. +type BackupsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientPutOptions contains the optional parameters for the BackupsClient.Put method. +type BackupsClientPutOptions struct { + // placeholder for future optional parameters +} + +// CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute +// method. +type CheckNameAvailabilityClientExecuteOptions struct { + // placeholder for future optional parameters +} + +// CheckNameAvailabilityWithoutLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithoutLocationClient.Execute +// method. +type CheckNameAvailabilityWithoutLocationClientExecuteOptions struct { + // placeholder for future optional parameters +} + +// CheckVirtualNetworkSubnetUsageClientExecuteOptions contains the optional parameters for the CheckVirtualNetworkSubnetUsageClient.Execute +// method. +type CheckVirtualNetworkSubnetUsageClientExecuteOptions struct { + // placeholder for future optional parameters +} + +// ConfigurationsClientBeginBatchUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginBatchUpdate +// method. +type ConfigurationsClientBeginBatchUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate +// method. +type ConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate method. +type ConfigurationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. +type ConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager +// method. +type ConfigurationsClientListByServerOptions struct { + // The keyword of the server configuration. + Keyword *string + + // The page of the server configuration. + Page *int32 + + // The pageSize of the server configuration. + PageSize *int32 + + // The tags of the server configuration. + Tags *string +} + +// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate +// method. +type DatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. +type DatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. +type DatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager method. +type DatabasesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +type FirewallRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. +type FirewallRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +type FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager +// method. +type FirewallRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute +// method. +type GetPrivateDNSZoneSuffixClientExecuteOptions struct { + // placeholder for future optional parameters +} + +// LocationBasedCapabilitiesClientListOptions contains the optional parameters for the LocationBasedCapabilitiesClient.NewListPager +// method. +type LocationBasedCapabilitiesClientListOptions struct { + // placeholder for future optional parameters +} + +// LocationBasedCapabilitySetClientGetOptions contains the optional parameters for the LocationBasedCapabilitySetClient.Get +// method. +type LocationBasedCapabilitySetClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocationBasedCapabilitySetClientListOptions contains the optional parameters for the LocationBasedCapabilitySetClient.NewListPager +// method. +type LocationBasedCapabilitySetClientListOptions struct { + // placeholder for future optional parameters +} + +// LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager method. +type LogFilesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.NewListByServerPager method. +type ReplicasClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. +type ServersClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. +type ServersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginFailoverOptions contains the optional parameters for the ServersClient.BeginFailover method. +type ServersClientBeginFailoverOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginResetGtidOptions contains the optional parameters for the ServersClient.BeginResetGtid method. +type ServersClientBeginResetGtidOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. +type ServersClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. +type ServersClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. +type ServersClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. +type ServersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. +type ServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager +// method. +type ServersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. +type ServersClientListOptions struct { + // placeholder for future optional parameters +} + +// ServersMigrationClientBeginCutoverMigrationOptions contains the optional parameters for the ServersMigrationClient.BeginCutoverMigration +// method. +type ServersMigrationClientBeginCutoverMigrationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go index 97646202e955..a713ff6d8a6f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -26,5 +25,8 @@ func unmarshalBackupStoreDetailsClassification(rawMsg json.RawMessage) (BackupSt default: b = &BackupStoreDetails{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go index bf2d44ce5507..456472e03940 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type ReplicasClient struct { } // NewReplicasClient creates a new instance of ReplicasClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error) { @@ -46,7 +45,7 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // NewListByServerPager - List all the replicas for a given server. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.NewListByServerPager @@ -82,9 +81,6 @@ func (client *ReplicasClient) NewListByServerPager(resourceGroupName string, ser // listByServerCreateRequest creates the ListByServer request. func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ReplicasClientListByServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/replicas" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -99,7 +95,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go deleted file mode 100644 index 6cbb470187c9..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client_example_test.go +++ /dev/null @@ -1,128 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ReplicasListByServer.json -func ExampleReplicasClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicasClient().NewListByServerPager("TestGroup", "mysqltestserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armmysqlflexibleservers.ServerListResult{ - // Value: []*armmysqlflexibleservers.Server{ - // { - // Name: to.Ptr("mysqltestserver-repl"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver-repl"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T08:19:18.00+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver-repl.orcabrci-seas1-a.mscds.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleReplica), - // SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](360), - // StorageSizeGB: to.Ptr[int32](20), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("mysqltestserver-repl"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver-repl2"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-23T08:19:18.00+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver-repl2.orcabrci-seas1-a.mscds.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleReplica), - // SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](360), - // StorageSizeGB: to.Ptr[int32](20), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go index c7a96c2efc10..b8c525d7631c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go @@ -3,14 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers // AzureADAdministratorsClientCreateOrUpdateResponse contains the response from method AzureADAdministratorsClient.BeginCreateOrUpdate. type AzureADAdministratorsClientCreateOrUpdateResponse struct { + // Represents a Administrator. AzureADAdministrator } @@ -21,81 +21,97 @@ type AzureADAdministratorsClientDeleteResponse struct { // AzureADAdministratorsClientGetResponse contains the response from method AzureADAdministratorsClient.Get. type AzureADAdministratorsClientGetResponse struct { + // Represents a Administrator. AzureADAdministrator } // AzureADAdministratorsClientListByServerResponse contains the response from method AzureADAdministratorsClient.NewListByServerPager. type AzureADAdministratorsClientListByServerResponse struct { + // A List of azure ad administrators. AdministratorListResult } // BackupAndExportClientCreateResponse contains the response from method BackupAndExportClient.BeginCreate. type BackupAndExportClientCreateResponse struct { + // Represents BackupAndExport API Response BackupAndExportResponse } // BackupAndExportClientValidateBackupResponse contains the response from method BackupAndExportClient.ValidateBackup. type BackupAndExportClientValidateBackupResponse struct { + // Represents ValidateBackup API Response ValidateBackupResponse } // BackupsClientGetResponse contains the response from method BackupsClient.Get. type BackupsClientGetResponse struct { + // Server backup properties ServerBackup } // BackupsClientListByServerResponse contains the response from method BackupsClient.NewListByServerPager. type BackupsClientListByServerResponse struct { + // A list of server backups. ServerBackupListResult } // BackupsClientPutResponse contains the response from method BackupsClient.Put. type BackupsClientPutResponse struct { + // Server backup properties ServerBackup } // CheckNameAvailabilityClientExecuteResponse contains the response from method CheckNameAvailabilityClient.Execute. type CheckNameAvailabilityClientExecuteResponse struct { + // Represents a resource name availability. NameAvailability } // CheckNameAvailabilityWithoutLocationClientExecuteResponse contains the response from method CheckNameAvailabilityWithoutLocationClient.Execute. type CheckNameAvailabilityWithoutLocationClientExecuteResponse struct { + // Represents a resource name availability. NameAvailability } // CheckVirtualNetworkSubnetUsageClientExecuteResponse contains the response from method CheckVirtualNetworkSubnetUsageClient.Execute. type CheckVirtualNetworkSubnetUsageClientExecuteResponse struct { + // Virtual network subnet usage data. VirtualNetworkSubnetUsageResult } // ConfigurationsClientBatchUpdateResponse contains the response from method ConfigurationsClient.BeginBatchUpdate. type ConfigurationsClientBatchUpdateResponse struct { + // A list of server configurations. ConfigurationListResult } // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { + // Represents a Configuration. Configuration } // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { + // Represents a Configuration. Configuration } // ConfigurationsClientListByServerResponse contains the response from method ConfigurationsClient.NewListByServerPager. type ConfigurationsClientListByServerResponse struct { + // A list of server configurations. ConfigurationListResult } // ConfigurationsClientUpdateResponse contains the response from method ConfigurationsClient.BeginUpdate. type ConfigurationsClientUpdateResponse struct { + // Represents a Configuration. Configuration } // DatabasesClientCreateOrUpdateResponse contains the response from method DatabasesClient.BeginCreateOrUpdate. type DatabasesClientCreateOrUpdateResponse struct { + // Represents a Database. Database } @@ -106,16 +122,19 @@ type DatabasesClientDeleteResponse struct { // DatabasesClientGetResponse contains the response from method DatabasesClient.Get. type DatabasesClientGetResponse struct { + // Represents a Database. Database } // DatabasesClientListByServerResponse contains the response from method DatabasesClient.NewListByServerPager. type DatabasesClientListByServerResponse struct { + // A List of databases. DatabaseListResult } // FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.BeginCreateOrUpdate. type FirewallRulesClientCreateOrUpdateResponse struct { + // Represents a server firewall rule. FirewallRule } @@ -126,41 +145,67 @@ type FirewallRulesClientDeleteResponse struct { // FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. type FirewallRulesClientGetResponse struct { + // Represents a server firewall rule. FirewallRule } // FirewallRulesClientListByServerResponse contains the response from method FirewallRulesClient.NewListByServerPager. type FirewallRulesClientListByServerResponse struct { + // A list of firewall rules. FirewallRuleListResult } // GetPrivateDNSZoneSuffixClientExecuteResponse contains the response from method GetPrivateDNSZoneSuffixClient.Execute. type GetPrivateDNSZoneSuffixClientExecuteResponse struct { + // The response of get private dns zone suffix. GetPrivateDNSZoneSuffixResponse } // LocationBasedCapabilitiesClientListResponse contains the response from method LocationBasedCapabilitiesClient.NewListPager. type LocationBasedCapabilitiesClientListResponse struct { + // location capability CapabilitiesListResult } +// LocationBasedCapabilitySetClientGetResponse contains the response from method LocationBasedCapabilitySetClient.Get. +type LocationBasedCapabilitySetClientGetResponse struct { + // Represents a location capability set. + Capability +} + +// LocationBasedCapabilitySetClientListResponse contains the response from method LocationBasedCapabilitySetClient.NewListPager. +type LocationBasedCapabilitySetClientListResponse struct { + // location capability set + CapabilitySetsList +} + // LogFilesClientListByServerResponse contains the response from method LogFilesClient.NewListByServerPager. type LogFilesClientListByServerResponse struct { + // A List of logFiles. LogFileListResult } +// OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. +type OperationResultsClientGetResponse struct { + // Represents Operation Results API Response + OperationStatusExtendedResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of resource provider operations. OperationListResult } // ReplicasClientListByServerResponse contains the response from method ReplicasClient.NewListByServerPager. type ReplicasClientListByServerResponse struct { + // A list of servers. ServerListResult } // ServersClientCreateResponse contains the response from method ServersClient.BeginCreate. type ServersClientCreateResponse struct { + // Represents a server. Server } @@ -176,16 +221,19 @@ type ServersClientFailoverResponse struct { // ServersClientGetResponse contains the response from method ServersClient.Get. type ServersClientGetResponse struct { + // Represents a server. Server } // ServersClientListByResourceGroupResponse contains the response from method ServersClient.NewListByResourceGroupPager. type ServersClientListByResourceGroupResponse struct { + // A list of servers. ServerListResult } // ServersClientListResponse contains the response from method ServersClient.NewListPager. type ServersClientListResponse struct { + // A list of servers. ServerListResult } @@ -211,5 +259,12 @@ type ServersClientStopResponse struct { // ServersClientUpdateResponse contains the response from method ServersClient.BeginUpdate. type ServersClientUpdateResponse struct { + // Represents a server. + Server +} + +// ServersMigrationClientCutoverMigrationResponse contains the response from method ServersMigrationClient.BeginCutoverMigration. +type ServersMigrationClientCutoverMigrationResponse struct { + // Represents a server. Server } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go index 19cac3c35e4f..55be7bcb77d5 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers @@ -29,7 +28,7 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServersClient, error) { @@ -47,7 +46,7 @@ func NewServersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a new server or updates an existing server. The update action will overwrite the existing server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for creating or updating a server. @@ -58,7 +57,8 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -67,28 +67,27 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a new server or updates an existing server. The update action will overwrite the existing server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters Server, options *ServersClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters Server, options *ServersClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -103,16 +102,19 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. @@ -122,9 +124,10 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -133,28 +136,27 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -169,7 +171,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +180,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr // BeginFailover - Manual failover a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginFailoverOptions contains the optional parameters for the ServersClient.BeginFailover method. @@ -188,7 +190,8 @@ func (client *ServersClient) BeginFailover(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[ServersClientFailoverResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientFailoverResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientFailoverResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -197,28 +200,27 @@ func (client *ServersClient) BeginFailover(ctx context.Context, resourceGroupNam // Failover - Manual failover a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) failover(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginFailoverOptions) (*http.Response, error) { + var err error req, err := client.failoverCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverCreateRequest creates the Failover request. func (client *ServersClient) failoverCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/failover" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -233,7 +235,7 @@ func (client *ServersClient) failoverCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,31 +244,31 @@ func (client *ServersClient) failoverCreateRequest(ctx context.Context, resource // Get - Gets information about a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. func (client *ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientGetOptions) (ServersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -281,7 +283,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -298,7 +300,7 @@ func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClie // NewListPager - List all the servers in a given subscription. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - options - ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. func (client *ServersClient) NewListPager(options *ServersClientListOptions) *runtime.Pager[ServersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServersClientListResponse]{ @@ -331,16 +333,13 @@ func (client *ServersClient) NewListPager(options *ServersClientListOptions) *ru // listCreateRequest creates the List request. func (client *ServersClient) listCreateRequest(ctx context.Context, options *ServersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/flexibleServers" - 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -357,7 +356,7 @@ func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersCli // NewListByResourceGroupPager - List all the servers in a given resource group. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager // method. @@ -392,9 +391,6 @@ func (client *ServersClient) NewListByResourceGroupPager(resourceGroupName strin // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServersClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -405,7 +401,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -423,7 +419,7 @@ func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Respon // BeginResetGtid - Resets GTID on a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for resetting GTID on a server. @@ -434,9 +430,10 @@ func (client *ServersClient) BeginResetGtid(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientResetGtidResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientResetGtidResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientResetGtidResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -445,28 +442,27 @@ func (client *ServersClient) BeginResetGtid(ctx context.Context, resourceGroupNa // ResetGtid - Resets GTID on a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) resetGtid(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*http.Response, error) { + var err error req, err := client.resetGtidCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // resetGtidCreateRequest creates the ResetGtid request. func (client *ServersClient) resetGtidCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/resetGtid" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -481,16 +477,19 @@ func (client *ServersClient) resetGtidCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginRestart - Restarts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for restarting a server. @@ -501,7 +500,8 @@ func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientRestartResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientRestartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -510,28 +510,27 @@ func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName // Restart - Restarts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) restart(ctx context.Context, resourceGroupName string, serverName string, parameters ServerRestartParameter, options *ServersClientBeginRestartOptions) (*http.Response, error) { + var err error req, err := client.restartCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // restartCreateRequest creates the Restart request. func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ServerRestartParameter, options *ServersClientBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/restart" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -546,16 +545,19 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginStart - Starts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. @@ -565,7 +567,8 @@ func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[ServersClientStartResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientStartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -574,28 +577,27 @@ func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName s // Start - Starts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) start(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/start" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -610,7 +612,7 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -619,7 +621,7 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro // BeginStop - Stops a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - options - ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. @@ -629,7 +631,8 @@ func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller[ServersClientStopResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientStopResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -638,28 +641,27 @@ func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName st // Stop - Stops a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) stop(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (*http.Response, error) { + var err error req, err := client.stopCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // stopCreateRequest creates the Stop request. func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/stop" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -674,7 +676,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -684,7 +686,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou // server definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - serverName - The name of the server. // - parameters - The required parameters for updating a server. @@ -695,7 +697,8 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -705,28 +708,27 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName // definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-30-preview +// Generated from API version 2023-06-01-preview func (client *ServersClient) update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForUpdate, options *ServersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForUpdate, options *ServersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -741,8 +743,11 @@ func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-30-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go deleted file mode 100644 index b70434c0d8e3..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go +++ /dev/null @@ -1,1238 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysqlflexibleservers_test - -import ( - "context" - "log" - - "time" - - "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/mysql/armmysqlflexibleservers/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreate.json -func ExampleServersClient_BeginCreate_createANewServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.Server{ - Location: to.Ptr("southeastasia"), - Tags: map[string]*string{ - "num": to.Ptr("1"), - }, - Properties: &armmysqlflexibleservers.ServerProperties{ - AdministratorLogin: to.Ptr("cloudsa"), - AdministratorLoginPassword: to.Ptr("your_password"), - AvailabilityZone: to.Ptr("1"), - Backup: &armmysqlflexibleservers.Backup{ - BackupRetentionDays: to.Ptr[int32](7), - GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - }, - CreateMode: to.Ptr(armmysqlflexibleservers.CreateModeDefault), - HighAvailability: &armmysqlflexibleservers.HighAvailability{ - Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeZoneRedundant), - StandbyAvailabilityZone: to.Ptr("3"), - }, - Storage: &armmysqlflexibleservers.Storage{ - AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - Iops: to.Ptr[int32](600), - StorageSizeGB: to.Ptr[int32](100), - }, - Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - }, - SKU: &armmysqlflexibleservers.SKU{ - Name: to.Ptr("Standard_D2ds_v4"), - Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeZoneRedundant), - // StandbyAvailabilityZone: to.Ptr("3"), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateHealthy), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateReplica.json -func ExampleServersClient_BeginCreate_createAReplicaServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "testgr", "replica-server", armmysqlflexibleservers.Server{ - Location: to.Ptr("SoutheastAsia"), - Properties: &armmysqlflexibleservers.ServerProperties{ - CreateMode: to.Ptr(armmysqlflexibleservers.CreateModeReplica), - SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("replica-server"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/replica-server"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("3"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T08:19:18.5729164+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("replica-server.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleReplica), - // SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testgr/providers/Microsoft.DBforMySQL/flexibleServers/source-server"), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](360), - // StorageSizeGB: to.Ptr[int32](20), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateWithPointInTimeRestore.json -func ExampleServersClient_BeginCreate_createAServerAsAPointInTimeRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armmysqlflexibleservers.Server{ - Location: to.Ptr("SoutheastAsia"), - Tags: map[string]*string{ - "num": to.Ptr("1"), - }, - Properties: &armmysqlflexibleservers.ServerProperties{ - CreateMode: to.Ptr(armmysqlflexibleservers.CreateModePointInTimeRestore), - RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T00:00:37.467Z"); return t }()), - SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/sourceserver"), - }, - SKU: &armmysqlflexibleservers.SKU{ - Name: to.Ptr("Standard_D14_v2"), - Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("targetserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/flexibleServers/targetserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("adminuser"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T00:15:24.00+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("targetserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](360), - // StorageSizeGB: to.Ptr[int32](20), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerCreateWithBYOK.json -func ExampleServersClient_BeginCreate_createAServerWithByok() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.Server{ - Location: to.Ptr("southeastasia"), - Tags: map[string]*string{ - "num": to.Ptr("1"), - }, - Identity: &armmysqlflexibleservers.Identity{ - Type: to.Ptr(armmysqlflexibleservers.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]any{ - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": map[string]any{}, - }, - }, - Properties: &armmysqlflexibleservers.ServerProperties{ - AdministratorLogin: to.Ptr("cloudsa"), - AdministratorLoginPassword: to.Ptr("your_password"), - AvailabilityZone: to.Ptr("1"), - Backup: &armmysqlflexibleservers.Backup{ - BackupRetentionDays: to.Ptr[int32](7), - GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - }, - CreateMode: to.Ptr(armmysqlflexibleservers.CreateModeDefault), - DataEncryption: &armmysqlflexibleservers.DataEncryption{ - Type: to.Ptr(armmysqlflexibleservers.DataEncryptionTypeAzureKeyVault), - GeoBackupKeyURI: to.Ptr("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"), - GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity"), - PrimaryKeyURI: to.Ptr("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"), - PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity"), - }, - HighAvailability: &armmysqlflexibleservers.HighAvailability{ - Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeZoneRedundant), - StandbyAvailabilityZone: to.Ptr("3"), - }, - Storage: &armmysqlflexibleservers.Storage{ - AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - Iops: to.Ptr[int32](600), - StorageSizeGB: to.Ptr[int32](100), - }, - Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - }, - SKU: &armmysqlflexibleservers.SKU{ - Name: to.Ptr("Standard_D2ds_v4"), - Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeZoneRedundant), - // StandbyAvailabilityZone: to.Ptr("3"), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateHealthy), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdate.json -func ExampleServersClient_BeginUpdate_updateAServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{ - Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{ - Storage: &armmysqlflexibleservers.Storage{ - AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - Iops: to.Ptr[int32](200), - StorageSizeGB: to.Ptr[int32](30), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("3"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Enabled"), - // DayOfWeek: to.Ptr[int32](1), - // StartHour: to.Ptr[int32](1), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // Iops: to.Ptr[int32](200), - // StorageSizeGB: to.Ptr[int32](30), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json -func ExampleServersClient_BeginUpdate_updateServerCustomerMaintenanceWindow() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{ - Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{ - MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - CustomWindow: to.Ptr("Enabled"), - DayOfWeek: to.Ptr[int32](1), - StartHour: to.Ptr[int32](8), - StartMinute: to.Ptr[int32](0), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("3"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Enabled"), - // DayOfWeek: to.Ptr[int32](1), - // StartHour: to.Ptr[int32](8), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerUpdateWithBYOK.json -func ExampleServersClient_BeginUpdate_updateServerWithByok() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestserver", armmysqlflexibleservers.ServerForUpdate{ - Identity: &armmysqlflexibleservers.Identity{ - Type: to.Ptr(armmysqlflexibleservers.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]any{ - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity": map[string]any{}, - }, - }, - Properties: &armmysqlflexibleservers.ServerPropertiesForUpdate{ - DataEncryption: &armmysqlflexibleservers.DataEncryption{ - Type: to.Ptr(armmysqlflexibleservers.DataEncryptionTypeAzureKeyVault), - GeoBackupKeyURI: to.Ptr("https://test-geo.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"), - GeoBackupUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-identity"), - PrimaryKeyURI: to.Ptr("https://test.vault.azure.net/keys/key/c8a92236622244c0a4fdb892666f671a"), - PrimaryUserAssignedIdentityID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-identity"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeZoneRedundant), - // StandbyAvailabilityZone: to.Ptr("3"), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateHealthy), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerDelete.json -func ExampleServersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginDelete(ctx, "TestGroup", "testserver", 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGet.json -func ExampleServersClient_Get_getAServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().Get(ctx, "testrg", "mysqltestserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("3"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Enabled"), - // DayOfWeek: to.Ptr[int32](1), - // StartHour: to.Ptr[int32](1), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // AutoIoScaling: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerGetWithVnet.json -func ExampleServersClient_Get_getAServerWithVnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().Get(ctx, "testrg", "mysqltestserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysqlflexibleservers.Server{ - // Name: to.Ptr("mysqltestserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("3"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T06:11:38.4150019+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // DelegatedSubnetResourceID: to.Ptr("/subscriptions/2941a09d-7bcf-42fe-91ca-1765f521c829/resourceGroups/OrcabrCI-Vnet-Resource-Group/providers/Microsoft.Network/virtualNetworks/OrcabrCI-Vnet/subnets/mysql-subnet"), - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_D2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServersListByResourceGroup.json -func ExampleServersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListByResourceGroupPager("TestGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armmysqlflexibleservers.ServerListResult{ - // Value: []*armmysqlflexibleservers.Server{ - // { - // Name: to.Ptr("mysqltestserver1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver1"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T07:08:17.4259886+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver1.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](369), - // StorageSizeGB: to.Ptr[int32](23), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_B1ms"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierBurstable), - // }, - // }, - // { - // Name: to.Ptr("mysqltestserver2"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver2"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("2"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T07:08:17.4259886+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver2.mysql.database.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](369), - // StorageSizeGB: to.Ptr[int32](23), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_B1ms"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierBurstable), - // }, - // }, - // { - // Name: to.Ptr("mysqltestserver3"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver3"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T06:28:19.0611667+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver3.mysql.database.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_E2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierMemoryOptimized), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServersList.json -func ExampleServersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armmysqlflexibleservers.ServerListResult{ - // Value: []*armmysqlflexibleservers.Server{ - // { - // Name: to.Ptr("mysqltestserver1"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver1"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T07:08:17.4259886+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver1.database.mysql.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](369), - // StorageSizeGB: to.Ptr[int32](23), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_B1ms"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierBurstable), - // }, - // }, - // { - // Name: to.Ptr("mysqltestserver2"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup2/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver2"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("2"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-17T07:08:17.4259886+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver2.mysql.database.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](369), - // StorageSizeGB: to.Ptr[int32](23), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_B1ms"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierBurstable), - // }, - // }, - // { - // Name: to.Ptr("mysqltestserver3"), - // Type: to.Ptr("Microsoft.DBforMySQL/flexibleServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup3/providers/Microsoft.DBforMySQL/flexibleServers/mysqltestserver3"), - // Location: to.Ptr("Southeast Asia"), - // Tags: map[string]*string{ - // "num": to.Ptr("1"), - // }, - // Properties: &armmysqlflexibleservers.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // AvailabilityZone: to.Ptr("1"), - // Backup: &armmysqlflexibleservers.Backup{ - // BackupRetentionDays: to.Ptr[int32](7), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-24T06:28:19.0611667+00:00"); return t}()), - // GeoRedundantBackup: to.Ptr(armmysqlflexibleservers.EnableStatusEnumDisabled), - // }, - // FullyQualifiedDomainName: to.Ptr("mysqltestserver3.mysql.database.azure.com"), - // HighAvailability: &armmysqlflexibleservers.HighAvailability{ - // Mode: to.Ptr(armmysqlflexibleservers.HighAvailabilityModeDisabled), - // State: to.Ptr(armmysqlflexibleservers.HighAvailabilityStateNotEnabled), - // }, - // MaintenanceWindow: &armmysqlflexibleservers.MaintenanceWindow{ - // CustomWindow: to.Ptr("Disabled"), - // DayOfWeek: to.Ptr[int32](0), - // StartHour: to.Ptr[int32](0), - // StartMinute: to.Ptr[int32](0), - // }, - // Network: &armmysqlflexibleservers.Network{ - // PublicNetworkAccess: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // }, - // ReplicaCapacity: to.Ptr[int32](10), - // ReplicationRole: to.Ptr(armmysqlflexibleservers.ReplicationRoleNone), - // State: to.Ptr(armmysqlflexibleservers.ServerStateReady), - // Storage: &armmysqlflexibleservers.Storage{ - // AutoGrow: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - // Iops: to.Ptr[int32](600), - // StorageSizeGB: to.Ptr[int32](100), - // StorageSKU: to.Ptr("Premium_LRS"), - // }, - // Version: to.Ptr(armmysqlflexibleservers.ServerVersionFive7), - // }, - // SKU: &armmysqlflexibleservers.SKU{ - // Name: to.Ptr("Standard_E2ds_v4"), - // Tier: to.Ptr(armmysqlflexibleservers.SKUTierMemoryOptimized), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerFailover.json -func ExampleServersClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginFailover(ctx, "TestGroup", "testserver", 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerRestart.json -func ExampleServersClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginRestart(ctx, "TestGroup", "testserver", armmysqlflexibleservers.ServerRestartParameter{ - MaxFailoverSeconds: to.Ptr[int32](60), - RestartWithFailover: to.Ptr(armmysqlflexibleservers.EnableStatusEnumEnabled), - }, 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerStart.json -func ExampleServersClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginStart(ctx, "TestGroup", "testserver", 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerStop.json -func ExampleServersClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginStop(ctx, "TestGroup", "testserver", 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/blob/17aa6a1314de5aafef059d9aa2229901df506e75/specification/mysql/resource-manager/Microsoft.DBforMySQL/FlexibleServers/preview/2022-09-30-preview/examples/ServerResetGtid.json -func ExampleServersClient_BeginResetGtid() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysqlflexibleservers.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginResetGtid(ctx, "TestGroup", "testserver", armmysqlflexibleservers.ServerGtidSetParameter{ - GtidSet: to.Ptr("4aff5b51-97ba-11ed-a955-002248036acc:1-16"), - }, 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) - } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/serversmigration_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/serversmigration_client.go new file mode 100644 index 000000000000..d9637fc608c9 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/serversmigration_client.go @@ -0,0 +1,111 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// ServersMigrationClient contains the methods for the ServersMigration group. +// Don't use this type directly, use NewServersMigrationClient() instead. +type ServersMigrationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewServersMigrationClient creates a new instance of ServersMigrationClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewServersMigrationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServersMigrationClient, error) { + cl, err := arm.NewClient(moduleName+".ServersMigrationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ServersMigrationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCutoverMigration - Cutover migration for MySQL import, it will switch source elastic server DNS to flexible server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - serverName - The name of the server. +// - options - ServersMigrationClientBeginCutoverMigrationOptions contains the optional parameters for the ServersMigrationClient.BeginCutoverMigration +// method. +func (client *ServersMigrationClient) BeginCutoverMigration(ctx context.Context, resourceGroupName string, serverName string, options *ServersMigrationClientBeginCutoverMigrationOptions) (*runtime.Poller[ServersMigrationClientCutoverMigrationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cutoverMigration(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersMigrationClientCutoverMigrationResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ServersMigrationClientCutoverMigrationResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CutoverMigration - Cutover migration for MySQL import, it will switch source elastic server DNS to flexible server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *ServersMigrationClient) cutoverMigration(ctx context.Context, resourceGroupName string, serverName string, options *ServersMigrationClientBeginCutoverMigrationOptions) (*http.Response, error) { + var err error + req, err := client.cutoverMigrationCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// cutoverMigrationCreateRequest creates the CutoverMigration request. +func (client *ServersMigrationClient) cutoverMigrationCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ServersMigrationClientBeginCutoverMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/flexibleServers/{serverName}/cutoverMigration" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/time_rfc3339.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/time_rfc3339.go index c8379cd58840..4873660746ef 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/time_rfc3339.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysqlflexibleservers