diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md index 70a19edaa440..04719dd29a6a 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md @@ -1,5 +1,92 @@ # Release History +## 2.0.0 (2022-12-15) +### Breaking Changes + +- Function `*CheckNameAvailabilityClient.Execute` parameter(s) have been changed from `(context.Context, NameAvailabilityRequest, *CheckNameAvailabilityClientExecuteOptions)` to `(context.Context, CheckNameAvailabilityRequest, *CheckNameAvailabilityClientExecuteOptions)` +- Function `*ConfigurationsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, Configuration, *ConfigurationsClientBeginUpdateOptions)` to `(context.Context, string, string, string, ConfigurationForUpdate, *ConfigurationsClientBeginUpdateOptions)` +- Type of `NameAvailability.Reason` has been changed from `*Reason` to `*CheckNameAvailabilityReason` +- Type alias `Reason` has been removed +- Struct `CloudError` has been removed +- Struct `NameAvailabilityRequest` has been removed +- Field `AdditionalInfo` of struct `ErrorResponse` has been removed +- Field `Code` of struct `ErrorResponse` has been removed +- Field `Details` of struct `ErrorResponse` has been removed +- Field `Message` of struct `ErrorResponse` has been removed +- Field `Target` of struct `ErrorResponse` has been removed +- Field `Location` of struct `ServerForUpdate` has been removed + +### Features Added + +- New value `CreateModeGeoRestore`, `CreateModeReplica` added to type alias `CreateMode` +- New value `HighAvailabilityModeSameZone` added to type alias `HighAvailabilityMode` +- New type alias `ActiveDirectoryAuthEnum` with values `ActiveDirectoryAuthEnumDisabled`, `ActiveDirectoryAuthEnumEnabled` +- New type alias `ArmServerKeyType` with values `ArmServerKeyTypeAzureKeyVault`, `ArmServerKeyTypeSystemAssigned` +- New type alias `CheckNameAvailabilityReason` with values `CheckNameAvailabilityReasonAlreadyExists`, `CheckNameAvailabilityReasonInvalid` +- New type alias `IdentityType` with values `IdentityTypeNone`, `IdentityTypeSystemAssigned`, `IdentityTypeUserAssigned` +- New type alias `Origin` with values `OriginFull` +- New type alias `PasswordAuthEnum` with values `PasswordAuthEnumDisabled`, `PasswordAuthEnumEnabled` +- New type alias `PrincipalType` with values `PrincipalTypeGroup`, `PrincipalTypeServicePrincipal`, `PrincipalTypeUnknown`, `PrincipalTypeUser` +- New type alias `ReplicationRole` with values `ReplicationRoleAsyncReplica`, `ReplicationRoleGeoAsyncReplica`, `ReplicationRoleGeoSyncReplica`, `ReplicationRoleNone`, `ReplicationRolePrimary`, `ReplicationRoleSecondary`, `ReplicationRoleSyncReplica`, `ReplicationRoleWalReplica` +- New function `NewAdministratorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AdministratorsClient, error)` +- New function `*AdministratorsClient.BeginCreate(context.Context, string, string, string, ActiveDirectoryAdministratorAdd, *AdministratorsClientBeginCreateOptions) (*runtime.Poller[AdministratorsClientCreateResponse], error)` +- New function `*AdministratorsClient.BeginDelete(context.Context, string, string, string, *AdministratorsClientBeginDeleteOptions) (*runtime.Poller[AdministratorsClientDeleteResponse], error)` +- New function `*AdministratorsClient.Get(context.Context, string, string, string, *AdministratorsClientGetOptions) (AdministratorsClientGetResponse, error)` +- New function `*AdministratorsClient.NewListByServerPager(string, string, *AdministratorsClientListByServerOptions) *runtime.Pager[AdministratorsClientListByServerResponse]` +- New function `NewBackupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupsClient, error)` +- New function `*BackupsClient.Get(context.Context, string, string, string, *BackupsClientGetOptions) (BackupsClientGetResponse, error)` +- New function `*BackupsClient.NewListByServerPager(string, string, *BackupsClientListByServerOptions) *runtime.Pager[BackupsClientListByServerResponse]` +- New function `NewCheckNameAvailabilityWithLocationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CheckNameAvailabilityWithLocationClient, error)` +- New function `*CheckNameAvailabilityWithLocationClient.Execute(context.Context, string, CheckNameAvailabilityRequest, *CheckNameAvailabilityWithLocationClientExecuteOptions) (CheckNameAvailabilityWithLocationClientExecuteResponse, error)` +- New function `NewReplicasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ReplicasClient, error)` +- New function `*ReplicasClient.NewListByServerPager(string, string, *ReplicasClientListByServerOptions) *runtime.Pager[ReplicasClientListByServerResponse]` +- New struct `ActiveDirectoryAdministrator` +- New struct `ActiveDirectoryAdministratorAdd` +- New struct `AdministratorListResult` +- New struct `AdministratorProperties` +- New struct `AdministratorPropertiesForAdd` +- New struct `AdministratorsClient` +- New struct `AdministratorsClientCreateResponse` +- New struct `AdministratorsClientDeleteResponse` +- New struct `AdministratorsClientListByServerResponse` +- New struct `AuthConfig` +- New struct `BackupsClient` +- New struct `BackupsClientListByServerResponse` +- New struct `CheckNameAvailabilityRequest` +- New struct `CheckNameAvailabilityResponse` +- New struct `CheckNameAvailabilityWithLocationClient` +- New struct `ConfigurationForUpdate` +- New struct `DataEncryption` +- New struct `ErrorDetail` +- New struct `FastProvisioningEditionCapability` +- New struct `ReplicasClient` +- New struct `ReplicasClientListByServerResponse` +- New struct `ServerBackup` +- New struct `ServerBackupListResult` +- New struct `ServerBackupProperties` +- New struct `StorageTierCapability` +- New struct `UserAssignedIdentity` +- New struct `UserIdentity` +- New field `FastProvisioningSupported` in struct `CapabilityProperties` +- New field `SupportedFastProvisioningEditions` in struct `CapabilityProperties` +- New field `Error` in struct `ErrorResponse` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `Identity` in struct `Server` +- New field `Identity` in struct `ServerForUpdate` +- New field `AuthConfig` in struct `ServerProperties` +- New field `DataEncryption` in struct `ServerProperties` +- New field `ReplicaCapacity` in struct `ServerProperties` +- New field `ReplicationRole` in struct `ServerProperties` +- New field `AuthConfig` in struct `ServerPropertiesForUpdate` +- New field `DataEncryption` in struct `ServerPropertiesForUpdate` +- New field `ReplicationRole` in struct `ServerPropertiesForUpdate` +- New field `Version` in struct `ServerPropertiesForUpdate` +- New field `SupportedVersionsToUpgrade` in struct `ServerVersionCapability` +- New field `SupportedUpgradableTierList` in struct `StorageMBCapability` +- New field `SystemData` in struct `TrackedResource` + + ## 1.1.0 (2022-07-21) ### Features Added diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/administrators_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/administrators_client.go new file mode 100644 index 000000000000..dce6c77e9dc5 --- /dev/null +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/administrators_client.go @@ -0,0 +1,327 @@ +//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 armpostgresqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AdministratorsClient contains the methods for the Administrators group. +// Don't use this type directly, use NewAdministratorsClient() instead. +type AdministratorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAdministratorsClient creates a new instance of AdministratorsClient 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 NewAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdministratorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AdministratorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Creates a new server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// serverName - The name of the server. +// objectID - Guid of the objectId for the administrator. +// parameters - The required parameters for adding an active directory administrator for a server. +// options - AdministratorsClientBeginCreateOptions contains the optional parameters for the AdministratorsClient.BeginCreate +// method. +func (client *AdministratorsClient) BeginCreate(ctx context.Context, resourceGroupName string, serverName string, objectID string, parameters ActiveDirectoryAdministratorAdd, options *AdministratorsClientBeginCreateOptions) (*runtime.Poller[AdministratorsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, serverName, objectID, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AdministratorsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[AdministratorsClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Creates a new server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +func (client *AdministratorsClient) create(ctx context.Context, resourceGroupName string, serverName string, objectID string, parameters ActiveDirectoryAdministratorAdd, options *AdministratorsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, objectID, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *AdministratorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, serverName string, objectID string, parameters ActiveDirectoryAdministratorAdd, options *AdministratorsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + 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 objectID == "" { + return nil, errors.New("parameter objectID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{objectId}", url.PathEscape(objectID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes an Active Directory Administrator associated with the server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// serverName - The name of the server. +// objectID - Guid of the objectId for the administrator. +// options - AdministratorsClientBeginDeleteOptions contains the optional parameters for the AdministratorsClient.BeginDelete +// method. +func (client *AdministratorsClient) BeginDelete(ctx context.Context, resourceGroupName string, serverName string, objectID string, options *AdministratorsClientBeginDeleteOptions) (*runtime.Poller[AdministratorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, serverName, objectID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AdministratorsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AdministratorsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes an Active Directory Administrator associated with the server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +func (client *AdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, objectID string, options *AdministratorsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, objectID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AdministratorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverName string, objectID string, options *AdministratorsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + 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 objectID == "" { + return nil, errors.New("parameter objectID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{objectId}", url.PathEscape(objectID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about a server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// serverName - The name of the server. +// objectID - Guid of the objectId for the administrator. +// options - AdministratorsClientGetOptions contains the optional parameters for the AdministratorsClient.Get method. +func (client *AdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, objectID string, options *AdministratorsClientGetOptions) (AdministratorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, objectID, options) + if err != nil { + return AdministratorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdministratorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdministratorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AdministratorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, objectID string, options *AdministratorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/administrators/{objectId}" + 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 objectID == "" { + return nil, errors.New("parameter objectID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{objectId}", url.PathEscape(objectID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AdministratorsClient) getHandleResponse(resp *http.Response) (AdministratorsClientGetResponse, error) { + result := AdministratorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ActiveDirectoryAdministrator); err != nil { + return AdministratorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerPager - List all the AAD administrators for a given server. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// serverName - The name of the server. +// options - AdministratorsClientListByServerOptions contains the optional parameters for the AdministratorsClient.ListByServer +// method. +func (client *AdministratorsClient) NewListByServerPager(resourceGroupName string, serverName string, options *AdministratorsClientListByServerOptions) *runtime.Pager[AdministratorsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[AdministratorsClientListByServerResponse]{ + More: func(page AdministratorsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AdministratorsClientListByServerResponse) (AdministratorsClientListByServerResponse, 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 AdministratorsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AdministratorsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AdministratorsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *AdministratorsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *AdministratorsClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *AdministratorsClient) listByServerHandleResponse(resp *http.Response) (AdministratorsClientListByServerResponse, error) { + result := AdministratorsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdministratorListResult); err != nil { + return AdministratorsClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md index b1eb9a9544e6..5bbaf2eb27a4 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/f705a46c74af9e4c096556e914d9a45c01c47b5e/specification/postgresql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/f705a46c74af9e4c096556e914d9a45c01c47b5e/specification/postgresql/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 2.0.0 package-flexibleservers: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/backups_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/backups_client.go new file mode 100644 index 000000000000..5cc29c366ba2 --- /dev/null +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/backups_client.go @@ -0,0 +1,185 @@ +//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 armpostgresqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupsClient contains the methods for the Backups group. +// Don't use this type directly, use NewBackupsClient() instead. +type BackupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewBackupsClient creates a new instance of BackupsClient 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 NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &BackupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get specific backup for a given server. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// serverName - The name of the server. +// backupName - The name of the backup. +// options - BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. +func (client *BackupsClient) Get(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientGetOptions) (BackupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, backupName, options) + if err != nil { + return BackupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, backupName string, options *BackupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/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.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsClientGetResponse, error) { + result := BackupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerBackup); err != nil { + return BackupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByServerPager - List all the backups for a given server. +// Generated from API version 2022-12-01 +// 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.ListByServer method. +func (client *BackupsClient) NewListByServerPager(resourceGroupName string, serverName string, options *BackupsClientListByServerOptions) *runtime.Pager[BackupsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupsClientListByServerResponse]{ + More: func(page BackupsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupsClientListByServerResponse) (BackupsClientListByServerResponse, 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 BackupsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return BackupsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *BackupsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *BackupsClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/backups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *BackupsClient) listByServerHandleResponse(resp *http.Response) (BackupsClientListByServerResponse, error) { + result := BackupsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerBackupListResult); err != nil { + return BackupsClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client.go index 7105a29c2249..64cf78397916 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client.go @@ -57,11 +57,11 @@ func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.Tok // Execute - Check the availability of name for resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // nameAvailabilityRequest - The required parameters for checking if resource name is available. // options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute // method. -func (client *CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (CheckNameAvailabilityClientExecuteResponse, error) { +func (client *CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (CheckNameAvailabilityClientExecuteResponse, error) { req, err := client.executeCreateRequest(ctx, nameAvailabilityRequest, options) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err @@ -77,7 +77,7 @@ func (client *CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvai } // executeCreateRequest creates the Execute request. -func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (*policy.Request, error) { +func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Context, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -88,7 +88,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client_example_test.go deleted file mode 100644 index b84ffd29a36e..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailability_client_example_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_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/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewCheckNameAvailabilityClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Execute(ctx, - armpostgresqlflexibleservers.NameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DBforPostgreSQL/flexibleServers"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailabilitywithlocation_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailabilitywithlocation_client.go new file mode 100644 index 000000000000..790d11aeead9 --- /dev/null +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/checknameavailabilitywithlocation_client.go @@ -0,0 +1,109 @@ +//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 armpostgresqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CheckNameAvailabilityWithLocationClient contains the methods for the CheckNameAvailabilityWithLocation group. +// Don't use this type directly, use NewCheckNameAvailabilityWithLocationClient() instead. +type CheckNameAvailabilityWithLocationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCheckNameAvailabilityWithLocationClient creates a new instance of CheckNameAvailabilityWithLocationClient 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 NewCheckNameAvailabilityWithLocationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityWithLocationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityWithLocationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Execute - Check the availability of name for resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-01 +// locationName - The name of the location. +// nameAvailabilityRequest - The required parameters for checking if resource name is available. +// options - CheckNameAvailabilityWithLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithLocationClient.Execute +// method. +func (client *CheckNameAvailabilityWithLocationClient) Execute(ctx context.Context, locationName string, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityWithLocationClientExecuteOptions) (CheckNameAvailabilityWithLocationClientExecuteResponse, error) { + req, err := client.executeCreateRequest(ctx, locationName, nameAvailabilityRequest, options) + if err != nil { + return CheckNameAvailabilityWithLocationClientExecuteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CheckNameAvailabilityWithLocationClientExecuteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CheckNameAvailabilityWithLocationClientExecuteResponse{}, runtime.NewResponseError(resp) + } + return client.executeHandleResponse(resp) +} + +// executeCreateRequest creates the Execute request. +func (client *CheckNameAvailabilityWithLocationClient) executeCreateRequest(ctx context.Context, locationName string, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityWithLocationClientExecuteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + 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 *CheckNameAvailabilityWithLocationClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityWithLocationClientExecuteResponse, error) { + result := CheckNameAvailabilityWithLocationClientExecuteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { + return CheckNameAvailabilityWithLocationClientExecuteResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client.go index 8a6f5f2cb0de..1796b7b7a76a 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client.go @@ -57,7 +57,7 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets information about a configuration of server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -101,7 +101,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,8 +117,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf } // NewListByServerPager - List all the configurations in a given server. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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.ListByServer @@ -171,7 +170,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +187,7 @@ func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Respon // BeginPut - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -200,7 +199,9 @@ func (client *ConfigurationsClient) BeginPut(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[ConfigurationsClientPutResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConfigurationsClientPutResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ConfigurationsClientPutResponse](options.ResumeToken, client.pl, nil) } @@ -208,7 +209,7 @@ func (client *ConfigurationsClient) BeginPut(ctx context.Context, resourceGroupN // Put - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 func (client *ConfigurationsClient) put(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginPutOptions) (*http.Response, error) { req, err := client.putCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { @@ -218,7 +219,7 @@ func (client *ConfigurationsClient) put(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -248,7 +249,7 @@ func (client *ConfigurationsClient) putCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -256,20 +257,22 @@ func (client *ConfigurationsClient) putCreateRequest(ctx context.Context, resour // BeginUpdate - Updates a configuration of a server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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 - ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate // method. -func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*runtime.Poller[ConfigurationsClientUpdateResponse], error) { +func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters ConfigurationForUpdate, options *ConfigurationsClientBeginUpdateOptions) (*runtime.Poller[ConfigurationsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[ConfigurationsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConfigurationsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ConfigurationsClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -277,8 +280,8 @@ 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-06-01 -func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2022-12-01 +func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters ConfigurationForUpdate, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { return nil, err @@ -287,14 +290,14 @@ func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters ConfigurationForUpdate, options *ConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -317,7 +320,7 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client_example_test.go deleted file mode 100644 index 0d570a1201e8..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/configurations_client_example_test.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_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/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationListByServer.json -func ExampleConfigurationsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerPager("testrg", - "testserver", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testserver", - "array_nulls", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "testrg", - "testserver", - "event_scheduler", - armpostgresqlflexibleservers.Configuration{ - Properties: &armpostgresqlflexibleservers.ConfigurationProperties{ - Source: to.Ptr("user-override"), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ConfigurationUpdate.json -func ExampleConfigurationsClient_BeginPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPut(ctx, - "testrg", - "testserver", - "event_scheduler", - armpostgresqlflexibleservers.Configuration{ - Properties: &armpostgresqlflexibleservers.ConfigurationProperties{ - Source: to.Ptr("user-override"), - 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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/constants.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/constants.go index 2da63bb42e55..c55cf7557e74 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/constants.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/constants.go @@ -11,9 +11,57 @@ package armpostgresqlflexibleservers const ( moduleName = "armpostgresqlflexibleservers" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) +// ActiveDirectoryAuthEnum - If Enabled, Azure Active Directory authentication is enabled. +type ActiveDirectoryAuthEnum string + +const ( + ActiveDirectoryAuthEnumDisabled ActiveDirectoryAuthEnum = "Disabled" + ActiveDirectoryAuthEnumEnabled ActiveDirectoryAuthEnum = "Enabled" +) + +// PossibleActiveDirectoryAuthEnumValues returns the possible values for the ActiveDirectoryAuthEnum const type. +func PossibleActiveDirectoryAuthEnumValues() []ActiveDirectoryAuthEnum { + return []ActiveDirectoryAuthEnum{ + ActiveDirectoryAuthEnumDisabled, + ActiveDirectoryAuthEnumEnabled, + } +} + +// ArmServerKeyType - Data encryption type to depict if it is System assigned vs Azure Key vault. +type ArmServerKeyType string + +const ( + ArmServerKeyTypeAzureKeyVault ArmServerKeyType = "AzureKeyVault" + ArmServerKeyTypeSystemAssigned ArmServerKeyType = "SystemAssigned" +) + +// PossibleArmServerKeyTypeValues returns the possible values for the ArmServerKeyType const type. +func PossibleArmServerKeyTypeValues() []ArmServerKeyType { + return []ArmServerKeyType{ + ArmServerKeyTypeAzureKeyVault, + ArmServerKeyTypeSystemAssigned, + } +} + +// CheckNameAvailabilityReason - The reason why the given name is not available. +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + // ConfigurationDataType - Data type of the configuration. type ConfigurationDataType string @@ -40,7 +88,9 @@ type CreateMode string const ( CreateModeCreate CreateMode = "Create" CreateModeDefault CreateMode = "Default" + CreateModeGeoRestore CreateMode = "GeoRestore" CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + CreateModeReplica CreateMode = "Replica" CreateModeUpdate CreateMode = "Update" ) @@ -49,7 +99,9 @@ func PossibleCreateModeValues() []CreateMode { return []CreateMode{ CreateModeCreate, CreateModeDefault, + CreateModeGeoRestore, CreateModePointInTimeRestore, + CreateModeReplica, CreateModeUpdate, } } @@ -131,6 +183,7 @@ type HighAvailabilityMode string const ( HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" + HighAvailabilityModeSameZone HighAvailabilityMode = "SameZone" HighAvailabilityModeZoneRedundant HighAvailabilityMode = "ZoneRedundant" ) @@ -138,10 +191,29 @@ const ( func PossibleHighAvailabilityModeValues() []HighAvailabilityMode { return []HighAvailabilityMode{ HighAvailabilityModeDisabled, + HighAvailabilityModeSameZone, HighAvailabilityModeZoneRedundant, } } +// IdentityType - the types of identities associated with this resource; currently restricted to 'SystemAssigned and UserAssigned' +type IdentityType string + +const ( + IdentityTypeNone IdentityType = "None" + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeNone, + IdentityTypeSystemAssigned, + IdentityTypeUserAssigned, + } +} + // OperationOrigin - The intended executor of the operation. type OperationOrigin string @@ -160,19 +232,81 @@ func PossibleOperationOriginValues() []OperationOrigin { } } -// Reason - The name availability reason. -type Reason string +// Origin - Backup type. +type Origin string + +const ( + OriginFull Origin = "Full" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginFull, + } +} + +// PasswordAuthEnum - If Enabled, Password authentication is enabled. +type PasswordAuthEnum string + +const ( + PasswordAuthEnumDisabled PasswordAuthEnum = "Disabled" + PasswordAuthEnumEnabled PasswordAuthEnum = "Enabled" +) + +// PossiblePasswordAuthEnumValues returns the possible values for the PasswordAuthEnum const type. +func PossiblePasswordAuthEnumValues() []PasswordAuthEnum { + return []PasswordAuthEnum{ + PasswordAuthEnumDisabled, + PasswordAuthEnumEnabled, + } +} + +// PrincipalType - The principal type used to represent the type of Active Directory Administrator. +type PrincipalType string + +const ( + PrincipalTypeGroup PrincipalType = "Group" + PrincipalTypeServicePrincipal PrincipalType = "ServicePrincipal" + PrincipalTypeUnknown PrincipalType = "Unknown" + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns the possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{ + PrincipalTypeGroup, + PrincipalTypeServicePrincipal, + PrincipalTypeUnknown, + PrincipalTypeUser, + } +} + +// ReplicationRole - Used to indicate role of the server in replication set. +type ReplicationRole string const ( - ReasonAlreadyExists Reason = "AlreadyExists" - ReasonInvalid Reason = "Invalid" + ReplicationRoleAsyncReplica ReplicationRole = "AsyncReplica" + ReplicationRoleGeoAsyncReplica ReplicationRole = "GeoAsyncReplica" + ReplicationRoleGeoSyncReplica ReplicationRole = "GeoSyncReplica" + ReplicationRoleNone ReplicationRole = "None" + ReplicationRolePrimary ReplicationRole = "Primary" + ReplicationRoleSecondary ReplicationRole = "Secondary" + ReplicationRoleSyncReplica ReplicationRole = "SyncReplica" + ReplicationRoleWalReplica ReplicationRole = "WalReplica" ) -// PossibleReasonValues returns the possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{ - ReasonAlreadyExists, - ReasonInvalid, +// PossibleReplicationRoleValues returns the possible values for the ReplicationRole const type. +func PossibleReplicationRoleValues() []ReplicationRole { + return []ReplicationRole{ + ReplicationRoleAsyncReplica, + ReplicationRoleGeoAsyncReplica, + ReplicationRoleGeoSyncReplica, + ReplicationRoleNone, + ReplicationRolePrimary, + ReplicationRoleSecondary, + ReplicationRoleSyncReplica, + ReplicationRoleWalReplica, } } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client.go index 97f6d166a55c..dc63eed679a9 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client.go @@ -57,7 +57,7 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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,9 @@ func (client *DatabasesClient) BeginCreate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DatabasesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[DatabasesClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -77,7 +79,7 @@ func (client *DatabasesClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Creates a new database or updates an existing database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 func (client *DatabasesClient) create(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { @@ -117,7 +119,7 @@ func (client *DatabasesClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -125,7 +127,7 @@ func (client *DatabasesClient) createCreateRequest(ctx context.Context, resource // BeginDelete - Deletes a database. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // databaseName - The name of the database. @@ -136,7 +138,9 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DatabasesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -144,7 +148,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-06-01 +// Generated from API version 2022-12-01 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 { @@ -184,7 +188,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +196,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-06-01 +// Generated from API version 2022-12-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // databaseName - The name of the database. @@ -236,7 +240,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,8 +256,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases } // NewListByServerPager - List all the databases in a given server. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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.ListByServer method. @@ -305,7 +308,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client_example_test.go deleted file mode 100644 index 8d241fa72b52..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/databases_client_example_test.go +++ /dev/null @@ -1,125 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_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/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/DatabaseCreate.json -func ExampleDatabasesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewDatabasesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "TestGroup", - "testserver", - "db1", - armpostgresqlflexibleservers.Database{ - Properties: &armpostgresqlflexibleservers.DatabaseProperties{ - Charset: to.Ptr("utf8"), - Collation: to.Ptr("en_US.utf8"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewDatabasesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewDatabasesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestGroup", - "testserver", - "db1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewDatabasesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerPager("TestGroup", - "testserver", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client.go index eaaa906fc330..229690aa0f10 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client.go @@ -57,7 +57,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-06-01 +// Generated from API version 2022-12-01 // 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. @@ -70,7 +70,9 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -78,7 +80,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-06-01 +// Generated from API version 2022-12-01 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 { @@ -118,7 +120,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -126,7 +128,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Deletes a PostgreSQL server firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -138,7 +140,9 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -146,7 +150,7 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes a PostgreSQL server firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 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 { @@ -186,7 +190,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,7 +198,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso // Get - List all the firewall rules in a given server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -238,7 +242,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,8 +258,7 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew } // NewListByServerPager - List all the firewall rules in a given PostgreSQL server. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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.ListByServer @@ -308,7 +311,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client_example_test.go deleted file mode 100644 index c7b561f300aa..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/firewallrules_client_example_test.go +++ /dev/null @@ -1,125 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_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/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "testrg", - "testserver", - "rule1", - armpostgresqlflexibleservers.FirewallRule{ - Properties: &armpostgresqlflexibleservers.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "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/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testserver", - "rule1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/FirewallRuleListByServer.json -func ExampleFirewallRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerPager("testrg", - "testserver", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client.go index 294f7221e7ed..f813798a7e07 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client.go @@ -51,7 +51,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-06-01 +// Generated from API version 2022-12-01 // options - GetPrivateDNSZoneSuffixClientExecuteOptions contains the optional parameters for the GetPrivateDNSZoneSuffixClient.Execute // method. func (client *GetPrivateDNSZoneSuffixClient) Execute(ctx context.Context, options *GetPrivateDNSZoneSuffixClientExecuteOptions) (GetPrivateDNSZoneSuffixClientExecuteResponse, error) { @@ -77,7 +77,7 @@ func (client *GetPrivateDNSZoneSuffixClient) executeCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client_example_test.go deleted file mode 100644 index 77ce5581b5b9..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/getprivatednszonesuffix_client_example_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewGetPrivateDNSZoneSuffixClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Execute(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod index f55fc8e58f91..3b68d419796b 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client.go index 7a58a7879bce..0fbc5860196c 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client.go @@ -56,8 +56,7 @@ func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore } // NewExecutePager - Get capabilities at specified location in a given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // locationName - The name of the location. // options - LocationBasedCapabilitiesClientExecuteOptions contains the optional parameters for the LocationBasedCapabilitiesClient.Execute // method. @@ -105,7 +104,7 @@ func (client *LocationBasedCapabilitiesClient) executeCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client_example_test.go deleted file mode 100644 index e39dde1b931c..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/locationbasedcapabilities_client_example_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/CapabilitiesByLocation.json -func ExampleLocationBasedCapabilitiesClient_NewExecutePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewLocationBasedCapabilitiesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewExecutePager("westus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models.go index 1cea10f79ded..2f6beab3d558 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models.go @@ -11,6 +11,100 @@ package armpostgresqlflexibleservers import "time" +// ActiveDirectoryAdministrator - Represents an Active Directory administrator. +type ActiveDirectoryAdministrator struct { + // REQUIRED; Properties of the active directory administrator. + Properties *AdministratorProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ActiveDirectoryAdministratorAdd - Represents an Active Directory administrator. +type ActiveDirectoryAdministratorAdd struct { + // Properties of the active directory administrator. + Properties *AdministratorPropertiesForAdd `json:"properties,omitempty"` +} + +// AdministratorListResult - A list of active directory administrators. +type AdministratorListResult struct { + // The link used to get the next page of active directory. + NextLink *string `json:"nextLink,omitempty"` + + // The list of active directory administrators + Value []*ActiveDirectoryAdministrator `json:"value,omitempty"` +} + +// AdministratorProperties - The properties of an Active Directory administrator. +type AdministratorProperties struct { + // The objectId of the Active Directory administrator. + ObjectID *string `json:"objectId,omitempty"` + + // Active Directory administrator principal name. + PrincipalName *string `json:"principalName,omitempty"` + + // The principal type used to represent the type of Active Directory Administrator. + PrincipalType *PrincipalType `json:"principalType,omitempty"` + + // The tenantId of the Active Directory administrator. + TenantID *string `json:"tenantId,omitempty"` +} + +// AdministratorPropertiesForAdd - The properties of an Active Directory administrator. +type AdministratorPropertiesForAdd struct { + // Active Directory administrator principal name. + PrincipalName *string `json:"principalName,omitempty"` + + // The principal type used to represent the type of Active Directory Administrator. + PrincipalType *PrincipalType `json:"principalType,omitempty"` + + // The tenantId of the Active Directory administrator. + TenantID *string `json:"tenantId,omitempty"` +} + +// AdministratorsClientBeginCreateOptions contains the optional parameters for the AdministratorsClient.BeginCreate method. +type AdministratorsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AdministratorsClientBeginDeleteOptions contains the optional parameters for the AdministratorsClient.BeginDelete method. +type AdministratorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AdministratorsClientGetOptions contains the optional parameters for the AdministratorsClient.Get method. +type AdministratorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AdministratorsClientListByServerOptions contains the optional parameters for the AdministratorsClient.ListByServer method. +type AdministratorsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// AuthConfig - Authentication configuration properties of a server +type AuthConfig struct { + // If Enabled, Azure Active Directory authentication is enabled. + ActiveDirectoryAuth *ActiveDirectoryAuthEnum `json:"activeDirectoryAuth,omitempty"` + + // If Enabled, Password authentication is enabled. + PasswordAuth *PasswordAuthEnum `json:"passwordAuth,omitempty"` + + // Tenant id of the server. + TenantID *string `json:"tenantId,omitempty"` +} + // Backup properties of a server type Backup struct { // Backup retention days for the server. @@ -23,6 +117,16 @@ type Backup struct { EarliestRestoreDate *time.Time `json:"earliestRestoreDate,omitempty" azure:"ro"` } +// BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. +type BackupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientListByServerOptions contains the optional parameters for the BackupsClient.ListByServer method. +type BackupsClientListByServerOptions struct { + // placeholder for future optional parameters +} + // CapabilitiesListResult - location capability type CapabilitiesListResult struct { // READ-ONLY; Link to retrieve next page of results. @@ -34,12 +138,18 @@ type CapabilitiesListResult struct { // CapabilityProperties - Location capabilities. type CapabilityProperties struct { + // READ-ONLY; A value indicating whether fast provisioning is supported in this region. + FastProvisioningSupported *bool `json:"fastProvisioningSupported,omitempty" azure:"ro"` + // READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region. GeoBackupSupported *bool `json:"geoBackupSupported,omitempty" azure:"ro"` // READ-ONLY; The status Status *string `json:"status,omitempty" azure:"ro"` + // READ-ONLY + SupportedFastProvisioningEditions []*FastProvisioningEditionCapability `json:"supportedFastProvisioningEditions,omitempty" azure:"ro"` + // READ-ONLY SupportedFlexibleServerEditions []*FlexibleServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty" azure:"ro"` @@ -65,11 +175,31 @@ type CheckNameAvailabilityClientExecuteOptions struct { // placeholder for future optional parameters } -// CloudError - An error response from the Batch service. -type CloudError struct { - // Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows - // the OData error response format.) - Error *ErrorResponse `json:"error,omitempty"` +// CheckNameAvailabilityRequest - The check availability request body. +type CheckNameAvailabilityRequest struct { + // The name of the resource for which availability needs to be checked. + Name *string `json:"name,omitempty"` + + // The resource type. + Type *string `json:"type,omitempty"` +} + +// CheckNameAvailabilityResponse - The check availability result. +type CheckNameAvailabilityResponse struct { + // Detailed reason why the given name is available. + Message *string `json:"message,omitempty"` + + // Indicates if the resource name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` +} + +// CheckNameAvailabilityWithLocationClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityWithLocationClient.Execute +// method. +type CheckNameAvailabilityWithLocationClientExecuteOptions struct { + // placeholder for future optional parameters } // Configuration - Represents a Configuration. @@ -83,13 +213,19 @@ type Configuration struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// ConfigurationForUpdate - Represents a Configuration. +type ConfigurationForUpdate struct { + // The properties of a configuration. + Properties *ConfigurationProperties `json:"properties,omitempty"` +} + // ConfigurationListResult - A list of server configurations. type ConfigurationListResult struct { // The link used to get the next page of operations. @@ -157,6 +293,18 @@ type ConfigurationsClientListByServerOptions struct { // placeholder for future optional parameters } +// DataEncryption - Data encryption properties of a server +type DataEncryption struct { + // URI for the key for data encryption for primary server. + PrimaryKeyURI *string `json:"primaryKeyURI,omitempty"` + + // Resource Id for the User assigned identity to be used for data encryption for primary server. + PrimaryUserAssignedIdentityID *string `json:"primaryUserAssignedIdentityId,omitempty"` + + // Data encryption type to depict if it is System assigned vs Azure Key vault. + Type *ArmServerKeyType `json:"type,omitempty"` +} + // Database - Represents a Database. type Database struct { // The properties of a database. @@ -168,7 +316,7 @@ type Database struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -217,10 +365,10 @@ type DatabasesClientListByServerOptions struct { // DelegatedSubnetUsage - Delegated subnet usage data. type DelegatedSubnetUsage struct { - // READ-ONLY; name of the subnet + // READ-ONLY; Name of the delegated subnet for which IP addresses are in use SubnetName *string `json:"subnetName,omitempty" azure:"ro"` - // READ-ONLY; Number of used delegated subnets + // READ-ONLY; Number of IP addresses used by the delegated subnet Usage *int64 `json:"usage,omitempty" azure:"ro"` } @@ -233,9 +381,8 @@ type ErrorAdditionalInfo struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.) -type ErrorResponse struct { +// ErrorDetail - The error detail. +type ErrorDetail struct { // READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` @@ -243,7 +390,7 @@ type ErrorResponse struct { Code *string `json:"code,omitempty" azure:"ro"` // READ-ONLY; The error details. - Details []*ErrorResponse `json:"details,omitempty" azure:"ro"` + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` // READ-ONLY; The error message. Message *string `json:"message,omitempty" azure:"ro"` @@ -252,6 +399,24 @@ type ErrorResponse struct { Target *string `json:"target,omitempty" azure:"ro"` } +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +type FastProvisioningEditionCapability struct { + // READ-ONLY; Fast provisioning supported sku name + SupportedSKU *string `json:"supportedSku,omitempty" azure:"ro"` + + // READ-ONLY; Fast provisioning supported version + SupportedServerVersions *string `json:"supportedServerVersions,omitempty" azure:"ro"` + + // READ-ONLY; Fast provisioning supported storage in Gb + SupportedStorageGb *int64 `json:"supportedStorageGb,omitempty" azure:"ro"` +} + // FirewallRule - Represents a server firewall rule. type FirewallRule struct { // REQUIRED; The properties of a firewall rule. @@ -263,7 +428,7 @@ type FirewallRule struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -385,31 +550,22 @@ type MaintenanceWindow struct { // NameAvailability - Represents a resource name availability. type NameAvailability struct { - // READ-ONLY; Error Message. - Message *string `json:"message,omitempty" azure:"ro"` + // Detailed reason why the given name is available. + Message *string `json:"message,omitempty"` - // READ-ONLY; name of the PostgreSQL server. - Name *string `json:"name,omitempty" azure:"ro"` + // Indicates if the resource name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` - // READ-ONLY; Indicates whether the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` + // The reason why the given name is not available. + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` - // READ-ONLY; The name availability reason. - Reason *Reason `json:"reason,omitempty" azure:"ro"` + // READ-ONLY; name of the PostgreSQL server. + Name *string `json:"name,omitempty" azure:"ro"` // READ-ONLY; type of the server Type *string `json:"type,omitempty" azure:"ro"` } -// NameAvailabilityRequest - Request from client to check resource name availability. -type NameAvailabilityRequest struct { - // REQUIRED; Resource name to verify. - Name *string `json:"name,omitempty"` - - // Resource type used for verification. - Type *string `json:"type,omitempty"` -} - // Network properties of a server type Network struct { // delegated subnet arm resource id. @@ -490,10 +646,18 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.ListByServer method. +type ReplicasClientListByServerOptions struct { + // placeholder for future optional parameters +} + // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -502,6 +666,9 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -529,6 +696,9 @@ type Server struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` + // Describes the identity of the application. + Identity *UserAssignedIdentity `json:"identity,omitempty"` + // Properties of the server. Properties *ServerProperties `json:"properties,omitempty"` @@ -544,17 +714,56 @@ type Server struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The system metadata relating to this resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// ServerBackup - Server backup properties +type ServerBackup struct { + // The properties of a server backup. + Properties *ServerBackupProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ServerBackupListResult - A list of server backups. +type ServerBackupListResult struct { + // The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` + + // The list of backups of a server. + Value []*ServerBackup `json:"value,omitempty"` +} + +// ServerBackupProperties - The properties of a server backup. +type ServerBackupProperties struct { + // Backup type. + BackupType *Origin `json:"backupType,omitempty"` + + // Backup completed time (ISO8601 format). + CompletedTime *time.Time `json:"completedTime,omitempty"` + + // Backup source + Source *string `json:"source,omitempty"` +} + // ServerForUpdate - Represents a server to be updated. type ServerForUpdate struct { - // The location the resource resides in. - Location *string `json:"location,omitempty"` + // Describes the identity of the application. + Identity *UserAssignedIdentity `json:"identity,omitempty"` // Properties of the server. Properties *ServerPropertiesForUpdate `json:"properties,omitempty"` @@ -584,6 +793,9 @@ type ServerProperties struct { // The administrator login password (required for server creation). AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthConfig properties of a server. + AuthConfig *AuthConfig `json:"authConfig,omitempty"` + // availability zone information of the server. AvailabilityZone *string `json:"availabilityZone,omitempty"` @@ -593,6 +805,9 @@ type ServerProperties struct { // The mode to create a new PostgreSQL server. CreateMode *CreateMode `json:"createMode,omitempty"` + // Data encryption properties of a server. + DataEncryption *DataEncryption `json:"dataEncryption,omitempty"` + // High availability properties of a server. HighAvailability *HighAvailability `json:"highAvailability,omitempty"` @@ -602,10 +817,18 @@ type ServerProperties struct { // Network properties of a server. Network *Network `json:"network,omitempty"` - // Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'. + // Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore' + // or 'GeoRestore'. PointInTimeUTC *time.Time `json:"pointInTimeUTC,omitempty"` - // The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'. + // Replicas allowed for a server. + ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` + + // Replication role of the server + ReplicationRole *ReplicationRole `json:"replicationRole,omitempty"` + + // The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' + // or 'Replica'. SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"` // Storage properties of a server. @@ -628,20 +851,32 @@ type ServerPropertiesForUpdate struct { // The password of the administrator login. AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + // AuthConfig properties of a server. + AuthConfig *AuthConfig `json:"authConfig,omitempty"` + // Backup properties of a server. Backup *Backup `json:"backup,omitempty"` // The mode to update a new PostgreSQL server. CreateMode *CreateModeForUpdate `json:"createMode,omitempty"` + // Data encryption properties of a server. + DataEncryption *DataEncryption `json:"dataEncryption,omitempty"` + // High availability properties of a server. HighAvailability *HighAvailability `json:"highAvailability,omitempty"` // Maintenance window properties of a server. MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + // Replication role of the server + ReplicationRole *ReplicationRole `json:"replicationRole,omitempty"` + // Storage properties of a server. Storage *Storage `json:"storage,omitempty"` + + // PostgreSQL Server version. + Version *ServerVersion `json:"version,omitempty"` } // ServerVersionCapability - Server version capabilities. @@ -654,6 +889,9 @@ type ServerVersionCapability struct { // READ-ONLY SupportedVcores []*VcoreCapability `json:"supportedVcores,omitempty" azure:"ro"` + + // READ-ONLY; Supported servers versions to upgrade + SupportedVersionsToUpgrade []*string `json:"supportedVersionsToUpgrade,omitempty" azure:"ro"` } // ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. @@ -740,6 +978,26 @@ type StorageMBCapability struct { // READ-ONLY; supported IOPS SupportedIops *int64 `json:"supportedIops,omitempty" azure:"ro"` + + // READ-ONLY + SupportedUpgradableTierList []*StorageTierCapability `json:"supportedUpgradableTierList,omitempty" azure:"ro"` +} + +type StorageTierCapability struct { + // READ-ONLY; Supported IOPS for this storage tier + Iops *int64 `json:"iops,omitempty" azure:"ro"` + + // READ-ONLY; Indicates if this is a baseline storage tier or not + IsBaseline *bool `json:"isBaseline,omitempty" azure:"ro"` + + // READ-ONLY; Name to represent Storage tier capability + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Status os this storage tier + Status *string `json:"status,omitempty" azure:"ro"` + + // READ-ONLY; Storage tier name + TierName *string `json:"tierName,omitempty" azure:"ro"` } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -778,10 +1036,31 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } +// UserAssignedIdentity - Information describing the identities associated with this application. +type UserAssignedIdentity struct { + // REQUIRED; the types of identities associated with this resource; currently restricted to 'SystemAssigned and UserAssigned' + Type *IdentityType `json:"type,omitempty"` + + // represents user assigned identities map. + UserAssignedIdentities map[string]*UserIdentity `json:"userAssignedIdentities,omitempty"` +} + +// UserIdentity - Describes a single user-assigned identity associated with the application. +type UserIdentity struct { + // the client identifier of the Service Principal which this identity represents. + ClientID *string `json:"clientId,omitempty"` + + // the object identifier of the Service Principal which this identity represents. + PrincipalID *string `json:"principalId,omitempty"` +} + // VcoreCapability - Vcores capability type VcoreCapability struct { // READ-ONLY; vCore name @@ -817,9 +1096,9 @@ type VirtualNetworkSubnetUsageResult struct { // READ-ONLY DelegatedSubnetsUsage []*DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty" azure:"ro"` - // READ-ONLY; The location the resource resides in. + // READ-ONLY; location of the delegated subnet usage Location *string `json:"location,omitempty" azure:"ro"` - // READ-ONLY; The subscription ID. + // READ-ONLY; subscriptionId of the delegated subnet usage SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"` } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models_serde.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models_serde.go index f9860adf7860..bc283a28f295 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models_serde.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/models_serde.go @@ -16,6 +16,216 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type ActiveDirectoryAdministrator. +func (a ActiveDirectoryAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 ActiveDirectoryAdministrator. +func (a *ActiveDirectoryAdministrator) 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 ActiveDirectoryAdministratorAdd. +func (a ActiveDirectoryAdministratorAdd) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryAdministratorAdd. +func (a *ActiveDirectoryAdministratorAdd) 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 "properties": + err = unpopulate(val, "Properties", &a.Properties) + 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 AdministratorListResult. +func (a AdministratorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + populate(objectMap, "objectId", a.ObjectID) + populate(objectMap, "principalName", a.PrincipalName) + populate(objectMap, "principalType", a.PrincipalType) + 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 "objectId": + err = unpopulate(val, "ObjectID", &a.ObjectID) + delete(rawMsg, key) + case "principalName": + err = unpopulate(val, "PrincipalName", &a.PrincipalName) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) + 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 AdministratorPropertiesForAdd. +func (a AdministratorPropertiesForAdd) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalName", a.PrincipalName) + populate(objectMap, "principalType", a.PrincipalType) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdministratorPropertiesForAdd. +func (a *AdministratorPropertiesForAdd) 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 "principalName": + err = unpopulate(val, "PrincipalName", &a.PrincipalName) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) + 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 AuthConfig. +func (a AuthConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activeDirectoryAuth", a.ActiveDirectoryAuth) + populate(objectMap, "passwordAuth", a.PasswordAuth) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthConfig. +func (a *AuthConfig) 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 "activeDirectoryAuth": + err = unpopulate(val, "ActiveDirectoryAuth", &a.ActiveDirectoryAuth) + delete(rawMsg, key) + case "passwordAuth": + err = unpopulate(val, "PasswordAuth", &a.PasswordAuth) + 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 Backup. func (b Backup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -85,8 +295,10 @@ func (c *CapabilitiesListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CapabilityProperties. func (c CapabilityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "fastProvisioningSupported", c.FastProvisioningSupported) populate(objectMap, "geoBackupSupported", c.GeoBackupSupported) populate(objectMap, "status", c.Status) + populate(objectMap, "supportedFastProvisioningEditions", c.SupportedFastProvisioningEditions) populate(objectMap, "supportedFlexibleServerEditions", c.SupportedFlexibleServerEditions) populate(objectMap, "supportedHAMode", c.SupportedHAMode) populate(objectMap, "supportedHyperscaleNodeEditions", c.SupportedHyperscaleNodeEditions) @@ -105,12 +317,18 @@ func (c *CapabilityProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "fastProvisioningSupported": + err = unpopulate(val, "FastProvisioningSupported", &c.FastProvisioningSupported) + delete(rawMsg, key) case "geoBackupSupported": err = unpopulate(val, "GeoBackupSupported", &c.GeoBackupSupported) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) + case "supportedFastProvisioningEditions": + err = unpopulate(val, "SupportedFastProvisioningEditions", &c.SupportedFastProvisioningEditions) + delete(rawMsg, key) case "supportedFlexibleServerEditions": err = unpopulate(val, "SupportedFlexibleServerEditions", &c.SupportedFlexibleServerEditions) delete(rawMsg, key) @@ -137,15 +355,16 @@ func (c *CapabilityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudError. -func (c CloudError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "error", c.Error) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. -func (c *CloudError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -153,8 +372,46 @@ func (c *CloudError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &c.Error) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse. +func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse. +func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) delete(rawMsg, key) } if err != nil { @@ -207,6 +464,33 @@ func (c *Configuration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ConfigurationForUpdate. +func (c ConfigurationForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationForUpdate. +func (c *ConfigurationForUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ConfigurationListResult. func (c ConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -305,6 +589,41 @@ func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DataEncryption. +func (d DataEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "primaryKeyURI", d.PrimaryKeyURI) + populate(objectMap, "primaryUserAssignedIdentityId", d.PrimaryUserAssignedIdentityID) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataEncryption. +func (d *DataEncryption) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primaryKeyURI": + err = unpopulate(val, "PrimaryKeyURI", &d.PrimaryKeyURI) + delete(rawMsg, key) + case "primaryUserAssignedIdentityId": + err = unpopulate(val, "PrimaryUserAssignedIdentityID", &d.PrimaryUserAssignedIdentityID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Database. func (d Database) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -472,8 +791,8 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) @@ -483,8 +802,8 @@ func (e ErrorResponse) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -515,6 +834,68 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FastProvisioningEditionCapability. +func (f FastProvisioningEditionCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "supportedSku", f.SupportedSKU) + populate(objectMap, "supportedServerVersions", f.SupportedServerVersions) + populate(objectMap, "supportedStorageGb", f.SupportedStorageGb) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FastProvisioningEditionCapability. +func (f *FastProvisioningEditionCapability) 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 "supportedSku": + err = unpopulate(val, "SupportedSKU", &f.SupportedSKU) + delete(rawMsg, key) + case "supportedServerVersions": + err = unpopulate(val, "SupportedServerVersions", &f.SupportedServerVersions) + delete(rawMsg, key) + case "supportedStorageGb": + err = unpopulate(val, "SupportedStorageGb", &f.SupportedStorageGb) + 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 FirewallRule. func (f FirewallRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -819,37 +1200,6 @@ func (n *NameAvailability) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type NameAvailabilityRequest. -func (n NameAvailabilityRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", n.Name) - populate(objectMap, "type", n.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityRequest. -func (n *NameAvailabilityRequest) 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", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Network. func (n Network) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -1038,6 +1388,7 @@ func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1057,6 +1408,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1073,6 +1427,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -1092,6 +1447,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -1169,6 +1527,7 @@ func (s *SKU) UnmarshalJSON(data []byte) error { func (s Server) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -1191,6 +1550,9 @@ func (s *Server) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -1220,10 +1582,119 @@ func (s *Server) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServerBackup. +func (s ServerBackup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBackup. +func (s *ServerBackup) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + 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 ServerBackupListResult. +func (s ServerBackupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBackupListResult. +func (s *ServerBackupListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 ServerBackupProperties. +func (s ServerBackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupType", s.BackupType) + populateTimeRFC3339(objectMap, "completedTime", s.CompletedTime) + populate(objectMap, "source", s.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerBackupProperties. +func (s *ServerBackupProperties) 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 "backupType": + err = unpopulate(val, "BackupType", &s.BackupType) + delete(rawMsg, key) + case "completedTime": + err = unpopulateTimeRFC3339(val, "CompletedTime", &s.CompletedTime) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ServerForUpdate. func (s ServerForUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "location", s.Location) + populate(objectMap, "identity", s.Identity) populate(objectMap, "properties", s.Properties) populate(objectMap, "sku", s.SKU) populate(objectMap, "tags", s.Tags) @@ -1239,8 +1710,8 @@ func (s *ServerForUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "location": - err = unpopulate(val, "Location", &s.Location) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) @@ -1295,15 +1766,19 @@ func (s ServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "administratorLogin", s.AdministratorLogin) populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) + populate(objectMap, "authConfig", s.AuthConfig) populate(objectMap, "availabilityZone", s.AvailabilityZone) populate(objectMap, "backup", s.Backup) populate(objectMap, "createMode", s.CreateMode) + populate(objectMap, "dataEncryption", s.DataEncryption) populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) populate(objectMap, "highAvailability", s.HighAvailability) populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) populate(objectMap, "minorVersion", s.MinorVersion) populate(objectMap, "network", s.Network) populateTimeRFC3339(objectMap, "pointInTimeUTC", s.PointInTimeUTC) + populate(objectMap, "replicaCapacity", s.ReplicaCapacity) + populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "sourceServerResourceId", s.SourceServerResourceID) populate(objectMap, "state", s.State) populate(objectMap, "storage", s.Storage) @@ -1326,6 +1801,9 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { case "administratorLoginPassword": err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) delete(rawMsg, key) + case "authConfig": + err = unpopulate(val, "AuthConfig", &s.AuthConfig) + delete(rawMsg, key) case "availabilityZone": err = unpopulate(val, "AvailabilityZone", &s.AvailabilityZone) delete(rawMsg, key) @@ -1335,6 +1813,9 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { case "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) + case "dataEncryption": + err = unpopulate(val, "DataEncryption", &s.DataEncryption) + delete(rawMsg, key) case "fullyQualifiedDomainName": err = unpopulate(val, "FullyQualifiedDomainName", &s.FullyQualifiedDomainName) delete(rawMsg, key) @@ -1353,6 +1834,12 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { case "pointInTimeUTC": err = unpopulateTimeRFC3339(val, "PointInTimeUTC", &s.PointInTimeUTC) delete(rawMsg, key) + case "replicaCapacity": + err = unpopulate(val, "ReplicaCapacity", &s.ReplicaCapacity) + delete(rawMsg, key) + case "replicationRole": + err = unpopulate(val, "ReplicationRole", &s.ReplicationRole) + delete(rawMsg, key) case "sourceServerResourceId": err = unpopulate(val, "SourceServerResourceID", &s.SourceServerResourceID) delete(rawMsg, key) @@ -1377,11 +1864,15 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { func (s ServerPropertiesForUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) + populate(objectMap, "authConfig", s.AuthConfig) populate(objectMap, "backup", s.Backup) populate(objectMap, "createMode", s.CreateMode) + populate(objectMap, "dataEncryption", s.DataEncryption) populate(objectMap, "highAvailability", s.HighAvailability) populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) + populate(objectMap, "replicationRole", s.ReplicationRole) populate(objectMap, "storage", s.Storage) + populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } @@ -1397,21 +1888,33 @@ func (s *ServerPropertiesForUpdate) UnmarshalJSON(data []byte) error { case "administratorLoginPassword": err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) delete(rawMsg, key) + case "authConfig": + err = unpopulate(val, "AuthConfig", &s.AuthConfig) + delete(rawMsg, key) case "backup": err = unpopulate(val, "Backup", &s.Backup) delete(rawMsg, key) case "createMode": err = unpopulate(val, "CreateMode", &s.CreateMode) delete(rawMsg, key) + case "dataEncryption": + err = unpopulate(val, "DataEncryption", &s.DataEncryption) + delete(rawMsg, key) case "highAvailability": err = unpopulate(val, "HighAvailability", &s.HighAvailability) delete(rawMsg, key) case "maintenanceWindow": err = unpopulate(val, "MaintenanceWindow", &s.MaintenanceWindow) delete(rawMsg, key) + case "replicationRole": + err = unpopulate(val, "ReplicationRole", &s.ReplicationRole) + delete(rawMsg, key) 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) @@ -1426,6 +1929,7 @@ func (s ServerVersionCapability) MarshalJSON() ([]byte, error) { populate(objectMap, "name", s.Name) populate(objectMap, "status", s.Status) populate(objectMap, "supportedVcores", s.SupportedVcores) + populate(objectMap, "supportedVersionsToUpgrade", s.SupportedVersionsToUpgrade) return json.Marshal(objectMap) } @@ -1447,6 +1951,9 @@ func (s *ServerVersionCapability) UnmarshalJSON(data []byte) error { case "supportedVcores": err = unpopulate(val, "SupportedVcores", &s.SupportedVcores) delete(rawMsg, key) + case "supportedVersionsToUpgrade": + err = unpopulate(val, "SupportedVersionsToUpgrade", &s.SupportedVersionsToUpgrade) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1524,6 +2031,7 @@ func (s StorageMBCapability) MarshalJSON() ([]byte, error) { populate(objectMap, "status", s.Status) populate(objectMap, "storageSizeMB", s.StorageSizeMB) populate(objectMap, "supportedIops", s.SupportedIops) + populate(objectMap, "supportedUpgradableTierList", s.SupportedUpgradableTierList) return json.Marshal(objectMap) } @@ -1548,6 +2056,52 @@ func (s *StorageMBCapability) UnmarshalJSON(data []byte) error { case "supportedIops": err = unpopulate(val, "SupportedIops", &s.SupportedIops) delete(rawMsg, key) + case "supportedUpgradableTierList": + err = unpopulate(val, "SupportedUpgradableTierList", &s.SupportedUpgradableTierList) + 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 StorageTierCapability. +func (s StorageTierCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "iops", s.Iops) + populate(objectMap, "isBaseline", s.IsBaseline) + populate(objectMap, "name", s.Name) + populate(objectMap, "status", s.Status) + populate(objectMap, "tierName", s.TierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageTierCapability. +func (s *StorageTierCapability) 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 "iops": + err = unpopulate(val, "Iops", &s.Iops) + delete(rawMsg, key) + case "isBaseline": + err = unpopulate(val, "IsBaseline", &s.IsBaseline) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &s.TierName) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -1609,6 +2163,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -1632,6 +2187,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -1646,6 +2204,68 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", u.Type) + populate(objectMap, "userAssignedIdentities", u.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &u.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserIdentity. +func (u UserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentity. +func (u *UserIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VcoreCapability. func (v VcoreCapability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client.go index 52d682f8a0bc..67b1b17c2403 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client.go @@ -51,7 +51,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // List - Lists all of the available REST API operations. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { req, err := client.listCreateRequest(ctx, options) @@ -76,7 +76,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client_example_test.go deleted file mode 100644 index b47e00eac08f..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/operations_client_example_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/OperationList.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/replicas_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/replicas_client.go new file mode 100644 index 000000000000..e31bd22cc134 --- /dev/null +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/replicas_client.go @@ -0,0 +1,118 @@ +//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 armpostgresqlflexibleservers + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReplicasClient contains the methods for the Replicas group. +// Don't use this type directly, use NewReplicasClient() instead. +type ReplicasClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewReplicasClient creates a new instance of ReplicasClient 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 NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ReplicasClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListByServerPager - List all the replicas for a given server. +// Generated from API version 2022-12-01 +// 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.ListByServer method. +func (client *ReplicasClient) NewListByServerPager(resourceGroupName string, serverName string, options *ReplicasClientListByServerOptions) *runtime.Pager[ReplicasClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicasClientListByServerResponse]{ + More: func(page ReplicasClientListByServerResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ReplicasClientListByServerResponse) (ReplicasClientListByServerResponse, error) { + req, err := client.listByServerCreateRequest(ctx, resourceGroupName, serverName, options) + if err != nil { + return ReplicasClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReplicasClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ReplicasClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverName string, options *ReplicasClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/replicas" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *ReplicasClient) listByServerHandleResponse(resp *http.Response) (ReplicasClientListByServerResponse, error) { + result := ReplicasClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { + return ReplicasClientListByServerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/response_types.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/response_types.go index 023592a15458..06f781d6d9c0 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/response_types.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/response_types.go @@ -9,11 +9,46 @@ package armpostgresqlflexibleservers +// AdministratorsClientCreateResponse contains the response from method AdministratorsClient.Create. +type AdministratorsClientCreateResponse struct { + ActiveDirectoryAdministrator +} + +// AdministratorsClientDeleteResponse contains the response from method AdministratorsClient.Delete. +type AdministratorsClientDeleteResponse struct { + // placeholder for future response values +} + +// AdministratorsClientGetResponse contains the response from method AdministratorsClient.Get. +type AdministratorsClientGetResponse struct { + ActiveDirectoryAdministrator +} + +// AdministratorsClientListByServerResponse contains the response from method AdministratorsClient.ListByServer. +type AdministratorsClientListByServerResponse struct { + AdministratorListResult +} + +// BackupsClientGetResponse contains the response from method BackupsClient.Get. +type BackupsClientGetResponse struct { + ServerBackup +} + +// BackupsClientListByServerResponse contains the response from method BackupsClient.ListByServer. +type BackupsClientListByServerResponse struct { + ServerBackupListResult +} + // CheckNameAvailabilityClientExecuteResponse contains the response from method CheckNameAvailabilityClient.Execute. type CheckNameAvailabilityClientExecuteResponse struct { NameAvailability } +// CheckNameAvailabilityWithLocationClientExecuteResponse contains the response from method CheckNameAvailabilityWithLocationClient.Execute. +type CheckNameAvailabilityWithLocationClientExecuteResponse struct { + NameAvailability +} + // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { Configuration @@ -90,6 +125,11 @@ type OperationsClientListResponse struct { OperationListResult } +// ReplicasClientListByServerResponse contains the response from method ReplicasClient.ListByServer. +type ReplicasClientListByServerResponse struct { + ServerListResult +} + // ServersClientCreateResponse contains the response from method ServersClient.Create. type ServersClientCreateResponse struct { Server diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client.go index 7ce0bb81d994..bc1f1267467c 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client.go @@ -57,7 +57,7 @@ func NewServersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a new server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -68,7 +68,9 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServersClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -76,7 +78,7 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a new server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 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 { @@ -112,7 +114,7 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -120,7 +122,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-06-01 +// Generated from API version 2022-12-01 // 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. @@ -130,7 +132,9 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -138,7 +142,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-06-01 +// Generated from API version 2022-12-01 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 { @@ -174,7 +178,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +186,7 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets information about a server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -221,7 +225,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -237,8 +241,7 @@ func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClie } // NewListPager - List all the servers in a given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // options - ServersClientListOptions contains the optional parameters for the ServersClient.List method. func (client *ServersClient) NewListPager(options *ServersClientListOptions) *runtime.Pager[ServersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ServersClientListResponse]{ @@ -280,7 +283,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -296,8 +299,7 @@ func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersCli } // NewListByResourceGroupPager - List all the servers in a given resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // options - ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.ListByResourceGroup // method. @@ -345,7 +347,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,7 +364,7 @@ func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Respon // BeginRestart - Restarts a server. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // resourceGroupName - The name of the resource group. The name is case insensitive. // serverName - The name of the server. // options - ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. @@ -372,7 +374,9 @@ func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientRestartResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServersClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientRestartResponse](options.ResumeToken, client.pl, nil) } @@ -380,7 +384,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-06-01 +// Generated from API version 2022-12-01 func (client *ServersClient) restart(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { @@ -416,7 +420,7 @@ func (client *ServersClient) restartCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -427,7 +431,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-06-01 +// Generated from API version 2022-12-01 // 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. @@ -437,7 +441,9 @@ func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[ServersClientStartResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServersClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientStartResponse](options.ResumeToken, client.pl, nil) } @@ -445,7 +451,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-06-01 +// Generated from API version 2022-12-01 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 { @@ -481,7 +487,7 @@ func (client *ServersClient) startCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -489,7 +495,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-06-01 +// Generated from API version 2022-12-01 // 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. @@ -499,7 +505,9 @@ func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller[ServersClientStopResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServersClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientStopResponse](options.ResumeToken, client.pl, nil) } @@ -507,7 +515,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-06-01 +// Generated from API version 2022-12-01 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 { @@ -543,7 +551,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -552,7 +560,7 @@ func (client *ServersClient) stopCreateRequest(ctx context.Context, resourceGrou // BeginUpdate - Updates an existing server. The request body can contain one to many of the properties present in the normal // server definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 // 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. @@ -563,7 +571,9 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ServersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ServersClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -572,7 +582,7 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates an existing server. The request body can contain one to many of the properties present in the normal server // definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-06-01 +// Generated from API version 2022-12-01 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 { @@ -608,7 +618,7 @@ func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client_example_test.go deleted file mode 100644 index 21c9cbc9fc39..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/servers_client_example_test.go +++ /dev/null @@ -1,264 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_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/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerCreatePointInTimeRestore.json -func ExampleServersClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testrg", - "pgtestsvc5", - armpostgresqlflexibleservers.Server{ - Location: to.Ptr("westus"), - Properties: &armpostgresqlflexibleservers.ServerProperties{ - CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModePointInTimeRestore), - PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-27T00:04:59.4078005+00:00"); return t }()), - SourceServerResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerUpdate.json -func ExampleServersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "TestGroup", - "pgtestsvc4", - armpostgresqlflexibleservers.ServerForUpdate{ - Location: to.Ptr("westus"), - Properties: &armpostgresqlflexibleservers.ServerPropertiesForUpdate{ - AdministratorLoginPassword: to.Ptr("newpassword"), - Backup: &armpostgresqlflexibleservers.Backup{ - BackupRetentionDays: to.Ptr[int32](20), - }, - CreateMode: to.Ptr(armpostgresqlflexibleservers.CreateModeForUpdateUpdate), - Storage: &armpostgresqlflexibleservers.Storage{ - StorageSizeGB: to.Ptr[int32](1024), - }, - }, - SKU: &armpostgresqlflexibleservers.SKU{ - Name: to.Ptr("Standard_D8s_v3"), - Tier: to.Ptr(armpostgresqlflexibleservers.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "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/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerGet.json -func ExampleServersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "pgtestsvc1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerListByResourceGroup.json -func ExampleServersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/ServerList.json -func ExampleServersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, - "testrg", - "testserver", - &armpostgresqlflexibleservers.ServersClientBeginRestartOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "testrg", - "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/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-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() - client, err := armpostgresqlflexibleservers.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStop(ctx, - "testrg", - "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) - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client.go index 6f6dabc3c060..84b1149dd9de 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client.go @@ -57,7 +57,7 @@ func NewVirtualNetworkSubnetUsageClient(subscriptionID string, credential azcore // 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-06-01 +// Generated from API version 2022-12-01 // locationName - The name of the location. // parameters - The required parameters for creating or updating a server. // options - VirtualNetworkSubnetUsageClientExecuteOptions contains the optional parameters for the VirtualNetworkSubnetUsageClient.Execute @@ -93,7 +93,7 @@ func (client *VirtualNetworkSubnetUsageClient) executeCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client_example_test.go deleted file mode 100644 index d0699e807569..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/virtualnetworksubnetusage_client_example_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlflexibleservers_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/postgresql/armpostgresqlflexibleservers" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2021-06-01/examples/VirtualNetworkSubnetUsage.json -func ExampleVirtualNetworkSubnetUsageClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlflexibleservers.NewVirtualNetworkSubnetUsageClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Execute(ctx, - "westus", - armpostgresqlflexibleservers.VirtualNetworkSubnetUsageParameter{ - VirtualNetworkArmResourceID: 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) - } - // TODO: use response item - _ = res -}