From 90a4997fe419f6762c8fc9c40bfec3ea1ef067c7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 23 Apr 2023 03:19:11 +0000 Subject: [PATCH] CodeGen from PR 23623 in Azure/azure-rest-api-specs Merge 2614fe6e955fbc68de14e79de5916220ddbd8e97 into 7a65f22cf67826187f75981e914c7e679039257b --- .../armmysqlflexibleservers/CHANGELOG.md | 57 + .../mysql/armmysqlflexibleservers/autorest.md | 6 +- .../azureadadministrators_client.go | 321 +++++ .../backupandexport_client.go | 171 +++ .../armmysqlflexibleservers/backups_client.go | 70 +- .../backups_client_example_test.go | 186 --- .../checknameavailability_client.go | 4 +- ...ecknameavailability_client_example_test.go | 47 - ...knameavailabilitywithoutlocation_client.go | 94 ++ .../checkvirtualnetworksubnetusage_client.go | 4 +- ...lnetworksubnetusage_client_example_test.go | 52 - .../armmysqlflexibleservers/client_factory.go | 40 +- .../configurations_client.go | 104 +- .../configurations_client_example_test.go | 329 ----- .../armmysqlflexibleservers/constants.go | 105 +- .../databases_client.go | 20 +- .../databases_client_example_test.go | 153 --- .../firewallrules_client.go | 20 +- .../firewallrules_client_example_test.go | 153 --- .../getprivatednszonesuffix_client.go | 4 +- ...rivatednszonesuffix_client_example_test.go | 41 - .../mysql/armmysqlflexibleservers/go.mod | 16 +- .../mysql/armmysqlflexibleservers/go.sum | 22 +- .../locationbasedcapabilities_client.go | 4 +- ...onbasedcapabilities_client_example_test.go | 1138 ---------------- .../logfiles_client.go | 115 ++ .../mysql/armmysqlflexibleservers/models.go | 311 ++++- .../armmysqlflexibleservers/models_serde.go | 598 +++++++- .../operations_client.go | 4 +- .../operations_client_example_test.go | 223 --- .../polymorphic_helpers.go | 30 + .../replicas_client.go | 4 +- .../replicas_client_example_test.go | 128 -- .../armmysqlflexibleservers/response_types.go | 55 + .../armmysqlflexibleservers/servers_client.go | 125 +- .../servers_client_example_test.go | 1212 ----------------- 36 files changed, 2177 insertions(+), 3789 deletions(-) create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.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 create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.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 delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go delete mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.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 diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md index 2b9163d36704..d7a70682cc44 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md @@ -1,5 +1,62 @@ # Release History +## 2.0.0-beta.1 (2023-04-23) +### Breaking Changes + +- Type of `Identity.Type` has been changed from `*string` to `*ManagedServiceIdentityType` + +### Features Added + +- New enum type `AdministratorName` with values `AdministratorNameActiveDirectory` +- New enum type `AdministratorType` with values `AdministratorTypeActiveDirectory` +- New enum type `BackupFormat` with values `BackupFormatCollatedFormat`, `BackupFormatNone` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeUserAssigned` +- New enum type `OperationStatus` with values `OperationStatusCancelInProgress`, `OperationStatusCanceled`, `OperationStatusFailed`, `OperationStatusInProgress`, `OperationStatusPending`, `OperationStatusSucceeded` +- New enum type `ResetAllToDefault` with values `ResetAllToDefaultFalse`, `ResetAllToDefaultTrue` +- New function `NewAzureADAdministratorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AzureADAdministratorsClient, error)` +- New function `*AzureADAdministratorsClient.BeginCreateOrUpdate(context.Context, string, string, AdministratorName, AzureADAdministrator, *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureADAdministratorsClientCreateOrUpdateResponse], error)` +- New function `*AzureADAdministratorsClient.BeginDelete(context.Context, string, string, AdministratorName, *AzureADAdministratorsClientBeginDeleteOptions) (*runtime.Poller[AzureADAdministratorsClientDeleteResponse], error)` +- New function `*AzureADAdministratorsClient.Get(context.Context, string, string, AdministratorName, *AzureADAdministratorsClientGetOptions) (AzureADAdministratorsClientGetResponse, error)` +- New function `*AzureADAdministratorsClient.NewListByServerPager(string, string, *AzureADAdministratorsClientListByServerOptions) *runtime.Pager[AzureADAdministratorsClientListByServerResponse]` +- New function `NewBackupAndExportClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupAndExportClient, error)` +- New function `*BackupAndExportClient.BeginCreate(context.Context, string, string, BackupAndExportRequest, *BackupAndExportClientBeginCreateOptions) (*runtime.Poller[BackupAndExportClientCreateResponse], error)` +- New function `*BackupAndExportClient.ValidateBackup(context.Context, string, string, *BackupAndExportClientValidateBackupOptions) (BackupAndExportClientValidateBackupResponse, error)` +- New function `*BackupStoreDetails.GetBackupStoreDetails() *BackupStoreDetails` +- New function `*BackupsClient.Put(context.Context, string, string, string, *BackupsClientPutOptions) (BackupsClientPutResponse, error)` +- New function `NewCheckNameAvailabilityWithoutLocationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CheckNameAvailabilityWithoutLocationClient, error)` +- New function `*CheckNameAvailabilityWithoutLocationClient.Execute(context.Context, NameAvailabilityRequest, *CheckNameAvailabilityWithoutLocationClientExecuteOptions) (CheckNameAvailabilityWithoutLocationClientExecuteResponse, error)` +- New function `*ClientFactory.NewAzureADAdministratorsClient() *AzureADAdministratorsClient` +- New function `*ClientFactory.NewBackupAndExportClient() *BackupAndExportClient` +- New function `*ClientFactory.NewCheckNameAvailabilityWithoutLocationClient() *CheckNameAvailabilityWithoutLocationClient` +- New function `*ClientFactory.NewLogFilesClient() *LogFilesClient` +- New function `*ConfigurationsClient.BeginCreateOrUpdate(context.Context, string, string, string, Configuration, *ConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConfigurationsClientCreateOrUpdateResponse], error)` +- New function `*FullBackupStoreDetails.GetBackupStoreDetails() *BackupStoreDetails` +- New function `NewLogFilesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LogFilesClient, error)` +- New function `*LogFilesClient.NewListByServerPager(string, string, *LogFilesClientListByServerOptions) *runtime.Pager[LogFilesClientListByServerResponse]` +- New function `*ServersClient.BeginResetGtid(context.Context, string, string, ServerGtidSetParameter, *ServersClientBeginResetGtidOptions) (*runtime.Poller[ServersClientResetGtidResponse], error)` +- New struct `AdministratorListResult` +- New struct `AdministratorProperties` +- New struct `AzureADAdministrator` +- New struct `BackupAndExportRequest` +- New struct `BackupAndExportResponse` +- New struct `BackupAndExportResponseProperties` +- New struct `BackupRequestBase` +- New struct `BackupSettings` +- New struct `FullBackupStoreDetails` +- New struct `LogFile` +- New struct `LogFileListResult` +- New struct `LogFileProperties` +- New struct `ServerGtidSetParameter` +- New struct `ValidateBackupResponse` +- New struct `ValidateBackupResponseProperties` +- New field `ResetAllToDefault` in struct `ConfigurationListForBatchUpdate` +- New field `CurrentValue`, `DocumentationLink` in struct `ConfigurationProperties` +- New field `Keyword`, `Page`, `PageSize`, `Tags` in struct `ConfigurationsClientListByServerOptions` +- New field `Version` in struct `ServerPropertiesForUpdate` +- New field `AutoIoScaling`, `LogOnDisk` in struct `Storage` +- New field `Location`, `SubscriptionID` in struct `VirtualNetworkSubnetUsageResult` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md index 7888d98c079f..388f0ea76030 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/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: 1.1.1 +module-version: 2.0.0-beta.1 package-flexibleservers: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go new file mode 100644 index 000000000000..3bf0e8ec7506 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/azureadadministrators_client.go @@ -0,0 +1,321 @@ +//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 + +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" +) + +// AzureADAdministratorsClient contains the methods for the AzureADAdministrators group. +// Don't use this type directly, use NewAzureADAdministratorsClient() instead. +type AzureADAdministratorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAzureADAdministratorsClient creates a new instance of AzureADAdministratorsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - 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) { + cl, err := arm.NewClient(moduleName+".AzureADAdministratorsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AzureADAdministratorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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. +// - parameters - The required parameters for creating or updating an aad administrator. +// - options - AzureADAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureADAdministratorsClient.BeginCreateOrUpdate +// method. +func (client *AzureADAdministratorsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AzureADAdministratorsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, administratorName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[AzureADAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[AzureADAdministratorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 +func (client *AzureADAdministratorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, parameters AzureADAdministrator, options *AzureADAdministratorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, administratorName, parameters, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, 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") + } + 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)) + if administratorName == "" { + return nil, errors.New("parameter administratorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{administratorName}", url.PathEscape(string(administratorName))) + req, err := runtime.NewRequest(ctx, http.MethodPut, 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes an Azure AD Administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-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 - AzureADAdministratorsClientBeginDeleteOptions contains the optional parameters for the AzureADAdministratorsClient.BeginDelete +// method. +func (client *AzureADAdministratorsClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*runtime.Poller[AzureADAdministratorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, administratorName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureADAdministratorsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AzureADAdministratorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes an Azure AD Administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +func (client *AzureADAdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, administratorName AdministratorName, options *AzureADAdministratorsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, 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") + } + 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)) + if administratorName == "" { + return nil, errors.New("parameter administratorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{administratorName}", url.PathEscape(string(administratorName))) + req, err := runtime.NewRequest(ctx, http.MethodDelete, 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// 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 +// - 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) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, administratorName, options) + if err != nil { + return AzureADAdministratorsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureADAdministratorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureADAdministratorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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") + } + 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)) + if administratorName == "" { + return nil, errors.New("parameter administratorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{administratorName}", url.PathEscape(string(administratorName))) + 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", "2021-12-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 *AzureADAdministratorsClient) getHandleResponse(resp *http.Response) (AzureADAdministratorsClientGetResponse, error) { + result := AzureADAdministratorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureADAdministrator); err != nil { + return AzureADAdministratorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerPager - List all the AAD administrators in a given server. +// +// Generated from API version 2021-12-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 +// method. +func (client *AzureADAdministratorsClient) NewListByServerPager(resourceGroupName string, serverName string, options *AzureADAdministratorsClientListByServerOptions) *runtime.Pager[AzureADAdministratorsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureADAdministratorsClientListByServerResponse]{ + More: func(page AzureADAdministratorsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureADAdministratorsClientListByServerResponse) (AzureADAdministratorsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureADAdministratorsClientListByServerResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AzureADAdministratorsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureADAdministratorsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// 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") + } + 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.MethodGet, 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *AzureADAdministratorsClient) listByServerHandleResponse(resp *http.Response) (AzureADAdministratorsClientListByServerResponse, error) { + result := AzureADAdministratorsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdministratorListResult); err != nil { + return AzureADAdministratorsClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go new file mode 100644 index 000000000000..f04049aefa06 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backupandexport_client.go @@ -0,0 +1,171 @@ +//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 + +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" +) + +// BackupAndExportClient contains the methods for the BackupAndExport group. +// Don't use this type directly, use NewBackupAndExportClient() instead. +type BackupAndExportClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBackupAndExportClient creates a new instance of BackupAndExportClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - 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) { + cl, err := arm.NewClient(moduleName+".BackupAndExportClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupAndExportClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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. +// - options - BackupAndExportClientBeginCreateOptions contains the optional parameters for the BackupAndExportClient.BeginCreate +// method. +func (client *BackupAndExportClient) BeginCreate(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*runtime.Poller[BackupAndExportClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupAndExportClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[BackupAndExportClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 +func (client *BackupAndExportClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters BackupAndExportRequest, options *BackupAndExportClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, 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") + } + 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", "2022-09-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// 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 +// - 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) { + req, err := client.validateBackupCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return BackupAndExportClientValidateBackupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupAndExportClientValidateBackupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupAndExportClientValidateBackupResponse{}, runtime.NewResponseError(resp) + } + return client.validateBackupHandleResponse(resp) +} + +// 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") + } + 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", "2022-09-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// validateBackupHandleResponse handles the ValidateBackup response. +func (client *BackupAndExportClient) validateBackupHandleResponse(resp *http.Response) (BackupAndExportClientValidateBackupResponse, error) { + result := BackupAndExportClientValidateBackupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ValidateBackupResponse); err != nil { + return BackupAndExportClientValidateBackupResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go index 5287b47d89c1..045ac801865f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client.go @@ -47,7 +47,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -91,7 +91,7 @@ func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +108,7 @@ func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsClie // NewListByServerPager - List all the backups for a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-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 @@ -161,7 +161,7 @@ func (client *BackupsClient) listByServerCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,3 +175,65 @@ func (client *BackupsClient) listByServerHandleResponse(resp *http.Response) (Ba } return result, nil } + +// 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 +// - 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) { + req, err := client.putCreateRequest(ctx, resourceGroupName, serverName, backupName, options) + if err != nil { + return BackupsClientPutResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupsClientPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsClientPutResponse{}, runtime.NewResponseError(resp) + } + return client.putHandleResponse(resp) +} + +// 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") + } + 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)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *BackupsClient) putHandleResponse(resp *http.Response) (BackupsClientPutResponse, error) { + result := BackupsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerBackup); err != nil { + return BackupsClientPutResponse{}, err + } + return result, 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 862667091e36..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/backups_client_example_test.go +++ /dev/null @@ -1,186 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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 c32a3a9e1648..6b5adcb75442 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailability_client.go @@ -47,7 +47,7 @@ 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-05-01 +// Generated from API version 2021-12-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 @@ -83,7 +83,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) 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 e6e26026ffa5..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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 new file mode 100644 index 000000000000..3a421accdc5d --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checknameavailabilitywithoutlocation_client.go @@ -0,0 +1,94 @@ +//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 + +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" +) + +// CheckNameAvailabilityWithoutLocationClient contains the methods for the CheckNameAvailabilityWithoutLocation group. +// Don't use this type directly, use NewCheckNameAvailabilityWithoutLocationClient() instead. +type CheckNameAvailabilityWithoutLocationClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCheckNameAvailabilityWithoutLocationClient creates a new instance of CheckNameAvailabilityWithoutLocationClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - 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) { + cl, err := arm.NewClient(moduleName+".CheckNameAvailabilityWithoutLocationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityWithoutLocationClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// 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 +// - 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) { + req, err := client.executeCreateRequest(ctx, nameAvailabilityRequest, options) + if err != nil { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, runtime.NewResponseError(resp) + } + return client.executeHandleResponse(resp) +} + +// 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) +} + +// executeHandleResponse handles the Execute response. +func (client *CheckNameAvailabilityWithoutLocationClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityWithoutLocationClientExecuteResponse, error) { + result := CheckNameAvailabilityWithoutLocationClientExecuteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { + return CheckNameAvailabilityWithoutLocationClientExecuteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go index ed41d242f287..31ea182af63e 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client.go @@ -47,7 +47,7 @@ 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-05-01 +// Generated from API version 2021-12-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 @@ -83,7 +83,7 @@ func (client *CheckVirtualNetworkSubnetUsageClient) executeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go deleted file mode 100644 index 8d800a4f3e85..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/checkvirtualnetworksubnetusage_client_example_test.go +++ /dev/null @@ -1,52 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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), - // }}, - // } -} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go index 938882c6f81d..820ba49f823c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/client_factory.go @@ -38,23 +38,23 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewServersClient() *ServersClient { - subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAzureADAdministratorsClient() *AzureADAdministratorsClient { + subClient, _ := NewAzureADAdministratorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupsClient() *BackupsClient { + subClient, _ := NewBackupsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupsClient() *BackupsClient { - subClient, _ := NewBackupsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupAndExportClient() *BackupAndExportClient { + subClient, _ := NewBackupAndExportClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { - subClient, _ := NewFirewallRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { + subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -63,8 +63,23 @@ func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { return subClient } -func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { - subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { + subClient, _ := NewFirewallRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServersClient() *ServersClient { + subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewReplicasClient() *ReplicasClient { + subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { + subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -83,6 +98,11 @@ func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityC return subClient } +func (c *ClientFactory) NewCheckNameAvailabilityWithoutLocationClient() *CheckNameAvailabilityWithoutLocationClient { + subClient, _ := NewCheckNameAvailabilityWithoutLocationClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewGetPrivateDNSZoneSuffixClient() *GetPrivateDNSZoneSuffixClient { subClient, _ := NewGetPrivateDNSZoneSuffixClient(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 ebfd334e1ed4..62eea28b0379 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client.go @@ -18,6 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -47,7 +48,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-05-01 +// Generated from API version 2021-12-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. @@ -70,7 +71,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview func (client *ConfigurationsClient) batchUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ConfigurationListForBatchUpdate, options *ConfigurationsClientBeginBatchUpdateOptions) (*http.Response, error) { req, err := client.batchUpdateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { @@ -106,7 +107,78 @@ func (client *ConfigurationsClient) batchUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// 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 +// - 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. +// - parameters - The required parameters for updating a server configuration. +// - options - ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate +// method. +func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ConfigurationsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serverName, configurationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + } else { + return runtime.NewPollerFromResumeToken[ConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// 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 +func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, 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") + } + 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)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, 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") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -115,7 +187,7 @@ func (client *ConfigurationsClient) batchUpdateCreateRequest(ctx context.Context // Get - Gets information about a configuration of server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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. @@ -159,7 +231,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +248,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // NewListByServerPager - List all the configurations in a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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 @@ -229,7 +301,19 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") + if options != nil && options.Tags != nil { + reqQP.Set("tags", *options.Tags) + } + if options != nil && options.Keyword != nil { + reqQP.Set("keyword", *options.Keyword) + } + if options != nil && options.Page != nil { + reqQP.Set("page", strconv.FormatInt(int64(*options.Page), 10)) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +331,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-05-01 +// Generated from API version 2021-12-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. @@ -269,7 +353,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { @@ -309,7 +393,7 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go deleted file mode 100644 index f5470234e5bf..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/configurations_client_example_test.go +++ /dev/null @@ -1,329 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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{ - 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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", 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.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 1fea8e92b078..83e2f7fad93f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/constants.go @@ -11,9 +11,52 @@ package armmysqlflexibleservers const ( moduleName = "armmysqlflexibleservers" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0-beta.1" ) +type AdministratorName string + +const ( + AdministratorNameActiveDirectory AdministratorName = "ActiveDirectory" +) + +// PossibleAdministratorNameValues returns the possible values for the AdministratorName const type. +func PossibleAdministratorNameValues() []AdministratorName { + return []AdministratorName{ + AdministratorNameActiveDirectory, + } +} + +// AdministratorType - Type of the sever administrator. +type AdministratorType string + +const ( + AdministratorTypeActiveDirectory AdministratorType = "ActiveDirectory" +) + +// PossibleAdministratorTypeValues returns the possible values for the AdministratorType const type. +func PossibleAdministratorTypeValues() []AdministratorType { + return []AdministratorType{ + AdministratorTypeActiveDirectory, + } +} + +// BackupFormat - Backup Format for the current backup. (CollatedFormat is INTERNAL – DO NOT USE) +type BackupFormat string + +const ( + BackupFormatCollatedFormat BackupFormat = "CollatedFormat" + BackupFormatNone BackupFormat = "None" +) + +// PossibleBackupFormatValues returns the possible values for the BackupFormat const type. +func PossibleBackupFormatValues() []BackupFormat { + return []BackupFormat{ + BackupFormatCollatedFormat, + BackupFormatNone, + } +} + // ConfigurationSource - Source of the configuration. type ConfigurationSource string @@ -190,6 +233,50 @@ func PossibleIsReadOnlyValues() []IsReadOnly { } } +// ManagedServiceIdentityType - Type of managed service identity. +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeUserAssigned, + } +} + +// OperationStatus - The operation status +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" +) + +// PossibleOperationStatusValues returns the possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{ + OperationStatusPending, + OperationStatusInProgress, + OperationStatusSucceeded, + OperationStatusFailed, + OperationStatusCancelInProgress, + OperationStatusCanceled, + } +} + // ReplicationRole - The replication role. type ReplicationRole string @@ -208,6 +295,22 @@ func PossibleReplicationRoleValues() []ReplicationRole { } } +// ResetAllToDefault - Whether to reset all server parameters to default. +type ResetAllToDefault string + +const ( + ResetAllToDefaultFalse ResetAllToDefault = "False" + ResetAllToDefaultTrue ResetAllToDefault = "True" +) + +// PossibleResetAllToDefaultValues returns the possible values for the ResetAllToDefault const type. +func PossibleResetAllToDefaultValues() []ResetAllToDefault { + return []ResetAllToDefault{ + ResetAllToDefaultFalse, + ResetAllToDefaultTrue, + } +} + // SKUTier - The tier of the particular SKU, e.g. GeneralPurpose. type SKUTier string diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go index 6c5c0ea45ce3..2f2de50daa32 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/databases_client.go @@ -47,7 +47,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-05-01 +// Generated from API version 2021-12-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. @@ -69,7 +69,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { @@ -109,7 +109,7 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -118,7 +118,7 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes a database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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. @@ -138,7 +138,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { @@ -178,7 +178,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,7 +187,7 @@ 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-05-01 +// Generated from API version 2021-12-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. @@ -231,7 +231,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +248,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases // NewListByServerPager - List all the databases in a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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 @@ -301,7 +301,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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 2f67c5698430..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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 5bd4a644560e..31c7024f852b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/firewallrules_client.go @@ -47,7 +47,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-05-01 +// Generated from API version 2021-12-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. @@ -69,7 +69,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) if err != nil { @@ -109,7 +109,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -118,7 +118,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Deletes a firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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. @@ -139,7 +139,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { @@ -179,7 +179,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +188,7 @@ 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-05-01 +// Generated from API version 2021-12-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. @@ -232,7 +232,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +249,7 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew // NewListByServerPager - List all the firewall rules in a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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 @@ -302,7 +302,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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 b638b2098f41..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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 71a3c30b592c..2eafb540f197 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/getprivatednszonesuffix_client.go @@ -41,7 +41,7 @@ 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-05-01 +// Generated from API version 2021-12-01-preview // - options - GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute // method. func (client *GetPrivateDNSZoneSuffixClient) Execute(ctx context.Context, options *GetPrivateDNSZoneSuffixClientExecuteOptions) (GetPrivateDNSZoneSuffixClientExecuteResponse, error) { @@ -67,7 +67,7 @@ func (client *GetPrivateDNSZoneSuffixClient) executeCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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 07a0517be695..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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 f91b08d34d5e..3ed238860f10 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexibleservers/v2 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.4.0 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 + github.com/davecgh/go-spew v1.1.1 // 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 + 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..b6bd7eaad1ba 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/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= +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/locationbasedcapabilities_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go index 33c7c98e52cf..f74c9212886c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/locationbasedcapabilities_client.go @@ -46,7 +46,7 @@ func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore // NewListPager - Get capabilities at specified location in a given subscription. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-01-preview // - locationName - The name of the location. // - options - LocationBasedCapabilitiesClientListOptions contains the optional parameters for the LocationBasedCapabilitiesClient.NewListPager // method. @@ -94,7 +94,7 @@ func (client *LocationBasedCapabilitiesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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 0d3d408fe5f2..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/logfiles_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go new file mode 100644 index 000000000000..37bf7fd8285e --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/logfiles_client.go @@ -0,0 +1,115 @@ +//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 + +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" +) + +// LogFilesClient contains the methods for the LogFiles group. +// Don't use this type directly, use NewLogFilesClient() instead. +type LogFilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLogFilesClient creates a new instance of LogFilesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - 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) { + cl, err := arm.NewClient(moduleName+".LogFilesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LogFilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByServerPager - List all the server log files in a given server. +// +// Generated from API version 2021-12-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 +// method. +func (client *LogFilesClient) NewListByServerPager(resourceGroupName string, serverName string, options *LogFilesClientListByServerOptions) *runtime.Pager[LogFilesClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[LogFilesClientListByServerResponse]{ + More: func(page LogFilesClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LogFilesClientListByServerResponse) (LogFilesClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LogFilesClientListByServerResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LogFilesClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LogFilesClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// 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") + } + 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.MethodGet, 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") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *LogFilesClient) listByServerHandleResponse(resp *http.Response) (LogFilesClientListByServerResponse, error) { + result := LogFilesClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogFileListResult); err != nil { + return LogFilesClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go index 92828f6d2984..2d5ddf12603e 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models.go @@ -11,6 +11,76 @@ package armmysqlflexibleservers import "time" +// AdministratorListResult - A List of azure ad administrators. +type AdministratorListResult struct { + // The link used to get the next page of operations. + NextLink *string + + // The list of azure ad administrator of a server + Value []*AzureADAdministrator +} + +// AdministratorProperties - The properties of an administrator. +type AdministratorProperties struct { + // Type of the sever administrator. + AdministratorType *AdministratorType + + // The resource id of the identity used for AAD Authentication. + IdentityResourceID *string + + // Login name of the server administrator. + Login *string + + // SID (object ID) of the server administrator. + Sid *string + + // Tenant ID of the administrator. + TenantID *string +} + +// AzureADAdministrator - Represents a Administrator. +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} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The system metadata relating to this resource. + 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. @@ -23,6 +93,102 @@ 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 + BackupSettings *BackupSettings + + // REQUIRED; Backup Target Store Details + TargetDetails BackupStoreDetailsClassification +} + +// BackupAndExportResponse - Represents BackupAndExport API Response +type BackupAndExportResponse struct { + // End time + EndTime *time.Time + + // The BackupAndExport operation error response. + Error *ErrorResponse + + // Operation progress (0-100). + PercentComplete *float64 + + // The response properties of a backup and export operation. + Properties *BackupAndExportResponseProperties + + // Start time + StartTime *time.Time + + // The operation status + Status *OperationStatus + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BackupAndExportResponseProperties - BackupAndExport Response Properties +type BackupAndExportResponseProperties struct { + // Metadata related to backup to be stored for restoring resource in key-value pairs. + BackupMetadata *string + + // Data transferred in bytes + DataTransferredInBytes *int64 + + // Size of datasource in bytes + DatasourceSizeInBytes *int64 +} + +// BackupRequestBase is the base for all backup request. +type BackupRequestBase struct { + // REQUIRED; Backup Settings + BackupSettings *BackupSettings +} + +// BackupSettings - Backup Settings +type BackupSettings struct { + // REQUIRED; The name of the backup. + BackupName *string + + // Backup Format for the current backup. (CollatedFormat is INTERNAL – DO NOT USE) + 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 + ObjectType *string +} + +// 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 @@ -33,6 +199,11 @@ 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. @@ -63,6 +234,12 @@ 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 { @@ -107,6 +284,9 @@ type ConfigurationForBatchUpdateProperties struct { // ConfigurationListForBatchUpdate - A list of server configurations to update. type ConfigurationListForBatchUpdate struct { + // Whether to reset all server parameters to default. + ResetAllToDefault *ResetAllToDefault + // The list of server configurations. Value []*ConfigurationForBatchUpdate } @@ -122,6 +302,9 @@ type ConfigurationListResult struct { // ConfigurationProperties - The properties of a configuration. type ConfigurationProperties struct { + // Current value of the configuration. + CurrentValue *string + // Source of the configuration. Source *ConfigurationSource @@ -140,6 +323,9 @@ type ConfigurationProperties struct { // READ-ONLY; Description of the configuration. Description *string + // READ-ONLY; The link used to get the document from community or Azure site. + DocumentationLink *string + // READ-ONLY; If is the configuration pending restart or not. IsConfigPendingRestart *IsConfigPendingRestart @@ -157,6 +343,13 @@ type ConfigurationsClientBeginBatchUpdateOptions struct { 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. @@ -171,7 +364,14 @@ type ConfigurationsClientGetOptions struct { // ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager // method. type ConfigurationsClientListByServerOptions struct { - // placeholder for future optional parameters + // 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. @@ -348,6 +548,22 @@ 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 + ObjectType *string + + // REQUIRED; SASUriList of storage containers where backup data is to be streamed/copied. + SasURIList []*string +} + +// GetBackupStoreDetails implements the BackupStoreDetailsClassification interface for type FullBackupStoreDetails. +func (f *FullBackupStoreDetails) GetBackupStoreDetails() *BackupStoreDetails { + return &BackupStoreDetails{ + ObjectType: f.ObjectType, + } +} + // GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute // method. type GetPrivateDNSZoneSuffixClientExecuteOptions struct { @@ -375,7 +591,7 @@ type HighAvailability struct { // Identity - Properties to configure Identity for Bring your Own Keys type Identity struct { // Type of managed service identity. - Type *string + Type *ManagedServiceIdentityType // Metadata of user assigned identity. UserAssignedIdentities map[string]any @@ -393,6 +609,56 @@ type LocationBasedCapabilitiesClientListOptions struct { // placeholder for future optional parameters } +// LogFile - Represents a logFile. +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} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// LogFileListResult - A List of logFiles. +type LogFileListResult struct { + // The link used to get the next page of operations. + NextLink *string + + // The list of logFiles in a server + Value []*LogFile +} + +// LogFileProperties - The properties of a logFile. +type LogFileProperties struct { + // Creation timestamp of the log file. + CreatedTime *time.Time + + // Last modified timestamp of the log file. + LastModifiedTime *time.Time + + // The size in kb of the logFile. + SizeInKB *int64 + + // Type of the log file. + Type *string + + // The url to download the log file from. + 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 @@ -437,7 +703,7 @@ type Network struct { // Private DNS zone resource id. PrivateDNSZoneResourceID *string - // READ-ONLY; Whether or not public network access is allowed for this server. Value is 'Disabled' when server has VNet integration. + // Whether or not public network access is allowed for this server. Value is 'Disabled' when server has VNet integration. PublicNetworkAccess *EnableStatusEnum } @@ -635,6 +901,12 @@ type ServerForUpdate struct { Tags map[string]*string } +// ServerGtidSetParameter - Server gtid set parameters. +type ServerGtidSetParameter struct { + // The gtid set of server. + GtidSet *string +} + // ServerListResult - A list of servers. type ServerListResult struct { // The link used to get the next page of operations. @@ -721,6 +993,9 @@ type ServerPropertiesForUpdate struct { // Storage related properties of a server. Storage *Storage + + // Server version. + Version *ServerVersion } // ServerRestartParameter - Server restart parameters. @@ -759,6 +1034,12 @@ type ServersClientBeginFailoverOptions struct { 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. @@ -804,9 +1085,15 @@ type Storage struct { // Enable Storage Auto Grow or not. AutoGrow *EnableStatusEnum + // Enable IO Auto Scaling or not. + AutoIoScaling *EnableStatusEnum + // Storage IOPS for a server. Iops *int32 + // Enable Log On Disk or not. + LogOnDisk *EnableStatusEnum + // Max storage size allowed for a server. StorageSizeGB *int32 @@ -881,6 +1168,18 @@ type UserAssignedIdentity struct { PrincipalID *string } +// ValidateBackupResponse - Represents ValidateBackup API Response +type ValidateBackupResponse struct { + // The response properties of a pre backup operation. + Properties *ValidateBackupResponseProperties +} + +// ValidateBackupResponseProperties - ValidateBackup Response Properties +type ValidateBackupResponseProperties struct { + // Estimated no of storage containers required for resource data to be backed up. + NumberOfContainers *int32 +} + // VirtualNetworkSubnetUsageParameter - Virtual network subnet usage parameter type VirtualNetworkSubnetUsageParameter struct { // Virtual network resource id. @@ -891,4 +1190,10 @@ type VirtualNetworkSubnetUsageParameter struct { type VirtualNetworkSubnetUsageResult struct { // READ-ONLY; A list of delegated subnet usage DelegatedSubnetsUsage []*DelegatedSubnetUsage + + // READ-ONLY; The location name. + Location *string + + // READ-ONLY; The subscription id. + SubscriptionID *string } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go index 77975d9b499f..69d72d4a673d 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/models_serde.go @@ -16,6 +16,123 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AdministratorListResult. +func (a AdministratorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdministratorListResult. +func (a *AdministratorListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdministratorProperties. +func (a AdministratorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "administratorType", a.AdministratorType) + populate(objectMap, "identityResourceId", a.IdentityResourceID) + populate(objectMap, "login", a.Login) + populate(objectMap, "sid", a.Sid) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdministratorProperties. +func (a *AdministratorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "administratorType": + err = unpopulate(val, "AdministratorType", &a.AdministratorType) + delete(rawMsg, key) + case "identityResourceId": + err = unpopulate(val, "IdentityResourceID", &a.IdentityResourceID) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &a.Login) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &a.Sid) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureADAdministrator. +func (a AzureADAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADAdministrator. +func (a *AzureADAdministrator) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Backup. func (b Backup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -51,6 +168,216 @@ func (b *Backup) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BackupAndExportRequest. +func (b BackupAndExportRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupSettings", b.BackupSettings) + populate(objectMap, "targetDetails", b.TargetDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupAndExportRequest. +func (b *BackupAndExportRequest) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupSettings": + err = unpopulate(val, "BackupSettings", &b.BackupSettings) + delete(rawMsg, key) + case "targetDetails": + b.TargetDetails, err = unmarshalBackupStoreDetailsClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupAndExportResponse. +func (b BackupAndExportResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTime", b.EndTime) + populate(objectMap, "error", b.Error) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "percentComplete", b.PercentComplete) + populate(objectMap, "properties", b.Properties) + populateTimeRFC3339(objectMap, "startTime", b.StartTime) + populate(objectMap, "status", b.Status) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupAndExportResponse. +func (b *BackupAndExportResponse) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &b.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &b.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &b.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &b.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupAndExportResponseProperties. +func (b BackupAndExportResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupMetadata", b.BackupMetadata) + populate(objectMap, "dataTransferredInBytes", b.DataTransferredInBytes) + populate(objectMap, "datasourceSizeInBytes", b.DatasourceSizeInBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupAndExportResponseProperties. +func (b *BackupAndExportResponseProperties) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupMetadata": + err = unpopulate(val, "BackupMetadata", &b.BackupMetadata) + delete(rawMsg, key) + case "dataTransferredInBytes": + err = unpopulate(val, "DataTransferredInBytes", &b.DataTransferredInBytes) + delete(rawMsg, key) + case "datasourceSizeInBytes": + err = unpopulate(val, "DatasourceSizeInBytes", &b.DatasourceSizeInBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupRequestBase. +func (b BackupRequestBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupSettings", b.BackupSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRequestBase. +func (b *BackupRequestBase) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupSettings": + err = unpopulate(val, "BackupSettings", &b.BackupSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupSettings. +func (b BackupSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupFormat", b.BackupFormat) + populate(objectMap, "backupName", b.BackupName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupSettings. +func (b *BackupSettings) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupFormat": + err = unpopulate(val, "BackupFormat", &b.BackupFormat) + delete(rawMsg, key) + case "backupName": + err = unpopulate(val, "BackupName", &b.BackupName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupStoreDetails. +func (b BackupStoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupStoreDetails. +func (b *BackupStoreDetails) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CapabilitiesListResult. func (c CapabilitiesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -229,6 +556,7 @@ func (c *ConfigurationForBatchUpdateProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ConfigurationListForBatchUpdate. func (c ConfigurationListForBatchUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "resetAllToDefault", c.ResetAllToDefault) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -242,6 +570,9 @@ func (c *ConfigurationListForBatchUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "resetAllToDefault": + err = unpopulate(val, "ResetAllToDefault", &c.ResetAllToDefault) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) @@ -288,9 +619,11 @@ func (c *ConfigurationListResult) UnmarshalJSON(data []byte) error { func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedValues", c.AllowedValues) + populate(objectMap, "currentValue", c.CurrentValue) populate(objectMap, "dataType", c.DataType) populate(objectMap, "defaultValue", c.DefaultValue) populate(objectMap, "description", c.Description) + populate(objectMap, "documentationLink", c.DocumentationLink) populate(objectMap, "isConfigPendingRestart", c.IsConfigPendingRestart) populate(objectMap, "isDynamicConfig", c.IsDynamicConfig) populate(objectMap, "isReadOnly", c.IsReadOnly) @@ -311,6 +644,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { case "allowedValues": err = unpopulate(val, "AllowedValues", &c.AllowedValues) delete(rawMsg, key) + case "currentValue": + err = unpopulate(val, "CurrentValue", &c.CurrentValue) + delete(rawMsg, key) case "dataType": err = unpopulate(val, "DataType", &c.DataType) delete(rawMsg, key) @@ -320,6 +656,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { case "description": err = unpopulate(val, "Description", &c.Description) delete(rawMsg, key) + case "documentationLink": + err = unpopulate(val, "DocumentationLink", &c.DocumentationLink) + delete(rawMsg, key) case "isConfigPendingRestart": err = unpopulate(val, "IsConfigPendingRestart", &c.IsConfigPendingRestart) delete(rawMsg, key) @@ -346,9 +685,9 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataEncryption. func (d DataEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "geoBackupKeyUri", d.GeoBackupKeyURI) + populate(objectMap, "geoBackupKeyURI", d.GeoBackupKeyURI) populate(objectMap, "geoBackupUserAssignedIdentityId", d.GeoBackupUserAssignedIdentityID) - populate(objectMap, "primaryKeyUri", d.PrimaryKeyURI) + populate(objectMap, "primaryKeyURI", d.PrimaryKeyURI) populate(objectMap, "primaryUserAssignedIdentityId", d.PrimaryUserAssignedIdentityID) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) @@ -363,13 +702,13 @@ func (d *DataEncryption) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "geoBackupKeyUri": + case "geoBackupKeyURI": err = unpopulate(val, "GeoBackupKeyURI", &d.GeoBackupKeyURI) delete(rawMsg, key) case "geoBackupUserAssignedIdentityId": err = unpopulate(val, "GeoBackupUserAssignedIdentityID", &d.GeoBackupUserAssignedIdentityID) delete(rawMsg, key) - case "primaryKeyUri": + case "primaryKeyURI": err = unpopulate(val, "PrimaryKeyURI", &d.PrimaryKeyURI) delete(rawMsg, key) case "primaryUserAssignedIdentityId": @@ -701,6 +1040,37 @@ func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FullBackupStoreDetails. +func (f FullBackupStoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["objectType"] = "FullBackupStoreDetails" + populate(objectMap, "sasUriList", f.SasURIList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FullBackupStoreDetails. +func (f *FullBackupStoreDetails) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &f.ObjectType) + delete(rawMsg, key) + case "sasUriList": + err = unpopulate(val, "SasURIList", &f.SasURIList) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type GetPrivateDNSZoneSuffixResponse. func (g GetPrivateDNSZoneSuffixResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -768,7 +1138,7 @@ func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", i.PrincipalID) populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "UserAssigned" + populate(objectMap, "type", i.Type) populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) return json.Marshal(objectMap) } @@ -802,6 +1172,123 @@ func (i *Identity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LogFile. +func (l LogFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFile. +func (l *LogFile) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileListResult. +func (l LogFileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileListResult. +func (l *LogFileListResult) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileProperties. +func (l LogFileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdTime", l.CreatedTime) + populateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) + populate(objectMap, "sizeInKB", l.SizeInKB) + populate(objectMap, "type", l.Type) + populate(objectMap, "url", l.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileProperties. +func (l *LogFileProperties) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &l.CreatedTime) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateTimeRFC3339(val, "LastModifiedTime", &l.LastModifiedTime) + delete(rawMsg, key) + case "sizeInKB": + err = unpopulate(val, "SizeInKB", &l.SizeInKB) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &l.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MaintenanceWindow. func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1433,6 +1920,33 @@ func (s *ServerForUpdate) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServerGtidSetParameter. +func (s ServerGtidSetParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gtidSet", s.GtidSet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerGtidSetParameter. +func (s *ServerGtidSetParameter) 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 "gtidSet": + err = unpopulate(val, "GtidSet", &s.GtidSet) + 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 ServerListResult. func (s ServerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1565,6 +2079,7 @@ func (s ServerPropertiesForUpdate) MarshalJSON() ([]byte, error) { populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "storage", s.Storage) + populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } @@ -1598,6 +2113,9 @@ func (s *ServerPropertiesForUpdate) UnmarshalJSON(data []byte) error { case "storage": err = unpopulate(val, "Storage", &s.Storage) delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1672,7 +2190,9 @@ func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { func (s Storage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoGrow", s.AutoGrow) + populate(objectMap, "autoIoScaling", s.AutoIoScaling) populate(objectMap, "iops", s.Iops) + populate(objectMap, "logOnDisk", s.LogOnDisk) populate(objectMap, "storageSku", s.StorageSKU) populate(objectMap, "storageSizeGB", s.StorageSizeGB) return json.Marshal(objectMap) @@ -1690,9 +2210,15 @@ func (s *Storage) UnmarshalJSON(data []byte) error { case "autoGrow": err = unpopulate(val, "AutoGrow", &s.AutoGrow) delete(rawMsg, key) + case "autoIoScaling": + err = unpopulate(val, "AutoIoScaling", &s.AutoIoScaling) + delete(rawMsg, key) case "iops": err = unpopulate(val, "Iops", &s.Iops) delete(rawMsg, key) + case "logOnDisk": + err = unpopulate(val, "LogOnDisk", &s.LogOnDisk) + delete(rawMsg, key) case "storageSku": err = unpopulate(val, "StorageSKU", &s.StorageSKU) delete(rawMsg, key) @@ -1871,6 +2397,60 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ValidateBackupResponse. +func (v ValidateBackupResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", v.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateBackupResponse. +func (v *ValidateBackupResponse) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidateBackupResponseProperties. +func (v ValidateBackupResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "numberOfContainers", v.NumberOfContainers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateBackupResponseProperties. +func (v *ValidateBackupResponseProperties) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "numberOfContainers": + err = unpopulate(val, "NumberOfContainers", &v.NumberOfContainers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VirtualNetworkSubnetUsageParameter. func (v VirtualNetworkSubnetUsageParameter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1902,6 +2482,8 @@ func (v *VirtualNetworkSubnetUsageParameter) UnmarshalJSON(data []byte) error { func (v VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "delegatedSubnetsUsage", v.DelegatedSubnetsUsage) + populate(objectMap, "location", v.Location) + populate(objectMap, "subscriptionId", v.SubscriptionID) return json.Marshal(objectMap) } @@ -1917,6 +2499,12 @@ func (v *VirtualNetworkSubnetUsageResult) UnmarshalJSON(data []byte) error { case "delegatedSubnetsUsage": err = unpopulate(val, "DelegatedSubnetsUsage", &v.DelegatedSubnetsUsage) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &v.Location) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &v.SubscriptionID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go index 8daaa3b82d47..6a41d144936e 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations. // -// Generated from API version 2021-05-01 +// Generated from API version 2021-12-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 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2021-12-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 3e71889096dc..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/polymorphic_helpers.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go new file mode 100644 index 000000000000..97646202e955 --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/polymorphic_helpers.go @@ -0,0 +1,30 @@ +//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 + +import "encoding/json" + +func unmarshalBackupStoreDetailsClassification(rawMsg json.RawMessage) (BackupStoreDetailsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b BackupStoreDetailsClassification + switch m["objectType"] { + case "FullBackupStoreDetails": + b = &FullBackupStoreDetails{} + default: + b = &BackupStoreDetails{} + } + return b, json.Unmarshal(rawMsg, b) +} diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go index 755f87e68205..bf2d44ce5507 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/replicas_client.go @@ -46,7 +46,7 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // NewListByServerPager - List all the replicas for a given server. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-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 @@ -99,7 +99,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-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 70eb44a6e31d..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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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 1f95c4eba075..c7a96c2efc10 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/response_types.go @@ -9,6 +9,36 @@ package armmysqlflexibleservers +// AzureADAdministratorsClientCreateOrUpdateResponse contains the response from method AzureADAdministratorsClient.BeginCreateOrUpdate. +type AzureADAdministratorsClientCreateOrUpdateResponse struct { + AzureADAdministrator +} + +// AzureADAdministratorsClientDeleteResponse contains the response from method AzureADAdministratorsClient.BeginDelete. +type AzureADAdministratorsClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureADAdministratorsClientGetResponse contains the response from method AzureADAdministratorsClient.Get. +type AzureADAdministratorsClientGetResponse struct { + AzureADAdministrator +} + +// AzureADAdministratorsClientListByServerResponse contains the response from method AzureADAdministratorsClient.NewListByServerPager. +type AzureADAdministratorsClientListByServerResponse struct { + AdministratorListResult +} + +// BackupAndExportClientCreateResponse contains the response from method BackupAndExportClient.BeginCreate. +type BackupAndExportClientCreateResponse struct { + BackupAndExportResponse +} + +// BackupAndExportClientValidateBackupResponse contains the response from method BackupAndExportClient.ValidateBackup. +type BackupAndExportClientValidateBackupResponse struct { + ValidateBackupResponse +} + // BackupsClientGetResponse contains the response from method BackupsClient.Get. type BackupsClientGetResponse struct { ServerBackup @@ -19,11 +49,21 @@ type BackupsClientListByServerResponse struct { ServerBackupListResult } +// BackupsClientPutResponse contains the response from method BackupsClient.Put. +type BackupsClientPutResponse struct { + ServerBackup +} + // CheckNameAvailabilityClientExecuteResponse contains the response from method CheckNameAvailabilityClient.Execute. type CheckNameAvailabilityClientExecuteResponse struct { NameAvailability } +// CheckNameAvailabilityWithoutLocationClientExecuteResponse contains the response from method CheckNameAvailabilityWithoutLocationClient.Execute. +type CheckNameAvailabilityWithoutLocationClientExecuteResponse struct { + NameAvailability +} + // CheckVirtualNetworkSubnetUsageClientExecuteResponse contains the response from method CheckVirtualNetworkSubnetUsageClient.Execute. type CheckVirtualNetworkSubnetUsageClientExecuteResponse struct { VirtualNetworkSubnetUsageResult @@ -34,6 +74,11 @@ type ConfigurationsClientBatchUpdateResponse struct { ConfigurationListResult } +// ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. +type ConfigurationsClientCreateOrUpdateResponse struct { + Configuration +} + // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { Configuration @@ -99,6 +144,11 @@ type LocationBasedCapabilitiesClientListResponse struct { CapabilitiesListResult } +// LogFilesClientListByServerResponse contains the response from method LogFilesClient.NewListByServerPager. +type LogFilesClientListByServerResponse struct { + LogFileListResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult @@ -139,6 +189,11 @@ type ServersClientListResponse struct { ServerListResult } +// ServersClientResetGtidResponse contains the response from method ServersClient.BeginResetGtid. +type ServersClientResetGtidResponse struct { + // placeholder for future response values +} + // ServersClientRestartResponse contains the response from method ServersClient.BeginRestart. type ServersClientRestartResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go index 2cb55bbc4ecd..19cac3c35e4f 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client.go @@ -47,7 +47,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 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -67,7 +67,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters Server, options *ServersClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { @@ -103,7 +103,7 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -112,7 +112,7 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr // BeginDelete - Deletes a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-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,7 +122,9 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -131,7 +133,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { @@ -167,7 +169,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +178,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 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -195,7 +197,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) failover(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginFailoverOptions) (*http.Response, error) { req, err := client.failoverCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { @@ -231,7 +233,7 @@ func (client *ServersClient) failoverCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,7 +242,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -279,7 +281,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,7 +298,7 @@ func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClie // NewListPager - List all the servers in a given subscription. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-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]{ @@ -338,7 +340,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -355,7 +357,7 @@ func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersCli // NewListByResourceGroupPager - List all the servers in a given resource group. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager // method. @@ -403,7 +405,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -418,10 +420,77 @@ func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Respon return result, nil } +// BeginResetGtid - Resets GTID on a server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-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. +// - options - ServersClientBeginResetGtidOptions contains the optional parameters for the ServersClient.BeginResetGtid method. +func (client *ServersClient) BeginResetGtid(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*runtime.Poller[ServersClientResetGtidResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.resetGtid(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServersClientResetGtidResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ServersClientResetGtidResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ResetGtid - Resets GTID on a server. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-09-30-preview +func (client *ServersClient) resetGtid(ctx context.Context, resourceGroupName string, serverName string, parameters ServerGtidSetParameter, options *ServersClientBeginResetGtidOptions) (*http.Response, error) { + req, err := client.resetGtidCreateRequest(ctx, resourceGroupName, serverName, parameters, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, 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") + } + 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", "2022-09-30-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + // BeginRestart - Restarts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -441,7 +510,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) restart(ctx context.Context, resourceGroupName string, serverName string, parameters ServerRestartParameter, options *ServersClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { @@ -477,7 +546,7 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -486,7 +555,7 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG // BeginStart - Starts a server. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -505,7 +574,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) start(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { @@ -541,7 +610,7 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -550,7 +619,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 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -569,7 +638,7 @@ 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 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) stop(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (*http.Response, error) { req, err := client.stopCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { @@ -605,7 +674,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -615,7 +684,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 2021-05-01 +// Generated from API version 2022-09-30-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. @@ -636,7 +705,7 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName // definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-05-01 +// Generated from API version 2022-09-30-preview func (client *ServersClient) update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForUpdate, options *ServersClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { @@ -672,7 +741,7 @@ func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") + reqQP.Set("api-version", "2022-09-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go deleted file mode 100644 index 125077f87480..000000000000 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/servers_client_example_test.go +++ /dev/null @@ -1,1212 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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("UserAssigned"), - 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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), - 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), - // 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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("UserAssigned"), - 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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), - // 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2021-05-01/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) - } -}