diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md index d62a45f1cc1c..af37ab548bda 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md @@ -1,5 +1,45 @@ # Release History +## 0.6.0 (2023-02-23) +### Features Added + +- New value `ArcSQLServerLicenseTypeLicenseOnly`, `ArcSQLServerLicenseTypePAYG`, `ArcSQLServerLicenseTypeServerCAL` added to type alias `ArcSQLServerLicenseType` +- New value `EditionTypeBusinessIntelligence` added to type alias `EditionType` +- New value `HostTypeAWSKubernetesService`, `HostTypeAWSVMWareVirtualMachine`, `HostTypeAzureKubernetesService`, `HostTypeAzureVMWareVirtualMachine`, `HostTypeAzureVirtualMachine`, `HostTypeContainer`, `HostTypeGCPKubernetesService`, `HostTypeGCPVMWareVirtualMachine` added to type alias `HostType` +- New type alias `DatabaseState` with values `DatabaseStateCopying`, `DatabaseStateEmergency`, `DatabaseStateOffline`, `DatabaseStateOfflineSecondary`, `DatabaseStateOnline`, `DatabaseStateRecovering`, `DatabaseStateRecoveryPending`, `DatabaseStateRestoring`, `DatabaseStateSuspect` +- New type alias `FailoverGroupPartnerSyncMode` with values `FailoverGroupPartnerSyncModeAsync`, `FailoverGroupPartnerSyncModeSync` +- New type alias `InstanceFailoverGroupRole` with values `InstanceFailoverGroupRoleForcePrimaryAllowDataLoss`, `InstanceFailoverGroupRoleForceSecondary`, `InstanceFailoverGroupRolePrimary`, `InstanceFailoverGroupRoleSecondary` +- New type alias `ProvisioningState` with values `ProvisioningStateAccepted`, `ProvisioningStateCanceled`, `ProvisioningStateFailed`, `ProvisioningStateSucceeded` +- New type alias `RecoveryMode` with values `RecoveryModeBulkLogged`, `RecoveryModeFull`, `RecoveryModeSimple` +- New type alias `State` with values `StateFailed`, `StateSucceeded`, `StateWaiting` +- New function `NewFailoverGroupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FailoverGroupsClient, error)` +- New function `*FailoverGroupsClient.BeginCreate(context.Context, string, string, string, FailoverGroupResource, *FailoverGroupsClientBeginCreateOptions) (*runtime.Poller[FailoverGroupsClientCreateResponse], error)` +- New function `*FailoverGroupsClient.BeginDelete(context.Context, string, string, string, *FailoverGroupsClientBeginDeleteOptions) (*runtime.Poller[FailoverGroupsClientDeleteResponse], error)` +- New function `*FailoverGroupsClient.Get(context.Context, string, string, string, *FailoverGroupsClientGetOptions) (FailoverGroupsClientGetResponse, error)` +- New function `*FailoverGroupsClient.NewListPager(string, string, *FailoverGroupsClientListOptions) *runtime.Pager[FailoverGroupsClientListResponse]` +- New function `NewSQLServerDatabasesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SQLServerDatabasesClient, error)` +- New function `*SQLServerDatabasesClient.Create(context.Context, string, string, string, SQLServerDatabaseResource, *SQLServerDatabasesClientCreateOptions) (SQLServerDatabasesClientCreateResponse, error)` +- New function `*SQLServerDatabasesClient.Delete(context.Context, string, string, string, *SQLServerDatabasesClientDeleteOptions) (SQLServerDatabasesClientDeleteResponse, error)` +- New function `*SQLServerDatabasesClient.Get(context.Context, string, string, string, *SQLServerDatabasesClientGetOptions) (SQLServerDatabasesClientGetResponse, error)` +- New function `*SQLServerDatabasesClient.NewListPager(string, string, *SQLServerDatabasesClientListOptions) *runtime.Pager[SQLServerDatabasesClientListResponse]` +- New function `*SQLServerDatabasesClient.Update(context.Context, string, string, string, SQLServerDatabaseUpdate, *SQLServerDatabasesClientUpdateOptions) (SQLServerDatabasesClientUpdateResponse, error)` +- New struct `AGReplicas` +- New struct `ArcSQLServerDatabaseListResult` +- New struct `FailoverGroupListResult` +- New struct `FailoverGroupProperties` +- New struct `FailoverGroupResource` +- New struct `FailoverGroupSpec` +- New struct `FailoverGroupStatus` +- New struct `FailoverGroupsClient` +- New struct `SQLServerDatabaseResource` +- New struct `SQLServerDatabaseResourceProperties` +- New struct `SQLServerDatabaseResourcePropertiesBackupInformation` +- New struct `SQLServerDatabaseResourcePropertiesDatabaseOptions` +- New struct `SQLServerDatabaseUpdate` +- New struct `SQLServerDatabasesClient` +- New field `Cores` in struct `SQLServerInstanceProperties` + + ## 0.5.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurearcdata/armazurearcdata` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_activedirectoryconnectors_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go similarity index 87% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_activedirectoryconnectors_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go index 3a95e25b50c9..ca3ea4ace453 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_activedirectoryconnectors_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -31,9 +32,9 @@ type ActiveDirectoryConnectorsClient struct { } // NewActiveDirectoryConnectorsClient creates a new instance of ActiveDirectoryConnectorsClient with the specified values. -// subscriptionID - The ID of the Azure subscription -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewActiveDirectoryConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActiveDirectoryConnectorsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,13 +57,14 @@ func NewActiveDirectoryConnectorsClient(subscriptionID string, credential azcore // BeginCreate - Creates or replaces an Active Directory connector resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// activeDirectoryConnectorName - The name of the Active Directory connector instance -// activeDirectoryConnectorResource - desc -// options - ActiveDirectoryConnectorsClientBeginCreateOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.BeginCreate -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - activeDirectoryConnectorName - The name of the Active Directory connector instance +// - activeDirectoryConnectorResource - desc +// - options - ActiveDirectoryConnectorsClientBeginCreateOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.BeginCreate +// method. func (client *ActiveDirectoryConnectorsClient) BeginCreate(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, activeDirectoryConnectorResource ActiveDirectoryConnectorResource, options *ActiveDirectoryConnectorsClientBeginCreateOptions) (*runtime.Poller[ActiveDirectoryConnectorsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, activeDirectoryConnectorResource, options) @@ -79,7 +81,8 @@ func (client *ActiveDirectoryConnectorsClient) BeginCreate(ctx context.Context, // Create - Creates or replaces an Active Directory connector resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *ActiveDirectoryConnectorsClient) create(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, activeDirectoryConnectorResource ActiveDirectoryConnectorResource, options *ActiveDirectoryConnectorsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, activeDirectoryConnectorResource, options) if err != nil { @@ -119,7 +122,7 @@ func (client *ActiveDirectoryConnectorsClient) createCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, activeDirectoryConnectorResource) @@ -127,12 +130,13 @@ func (client *ActiveDirectoryConnectorsClient) createCreateRequest(ctx context.C // BeginDelete - Deletes an Active Directory connector resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// activeDirectoryConnectorName - The name of the Active Directory connector instance -// options - ActiveDirectoryConnectorsClientBeginDeleteOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.BeginDelete -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - activeDirectoryConnectorName - The name of the Active Directory connector instance +// - options - ActiveDirectoryConnectorsClientBeginDeleteOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.BeginDelete +// method. func (client *ActiveDirectoryConnectorsClient) BeginDelete(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, options *ActiveDirectoryConnectorsClientBeginDeleteOptions) (*runtime.Poller[ActiveDirectoryConnectorsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, options) @@ -147,7 +151,8 @@ func (client *ActiveDirectoryConnectorsClient) BeginDelete(ctx context.Context, // Delete - Deletes an Active Directory connector resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *ActiveDirectoryConnectorsClient) deleteOperation(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, options *ActiveDirectoryConnectorsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, options) if err != nil { @@ -187,7 +192,7 @@ func (client *ActiveDirectoryConnectorsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,12 +200,13 @@ func (client *ActiveDirectoryConnectorsClient) deleteCreateRequest(ctx context.C // Get - Retrieves an Active Directory connector resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// activeDirectoryConnectorName - The name of the Active Directory connector instance -// options - ActiveDirectoryConnectorsClientGetOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.Get -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - activeDirectoryConnectorName - The name of the Active Directory connector instance +// - options - ActiveDirectoryConnectorsClientGetOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.Get +// method. func (client *ActiveDirectoryConnectorsClient) Get(ctx context.Context, resourceGroupName string, dataControllerName string, activeDirectoryConnectorName string, options *ActiveDirectoryConnectorsClientGetOptions) (ActiveDirectoryConnectorsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, dataControllerName, activeDirectoryConnectorName, options) if err != nil { @@ -240,7 +246,7 @@ func (client *ActiveDirectoryConnectorsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,12 +262,12 @@ func (client *ActiveDirectoryConnectorsClient) getHandleResponse(resp *http.Resp } // NewListPager - List the active directory connectors associated with the given data controller. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// options - ActiveDirectoryConnectorsClientListOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.List -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - options - ActiveDirectoryConnectorsClientListOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.NewListPager +// method. func (client *ActiveDirectoryConnectorsClient) NewListPager(resourceGroupName string, dataControllerName string, options *ActiveDirectoryConnectorsClientListOptions) *runtime.Pager[ActiveDirectoryConnectorsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ActiveDirectoryConnectorsClientListResponse]{ More: func(page ActiveDirectoryConnectorsClientListResponse) bool { @@ -310,7 +316,7 @@ func (client *ActiveDirectoryConnectorsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md index 60f974aa713f..39d722b899fb 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/azurearcdata/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurearcdata/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azurearcdata/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.6.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_constants.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go similarity index 55% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_constants.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go index 3312e57a6b2c..5b006c8ac8ce 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_constants.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go @@ -5,12 +5,13 @@ // 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 armazurearcdata const ( moduleName = "armazurearcdata" - moduleVersion = "v0.5.0" + moduleVersion = "v0.6.0" ) // AccountProvisioningMode - The service account provisioning mode for this Active Directory connector. @@ -51,10 +52,13 @@ func PossibleArcSQLManagedInstanceLicenseTypeValues() []ArcSQLManagedInstanceLic type ArcSQLServerLicenseType string const ( - ArcSQLServerLicenseTypeFree ArcSQLServerLicenseType = "Free" - ArcSQLServerLicenseTypeHADR ArcSQLServerLicenseType = "HADR" - ArcSQLServerLicenseTypePaid ArcSQLServerLicenseType = "Paid" - ArcSQLServerLicenseTypeUndefined ArcSQLServerLicenseType = "Undefined" + ArcSQLServerLicenseTypeFree ArcSQLServerLicenseType = "Free" + ArcSQLServerLicenseTypeHADR ArcSQLServerLicenseType = "HADR" + ArcSQLServerLicenseTypeLicenseOnly ArcSQLServerLicenseType = "LicenseOnly" + ArcSQLServerLicenseTypePAYG ArcSQLServerLicenseType = "PAYG" + ArcSQLServerLicenseTypePaid ArcSQLServerLicenseType = "Paid" + ArcSQLServerLicenseTypeServerCAL ArcSQLServerLicenseType = "ServerCAL" + ArcSQLServerLicenseTypeUndefined ArcSQLServerLicenseType = "Undefined" ) // PossibleArcSQLServerLicenseTypeValues returns the possible values for the ArcSQLServerLicenseType const type. @@ -62,7 +66,10 @@ func PossibleArcSQLServerLicenseTypeValues() []ArcSQLServerLicenseType { return []ArcSQLServerLicenseType{ ArcSQLServerLicenseTypeFree, ArcSQLServerLicenseTypeHADR, + ArcSQLServerLicenseTypeLicenseOnly, + ArcSQLServerLicenseTypePAYG, ArcSQLServerLicenseTypePaid, + ArcSQLServerLicenseTypeServerCAL, ArcSQLServerLicenseTypeUndefined, } } @@ -107,6 +114,36 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DatabaseState - State of the database. +type DatabaseState string + +const ( + DatabaseStateCopying DatabaseState = "Copying" + DatabaseStateEmergency DatabaseState = "Emergency" + DatabaseStateOffline DatabaseState = "Offline" + DatabaseStateOfflineSecondary DatabaseState = "OfflineSecondary" + DatabaseStateOnline DatabaseState = "Online" + DatabaseStateRecovering DatabaseState = "Recovering" + DatabaseStateRecoveryPending DatabaseState = "RecoveryPending" + DatabaseStateRestoring DatabaseState = "Restoring" + DatabaseStateSuspect DatabaseState = "Suspect" +) + +// PossibleDatabaseStateValues returns the possible values for the DatabaseState const type. +func PossibleDatabaseStateValues() []DatabaseState { + return []DatabaseState{ + DatabaseStateCopying, + DatabaseStateEmergency, + DatabaseStateOffline, + DatabaseStateOfflineSecondary, + DatabaseStateOnline, + DatabaseStateRecovering, + DatabaseStateRecoveryPending, + DatabaseStateRestoring, + DatabaseStateSuspect, + } +} + // DefenderStatus - Status of Azure Defender. type DefenderStatus string @@ -129,17 +166,19 @@ func PossibleDefenderStatusValues() []DefenderStatus { type EditionType string const ( - EditionTypeDeveloper EditionType = "Developer" - EditionTypeEnterprise EditionType = "Enterprise" - EditionTypeEvaluation EditionType = "Evaluation" - EditionTypeExpress EditionType = "Express" - EditionTypeStandard EditionType = "Standard" - EditionTypeWeb EditionType = "Web" + EditionTypeBusinessIntelligence EditionType = "Business Intelligence" + EditionTypeDeveloper EditionType = "Developer" + EditionTypeEnterprise EditionType = "Enterprise" + EditionTypeEvaluation EditionType = "Evaluation" + EditionTypeExpress EditionType = "Express" + EditionTypeStandard EditionType = "Standard" + EditionTypeWeb EditionType = "Web" ) // PossibleEditionTypeValues returns the possible values for the EditionType const type. func PossibleEditionTypeValues() []EditionType { return []EditionType{ + EditionTypeBusinessIntelligence, EditionTypeDeveloper, EditionTypeEnterprise, EditionTypeEvaluation, @@ -163,21 +202,53 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { } } +// FailoverGroupPartnerSyncMode - The partner sync mode of the SQL managed instance. +type FailoverGroupPartnerSyncMode string + +const ( + FailoverGroupPartnerSyncModeAsync FailoverGroupPartnerSyncMode = "async" + FailoverGroupPartnerSyncModeSync FailoverGroupPartnerSyncMode = "sync" +) + +// PossibleFailoverGroupPartnerSyncModeValues returns the possible values for the FailoverGroupPartnerSyncMode const type. +func PossibleFailoverGroupPartnerSyncModeValues() []FailoverGroupPartnerSyncMode { + return []FailoverGroupPartnerSyncMode{ + FailoverGroupPartnerSyncModeAsync, + FailoverGroupPartnerSyncModeSync, + } +} + // HostType - Type of host for Azure Arc SQL Server type HostType string const ( - HostTypeAWSVirtualMachine HostType = "AWS Virtual Machine" - HostTypeGCPVirtualMachine HostType = "GCP Virtual Machine" - HostTypeOther HostType = "Other" - HostTypePhysicalServer HostType = "Physical Server" - HostTypeVirtualMachine HostType = "Virtual Machine" + HostTypeAWSKubernetesService HostType = "AWS Kubernetes Service" + HostTypeAWSVMWareVirtualMachine HostType = "AWS VMWare Virtual Machine" + HostTypeAWSVirtualMachine HostType = "AWS Virtual Machine" + HostTypeAzureKubernetesService HostType = "Azure Kubernetes Service" + HostTypeAzureVMWareVirtualMachine HostType = "Azure VMWare Virtual Machine" + HostTypeAzureVirtualMachine HostType = "Azure Virtual Machine" + HostTypeContainer HostType = "Container" + HostTypeGCPKubernetesService HostType = "GCP Kubernetes Service" + HostTypeGCPVMWareVirtualMachine HostType = "GCP VMWare Virtual Machine" + HostTypeGCPVirtualMachine HostType = "GCP Virtual Machine" + HostTypeOther HostType = "Other" + HostTypePhysicalServer HostType = "Physical Server" + HostTypeVirtualMachine HostType = "Virtual Machine" ) // PossibleHostTypeValues returns the possible values for the HostType const type. func PossibleHostTypeValues() []HostType { return []HostType{ + HostTypeAWSKubernetesService, + HostTypeAWSVMWareVirtualMachine, HostTypeAWSVirtualMachine, + HostTypeAzureKubernetesService, + HostTypeAzureVMWareVirtualMachine, + HostTypeAzureVirtualMachine, + HostTypeContainer, + HostTypeGCPKubernetesService, + HostTypeGCPVMWareVirtualMachine, HostTypeGCPVirtualMachine, HostTypeOther, HostTypePhysicalServer, @@ -209,6 +280,26 @@ func PossibleInfrastructureValues() []Infrastructure { } } +// InstanceFailoverGroupRole - The role of the SQL managed instance in this failover group. +type InstanceFailoverGroupRole string + +const ( + InstanceFailoverGroupRoleForcePrimaryAllowDataLoss InstanceFailoverGroupRole = "force-primary-allow-data-loss" + InstanceFailoverGroupRoleForceSecondary InstanceFailoverGroupRole = "force-secondary" + InstanceFailoverGroupRolePrimary InstanceFailoverGroupRole = "primary" + InstanceFailoverGroupRoleSecondary InstanceFailoverGroupRole = "secondary" +) + +// PossibleInstanceFailoverGroupRoleValues returns the possible values for the InstanceFailoverGroupRole const type. +func PossibleInstanceFailoverGroupRoleValues() []InstanceFailoverGroupRole { + return []InstanceFailoverGroupRole{ + InstanceFailoverGroupRoleForcePrimaryAllowDataLoss, + InstanceFailoverGroupRoleForceSecondary, + InstanceFailoverGroupRolePrimary, + InstanceFailoverGroupRoleSecondary, + } +} + // OperationOrigin - The intended executor of the operation. type OperationOrigin string @@ -225,6 +316,44 @@ func PossibleOperationOriginValues() []OperationOrigin { } } +// ProvisioningState - The provisioning state of the failover group resource. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + } +} + +// RecoveryMode - Status of the database. +type RecoveryMode string + +const ( + RecoveryModeBulkLogged RecoveryMode = "Bulk-logged" + RecoveryModeFull RecoveryMode = "Full" + RecoveryModeSimple RecoveryMode = "Simple" +) + +// PossibleRecoveryModeValues returns the possible values for the RecoveryMode const type. +func PossibleRecoveryModeValues() []RecoveryMode { + return []RecoveryMode{ + RecoveryModeBulkLogged, + RecoveryModeFull, + RecoveryModeSimple, + } +} + // SQLManagedInstanceSKUTier - The pricing tier for the instance. type SQLManagedInstanceSKUTier string @@ -266,3 +395,21 @@ func PossibleSQLVersionValues() []SQLVersion { SQLVersionUnknown, } } + +// State - The state of the failover group custom resource. +type State string + +const ( + StateFailed State = "Failed" + StateSucceeded State = "Succeeded" + StateWaiting State = "Waiting" +) + +// PossibleStateValues returns the possible values for the State const type. +func PossibleStateValues() []State { + return []State{ + StateFailed, + StateSucceeded, + StateWaiting, + } +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go similarity index 87% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go index f0e9d2d5bbb5..ff34bdb1cc08 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -31,9 +32,9 @@ type DataControllersClient struct { } // NewDataControllersClient creates a new instance of DataControllersClient with the specified values. -// subscriptionID - The ID of the Azure subscription -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDataControllersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataControllersClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,11 +57,12 @@ func NewDataControllersClient(subscriptionID string, credential azcore.TokenCred // BeginDeleteDataController - Deletes a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// options - DataControllersClientBeginDeleteDataControllerOptions contains the optional parameters for the DataControllersClient.BeginDeleteDataController -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - options - DataControllersClientBeginDeleteDataControllerOptions contains the optional parameters for the DataControllersClient.BeginDeleteDataController +// method. func (client *DataControllersClient) BeginDeleteDataController(ctx context.Context, resourceGroupName string, dataControllerName string, options *DataControllersClientBeginDeleteDataControllerOptions) (*runtime.Poller[DataControllersClientDeleteDataControllerResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteDataController(ctx, resourceGroupName, dataControllerName, options) @@ -75,7 +77,8 @@ func (client *DataControllersClient) BeginDeleteDataController(ctx context.Conte // DeleteDataController - Deletes a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *DataControllersClient) deleteDataController(ctx context.Context, resourceGroupName string, dataControllerName string, options *DataControllersClientBeginDeleteDataControllerOptions) (*http.Response, error) { req, err := client.deleteDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, options) if err != nil { @@ -111,7 +114,7 @@ func (client *DataControllersClient) deleteDataControllerCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,11 +122,12 @@ func (client *DataControllersClient) deleteDataControllerCreateRequest(ctx conte // GetDataController - Retrieves a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// options - DataControllersClientGetDataControllerOptions contains the optional parameters for the DataControllersClient.GetDataController -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - options - DataControllersClientGetDataControllerOptions contains the optional parameters for the DataControllersClient.GetDataController +// method. func (client *DataControllersClient) GetDataController(ctx context.Context, resourceGroupName string, dataControllerName string, options *DataControllersClientGetDataControllerOptions) (DataControllersClientGetDataControllerResponse, error) { req, err := client.getDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, options) if err != nil { @@ -159,7 +163,7 @@ func (client *DataControllersClient) getDataControllerCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,11 +179,11 @@ func (client *DataControllersClient) getDataControllerHandleResponse(resp *http. } // NewListInGroupPager - List dataController resources in the resource group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// options - DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.ListInGroup -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - options - DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.NewListInGroupPager +// method. func (client *DataControllersClient) NewListInGroupPager(resourceGroupName string, options *DataControllersClientListInGroupOptions) *runtime.Pager[DataControllersClientListInGroupResponse] { return runtime.NewPager(runtime.PagingHandler[DataControllersClientListInGroupResponse]{ More: func(page DataControllersClientListInGroupResponse) bool { @@ -224,7 +228,7 @@ func (client *DataControllersClient) listInGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,10 +244,10 @@ func (client *DataControllersClient) listInGroupHandleResponse(resp *http.Respon } // NewListInSubscriptionPager - List dataController resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// options - DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.ListInSubscription -// method. +// +// Generated from API version 2023-01-15-preview +// - options - DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.NewListInSubscriptionPager +// method. func (client *DataControllersClient) NewListInSubscriptionPager(options *DataControllersClientListInSubscriptionOptions) *runtime.Pager[DataControllersClientListInSubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[DataControllersClientListInSubscriptionResponse]{ More: func(page DataControllersClientListInSubscriptionResponse) bool { @@ -284,7 +288,7 @@ func (client *DataControllersClient) listInSubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,12 +305,13 @@ func (client *DataControllersClient) listInSubscriptionHandleResponse(resp *http // BeginPatchDataController - Updates a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// dataControllerResource - The update data controller resource -// options - DataControllersClientBeginPatchDataControllerOptions contains the optional parameters for the DataControllersClient.BeginPatchDataController -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - dataControllerResource - The update data controller resource +// - options - DataControllersClientBeginPatchDataControllerOptions contains the optional parameters for the DataControllersClient.BeginPatchDataController +// method. func (client *DataControllersClient) BeginPatchDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerUpdate, options *DataControllersClientBeginPatchDataControllerOptions) (*runtime.Poller[DataControllersClientPatchDataControllerResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.patchDataController(ctx, resourceGroupName, dataControllerName, dataControllerResource, options) @@ -323,7 +328,8 @@ func (client *DataControllersClient) BeginPatchDataController(ctx context.Contex // PatchDataController - Updates a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *DataControllersClient) patchDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerUpdate, options *DataControllersClientBeginPatchDataControllerOptions) (*http.Response, error) { req, err := client.patchDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, dataControllerResource, options) if err != nil { @@ -359,7 +365,7 @@ func (client *DataControllersClient) patchDataControllerCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataControllerResource) @@ -367,12 +373,13 @@ func (client *DataControllersClient) patchDataControllerCreateRequest(ctx contex // BeginPutDataController - Creates or replaces a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// dataControllerName - The name of the data controller -// dataControllerResource - desc -// options - DataControllersClientBeginPutDataControllerOptions contains the optional parameters for the DataControllersClient.BeginPutDataController -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - dataControllerName - The name of the data controller +// - dataControllerResource - desc +// - options - DataControllersClientBeginPutDataControllerOptions contains the optional parameters for the DataControllersClient.BeginPutDataController +// method. func (client *DataControllersClient) BeginPutDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerResource, options *DataControllersClientBeginPutDataControllerOptions) (*runtime.Poller[DataControllersClientPutDataControllerResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.putDataController(ctx, resourceGroupName, dataControllerName, dataControllerResource, options) @@ -389,7 +396,8 @@ func (client *DataControllersClient) BeginPutDataController(ctx context.Context, // PutDataController - Creates or replaces a dataController resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *DataControllersClient) putDataController(ctx context.Context, resourceGroupName string, dataControllerName string, dataControllerResource DataControllerResource, options *DataControllersClientBeginPutDataControllerOptions) (*http.Response, error) { req, err := client.putDataControllerCreateRequest(ctx, resourceGroupName, dataControllerName, dataControllerResource, options) if err != nil { @@ -425,7 +433,7 @@ func (client *DataControllersClient) putDataControllerCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataControllerResource) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/failovergroups_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/failovergroups_client.go new file mode 100644 index 000000000000..ccee197ebd43 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/failovergroups_client.go @@ -0,0 +1,330 @@ +//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 armazurearcdata + +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" +) + +// FailoverGroupsClient contains the methods for the FailoverGroups group. +// Don't use this type directly, use NewFailoverGroupsClient() instead. +type FailoverGroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFailoverGroupsClient creates a new instance of FailoverGroupsClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFailoverGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FailoverGroupsClient, 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 := &FailoverGroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreate - Creates or replaces a failover group resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - failoverGroupName - The name of the Failover Group +// - failoverGroupResource - desc +// - options - FailoverGroupsClientBeginCreateOptions contains the optional parameters for the FailoverGroupsClient.BeginCreate +// method. +func (client *FailoverGroupsClient) BeginCreate(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, failoverGroupResource FailoverGroupResource, options *FailoverGroupsClientBeginCreateOptions) (*runtime.Poller[FailoverGroupsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FailoverGroupsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FailoverGroupsClientCreateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Create - Creates or replaces a failover group resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +func (client *FailoverGroupsClient) create(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, failoverGroupResource FailoverGroupResource, options *FailoverGroupsClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, failoverGroupResource, 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) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *FailoverGroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, failoverGroupResource FailoverGroupResource, options *FailoverGroupsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, failoverGroupResource) +} + +// BeginDelete - Deletes a failover group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - failoverGroupName - The name of the Failover Group +// - options - FailoverGroupsClientBeginDeleteOptions contains the optional parameters for the FailoverGroupsClient.BeginDelete +// method. +func (client *FailoverGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*runtime.Poller[FailoverGroupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[FailoverGroupsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[FailoverGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a failover group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +func (client *FailoverGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, 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 *FailoverGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves a failover group resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - failoverGroupName - The name of the Failover Group +// - options - FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. +func (client *FailoverGroupsClient) Get(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientGetOptions) (FailoverGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, failoverGroupName, options) + if err != nil { + return FailoverGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FailoverGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FailoverGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FailoverGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, failoverGroupName string, options *FailoverGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + if failoverGroupName == "" { + return nil, errors.New("parameter failoverGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{failoverGroupName}", url.PathEscape(failoverGroupName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FailoverGroupsClient) getHandleResponse(resp *http.Response) (FailoverGroupsClientGetResponse, error) { + result := FailoverGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FailoverGroupResource); err != nil { + return FailoverGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the failover groups associated with the given sql managed instance. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - options - FailoverGroupsClientListOptions contains the optional parameters for the FailoverGroupsClient.NewListPager method. +func (client *FailoverGroupsClient) NewListPager(resourceGroupName string, sqlManagedInstanceName string, options *FailoverGroupsClientListOptions) *runtime.Pager[FailoverGroupsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FailoverGroupsClientListResponse]{ + More: func(page FailoverGroupsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FailoverGroupsClientListResponse) (FailoverGroupsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FailoverGroupsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FailoverGroupsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FailoverGroupsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FailoverGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, options *FailoverGroupsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups" + 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 sqlManagedInstanceName == "" { + return nil, errors.New("parameter sqlManagedInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlManagedInstanceName}", url.PathEscape(sqlManagedInstanceName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FailoverGroupsClient) listHandleResponse(resp *http.Response) (FailoverGroupsClientListResponse, error) { + result := FailoverGroupsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FailoverGroupListResult); err != nil { + return FailoverGroupsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod index 360d7d772ba3..337e95b7b1c4 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurearcdata/armazu 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.0.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.4.0 // 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/azurearcdata/armazurearcdata/go.sum b/sdk/resourcemanager/azurearcdata/armazurearcdata/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/go.sum +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/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.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= 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.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/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/azurearcdata/armazurearcdata/zz_generated_models.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/models.go similarity index 76% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/models.go index 8a1ef2b936d0..e2e2e8c4f911 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models.go @@ -5,11 +5,36 @@ // 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 armazurearcdata import "time" +// AGReplicas - The information about each failover group replica. +type AGReplicas struct { + // The availability mode of the replica. + AvailabilityMode *string `json:"availabilityMode,omitempty"` + + // The connected state of the replica. + ConnectedState *string `json:"connectedState,omitempty"` + + // The health state of the replica. + HealthState *string `json:"healthState,omitempty"` + + // The replica name. + ReplicaName *string `json:"replicaName,omitempty"` + + // The role of the replica. + Role *string `json:"role,omitempty"` + + // The secondary role allowed connections. + SecondaryRoleAllowConnections *string `json:"secondaryRoleAllowConnections,omitempty"` + + // The synchronization state of the availability group replicas. + SynchronizationState *string `json:"synchronizationState,omitempty"` +} + // ActiveDirectoryConnectorDNSDetails - DNS server details type ActiveDirectoryConnectorDNSDetails struct { // REQUIRED; List of Active Directory DNS server IP addresses. @@ -27,12 +52,12 @@ type ActiveDirectoryConnectorDNSDetails struct { // ActiveDirectoryConnectorDomainDetails - Active Directory domain details type ActiveDirectoryConnectorDomainDetails struct { - // REQUIRED; null - DomainControllers *ActiveDirectoryDomainControllers `json:"domainControllers,omitempty"` - // REQUIRED; Name (uppercase) of the Active Directory domain that this AD connector will be associated with. Realm *string `json:"realm,omitempty"` + // null + DomainControllers *ActiveDirectoryDomainControllers `json:"domainControllers,omitempty"` + // NETBIOS name of the Active Directory domain. NetbiosDomainName *string `json:"netbiosDomainName,omitempty"` @@ -97,7 +122,7 @@ type ActiveDirectoryConnectorSpec struct { // ActiveDirectoryConnectorStatus - The status of the Kubernetes custom resource. type ActiveDirectoryConnectorStatus struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // The time that the custom resource was last updated. LastUpdateTime *string `json:"lastUpdateTime,omitempty"` @@ -129,7 +154,7 @@ type ActiveDirectoryConnectorsClientGetOptions struct { // placeholder for future optional parameters } -// ActiveDirectoryConnectorsClientListOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.List +// ActiveDirectoryConnectorsClientListOptions contains the optional parameters for the ActiveDirectoryConnectorsClient.NewListPager // method. type ActiveDirectoryConnectorsClientListOptions struct { // placeholder for future optional parameters @@ -157,6 +182,15 @@ type ActiveDirectoryInformation struct { KeytabInformation *KeytabInformation `json:"keytabInformation,omitempty"` } +// ArcSQLServerDatabaseListResult - A list of Arc Sql Server database. +type ArcSQLServerDatabaseListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Array of Arc Sql Server database. + Value []*SQLServerDatabaseResource `json:"value,omitempty" azure:"ro"` +} + // BasicLoginInformation - Username and password for basic login authentication. type BasicLoginInformation struct { // Login password. @@ -201,7 +235,7 @@ type DataControllerProperties struct { Infrastructure *Infrastructure `json:"infrastructure,omitempty"` // The raw kubernetes information - K8SRaw interface{} `json:"k8sRaw,omitempty"` + K8SRaw any `json:"k8sRaw,omitempty"` // Last uploaded date from Kubernetes cluster. Defaults to current date time LastUploadedDate *time.Time `json:"lastUploadedDate,omitempty"` @@ -291,12 +325,13 @@ type DataControllersClientGetDataControllerOptions struct { // placeholder for future optional parameters } -// DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.ListInGroup method. +// DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.NewListInGroupPager +// method. type DataControllersClientListInGroupOptions struct { // placeholder for future optional parameters } -// DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.ListInSubscription +// DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.NewListInSubscriptionPager // method. type DataControllersClientListInSubscriptionOptions struct { // placeholder for future optional parameters @@ -332,10 +367,126 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes `json:"type,omitempty"` } +// FailoverGroupListResult - A list of failover groups. +type FailoverGroupListResult struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Array of failover group results. + Value []*FailoverGroupResource `json:"value,omitempty" azure:"ro"` +} + +// FailoverGroupProperties - The properties of a failover group resource. +type FailoverGroupProperties struct { + // REQUIRED; The resource ID of the partner SQL managed instance. + PartnerManagedInstanceID *string `json:"partnerManagedInstanceId,omitempty"` + + // REQUIRED; The specifications of the failover group resource. + Spec *FailoverGroupSpec `json:"spec,omitempty"` + + // The status of the failover group custom resource. + Status *FailoverGroupStatus `json:"status,omitempty"` + + // READ-ONLY; The provisioning state of the failover group resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// FailoverGroupResource - A failover group resource. +type FailoverGroupResource struct { + // REQUIRED; null + Properties *FailoverGroupProperties `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"` +} + +// FailoverGroupSpec - The specifications of the failover group resource. +type FailoverGroupSpec struct { + // REQUIRED; The role of the SQL managed instance in this failover group. + Role *InstanceFailoverGroupRole `json:"role,omitempty"` + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]*string + + // The name of the partner SQL managed instance. + PartnerManagedInstance *string `json:"partnerManagedInstance,omitempty"` + + // The mirroring endpoint public certificate for the partner SQL managed instance. Only PEM format is supported. + PartnerMirroringCert *string `json:"partnerMirroringCert,omitempty"` + + // The mirroring endpoint URL of the partner SQL managed instance. + PartnerMirroringURL *string `json:"partnerMirroringURL,omitempty"` + + // The partner sync mode of the SQL managed instance. + PartnerSyncMode *FailoverGroupPartnerSyncMode `json:"partnerSyncMode,omitempty"` + + // The shared name of the failover group for this SQL managed instance. Both SQL managed instance and its partner have to + // use the same shared name. + SharedName *string `json:"sharedName,omitempty"` + + // The name of the SQL managed instance with this failover group role. + SourceManagedInstance *string `json:"sourceManagedInstance,omitempty"` +} + +// FailoverGroupStatus - The status of the Kubernetes custom resource. +type FailoverGroupStatus struct { + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // The time that the custom resource was last updated. + LastUpdateTime *time.Time `json:"lastUpdateTime,omitempty"` + + // The version of the replicaSet associated with the failover group custom resource. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + + // A list of failover group replicas. + Replicas []*AGReplicas `json:"replicas,omitempty"` + + // The message in case of a failure in the failover group. + Results *string `json:"results,omitempty"` + + // The role of the managed instance in the failover group. + Role *InstanceFailoverGroupRole `json:"role,omitempty"` + + // The state of the failover group custom resource. + State *State `json:"state,omitempty"` +} + +// FailoverGroupsClientBeginCreateOptions contains the optional parameters for the FailoverGroupsClient.BeginCreate method. +type FailoverGroupsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientBeginDeleteOptions contains the optional parameters for the FailoverGroupsClient.BeginDelete method. +type FailoverGroupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FailoverGroupsClientGetOptions contains the optional parameters for the FailoverGroupsClient.Get method. +type FailoverGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FailoverGroupsClientListOptions contains the optional parameters for the FailoverGroupsClient.NewListPager method. +type FailoverGroupsClientListOptions struct { + // placeholder for future optional parameters +} + // K8SResourceRequirements - The kubernetes resource limits and requests used to restrict or reserve resource usage. type K8SResourceRequirements struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. // Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. @@ -351,7 +502,7 @@ type K8SResourceRequirements struct { // K8SScheduling - The kubernetes scheduling information. type K8SScheduling struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the // database service @@ -362,7 +513,7 @@ type K8SScheduling struct { // nodes to host the database service type K8SSchedulingOptions struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // The kubernetes resource limits and requests used to restrict or reserve resource usage. Resources *K8SResourceRequirements `json:"resources,omitempty"` @@ -410,7 +561,7 @@ type Operation struct { Origin *OperationOrigin `json:"origin,omitempty" azure:"ro"` // READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties,omitempty" azure:"ro"` + Properties map[string]any `json:"properties,omitempty" azure:"ro"` } // OperationDisplay - Display metadata associated with the operation. @@ -437,7 +588,7 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -502,7 +653,7 @@ type PostgresInstanceProperties struct { DataControllerID *string `json:"dataControllerId,omitempty"` // The raw kubernetes information - K8SRaw interface{} `json:"k8sRaw,omitempty"` + K8SRaw any `json:"k8sRaw,omitempty"` // Last uploaded date from Kubernetes cluster. Defaults to current date time LastUploadedDate *time.Time `json:"lastUploadedDate,omitempty"` @@ -561,13 +712,13 @@ type PostgresInstancesClientGetOptions struct { // placeholder for future optional parameters } -// PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.ListByResourceGroup +// PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.NewListByResourceGroupPager // method. type PostgresInstancesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.List method. +// PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.NewListPager method. type PostgresInstancesClientListOptions struct { // placeholder for future optional parameters } @@ -641,7 +792,7 @@ type SQLManagedInstance struct { // SQLManagedInstanceK8SRaw - The raw kubernetes information. type SQLManagedInstanceK8SRaw struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // The kubernetes spec information. Spec *SQLManagedInstanceK8SSpec `json:"spec,omitempty"` @@ -650,7 +801,7 @@ type SQLManagedInstanceK8SRaw struct { // SQLManagedInstanceK8SSpec - The kubernetes spec information. type SQLManagedInstanceK8SSpec struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // This option specifies the number of SQL Managed Instance replicas that will be deployed in your Kubernetes cluster for // high availability purposes. If sku.tier is BusinessCritical, allowed values are @@ -711,7 +862,8 @@ type SQLManagedInstanceProperties struct { // SQLManagedInstanceSKU - The resource model definition representing SKU for Azure Managed Instance - Azure Arc type SQLManagedInstanceSKU struct { - // REQUIRED; The name of the SKU. + // CONSTANT; The name of the SKU. + // Field has constant value "vCore", any specified value is ignored. Name *string `json:"name,omitempty"` // The SKU capacity @@ -755,13 +907,13 @@ type SQLManagedInstancesClientGetOptions struct { // placeholder for future optional parameters } -// SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.ListByResourceGroup +// SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.NewListByResourceGroupPager // method. type SQLManagedInstancesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.List method. +// SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.NewListPager method. type SQLManagedInstancesClientListOptions struct { // placeholder for future optional parameters } @@ -771,6 +923,119 @@ type SQLManagedInstancesClientUpdateOptions struct { // placeholder for future optional parameters } +// SQLServerDatabaseResource - Arc Sql Server database +type SQLServerDatabaseResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // REQUIRED; Properties of Arc Sql Server database + Properties *SQLServerDatabaseResourceProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,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"` +} + +// SQLServerDatabaseResourceProperties - The properties of Arc Sql Server database resource +type SQLServerDatabaseResourceProperties struct { + BackupInformation *SQLServerDatabaseResourcePropertiesBackupInformation `json:"backupInformation,omitempty"` + + // Collation of the database. + CollationName *string `json:"collationName,omitempty"` + + // Compatibility level of the database + CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` + + // Creation date of the database. + DatabaseCreationDate *time.Time `json:"databaseCreationDate,omitempty"` + + // List of features that are enabled for the database + DatabaseOptions *SQLServerDatabaseResourcePropertiesDatabaseOptions `json:"databaseOptions,omitempty"` + + // Whether the database is read only or not. + IsReadOnly *bool `json:"isReadOnly,omitempty"` + + // Status of the database. + RecoveryMode *RecoveryMode `json:"recoveryMode,omitempty"` + + // Size of the database. + SizeMB *float32 `json:"sizeMB,omitempty"` + + // Space left of the database. + SpaceAvailableMB *float32 `json:"spaceAvailableMB,omitempty"` + + // State of the database. + State *DatabaseState `json:"state,omitempty"` + + // READ-ONLY; The provisioning state of the Arc-enabled SQL Server database resource. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +type SQLServerDatabaseResourcePropertiesBackupInformation struct { + // Date time of last full backup. + LastFullBackup *time.Time `json:"lastFullBackup,omitempty"` + + // Date time of last log backup. + LastLogBackup *time.Time `json:"lastLogBackup,omitempty"` +} + +// SQLServerDatabaseResourcePropertiesDatabaseOptions - List of features that are enabled for the database +type SQLServerDatabaseResourcePropertiesDatabaseOptions struct { + IsAutoCloseOn *bool `json:"isAutoCloseOn,omitempty"` + IsAutoCreateStatsOn *bool `json:"isAutoCreateStatsOn,omitempty"` + IsAutoShrinkOn *bool `json:"isAutoShrinkOn,omitempty"` + IsAutoUpdateStatsOn *bool `json:"isAutoUpdateStatsOn,omitempty"` + IsEncrypted *bool `json:"isEncrypted,omitempty"` + IsMemoryOptimizationEnabled *bool `json:"isMemoryOptimizationEnabled,omitempty"` + IsRemoteDataArchiveEnabled *bool `json:"isRemoteDataArchiveEnabled,omitempty"` + IsTrustworthyOn *bool `json:"isTrustworthyOn,omitempty"` +} + +// SQLServerDatabaseUpdate - An update to database resource. +type SQLServerDatabaseUpdate struct { + // The data controller's properties + Properties *SQLServerDatabaseResourceProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// SQLServerDatabasesClientCreateOptions contains the optional parameters for the SQLServerDatabasesClient.Create method. +type SQLServerDatabasesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientDeleteOptions contains the optional parameters for the SQLServerDatabasesClient.Delete method. +type SQLServerDatabasesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientGetOptions contains the optional parameters for the SQLServerDatabasesClient.Get method. +type SQLServerDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientListOptions contains the optional parameters for the SQLServerDatabasesClient.NewListPager method. +type SQLServerDatabasesClientListOptions struct { + // placeholder for future optional parameters +} + +// SQLServerDatabasesClientUpdateOptions contains the optional parameters for the SQLServerDatabasesClient.Update method. +type SQLServerDatabasesClientUpdateOptions struct { + // placeholder for future optional parameters +} + // SQLServerInstance - A SqlServerInstance. type SQLServerInstance struct { // REQUIRED; The geo-location where the resource lives @@ -821,6 +1086,9 @@ type SQLServerInstanceProperties struct { // SQL Server collation. Collation *string `json:"collation,omitempty"` + // The number of total cores of the Operating System Environment (OSE) hosting the SQL Server instance. + Cores *string `json:"cores,omitempty"` + // SQL Server current version. CurrentVersion *string `json:"currentVersion,omitempty"` @@ -886,13 +1154,13 @@ type SQLServerInstancesClientGetOptions struct { // placeholder for future optional parameters } -// SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.ListByResourceGroup +// SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.NewListByResourceGroupPager // method. type SQLServerInstancesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.List method. +// SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.NewListPager method. type SQLServerInstancesClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go new file mode 100644 index 000000000000..c1bbe3ff27a4 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go @@ -0,0 +1,2647 @@ +//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 armazurearcdata + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AGReplicas. +func (a AGReplicas) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityMode", a.AvailabilityMode) + populate(objectMap, "connectedState", a.ConnectedState) + populate(objectMap, "healthState", a.HealthState) + populate(objectMap, "replicaName", a.ReplicaName) + populate(objectMap, "role", a.Role) + populate(objectMap, "secondaryRoleAllowConnections", a.SecondaryRoleAllowConnections) + populate(objectMap, "synchronizationState", a.SynchronizationState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AGReplicas. +func (a *AGReplicas) 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 "availabilityMode": + err = unpopulate(val, "AvailabilityMode", &a.AvailabilityMode) + delete(rawMsg, key) + case "connectedState": + err = unpopulate(val, "ConnectedState", &a.ConnectedState) + delete(rawMsg, key) + case "healthState": + err = unpopulate(val, "HealthState", &a.HealthState) + delete(rawMsg, key) + case "replicaName": + err = unpopulate(val, "ReplicaName", &a.ReplicaName) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "secondaryRoleAllowConnections": + err = unpopulate(val, "SecondaryRoleAllowConnections", &a.SecondaryRoleAllowConnections) + delete(rawMsg, key) + case "synchronizationState": + err = unpopulate(val, "SynchronizationState", &a.SynchronizationState) + 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 ActiveDirectoryConnectorDNSDetails. +func (a ActiveDirectoryConnectorDNSDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainName", a.DomainName) + populate(objectMap, "nameserverIPAddresses", a.NameserverIPAddresses) + populate(objectMap, "preferK8sDnsForPtrLookups", a.PreferK8SDNSForPtrLookups) + populate(objectMap, "replicas", a.Replicas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorDNSDetails. +func (a *ActiveDirectoryConnectorDNSDetails) 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 "domainName": + err = unpopulate(val, "DomainName", &a.DomainName) + delete(rawMsg, key) + case "nameserverIPAddresses": + err = unpopulate(val, "NameserverIPAddresses", &a.NameserverIPAddresses) + delete(rawMsg, key) + case "preferK8sDnsForPtrLookups": + err = unpopulate(val, "PreferK8SDNSForPtrLookups", &a.PreferK8SDNSForPtrLookups) + delete(rawMsg, key) + case "replicas": + err = unpopulate(val, "Replicas", &a.Replicas) + 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 ActiveDirectoryConnectorDomainDetails. +func (a ActiveDirectoryConnectorDomainDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainControllers", a.DomainControllers) + populate(objectMap, "netbiosDomainName", a.NetbiosDomainName) + populate(objectMap, "ouDistinguishedName", a.OuDistinguishedName) + populate(objectMap, "realm", a.Realm) + populate(objectMap, "serviceAccountProvisioning", a.ServiceAccountProvisioning) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorDomainDetails. +func (a *ActiveDirectoryConnectorDomainDetails) 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 "domainControllers": + err = unpopulate(val, "DomainControllers", &a.DomainControllers) + delete(rawMsg, key) + case "netbiosDomainName": + err = unpopulate(val, "NetbiosDomainName", &a.NetbiosDomainName) + delete(rawMsg, key) + case "ouDistinguishedName": + err = unpopulate(val, "OuDistinguishedName", &a.OuDistinguishedName) + delete(rawMsg, key) + case "realm": + err = unpopulate(val, "Realm", &a.Realm) + delete(rawMsg, key) + case "serviceAccountProvisioning": + err = unpopulate(val, "ServiceAccountProvisioning", &a.ServiceAccountProvisioning) + 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 ActiveDirectoryConnectorListResult. +func (a ActiveDirectoryConnectorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorListResult. +func (a *ActiveDirectoryConnectorListResult) 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 ActiveDirectoryConnectorProperties. +func (a ActiveDirectoryConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainServiceAccountLoginInformation", a.DomainServiceAccountLoginInformation) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "spec", a.Spec) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorProperties. +func (a *ActiveDirectoryConnectorProperties) 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 "domainServiceAccountLoginInformation": + err = unpopulate(val, "DomainServiceAccountLoginInformation", &a.DomainServiceAccountLoginInformation) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "spec": + err = unpopulate(val, "Spec", &a.Spec) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + 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 ActiveDirectoryConnectorResource. +func (a ActiveDirectoryConnectorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorResource. +func (a *ActiveDirectoryConnectorResource) 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 ActiveDirectoryConnectorSpec. +func (a ActiveDirectoryConnectorSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activeDirectory", a.ActiveDirectory) + populate(objectMap, "dns", a.DNS) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorSpec. +func (a *ActiveDirectoryConnectorSpec) 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 "activeDirectory": + err = unpopulate(val, "ActiveDirectory", &a.ActiveDirectory) + delete(rawMsg, key) + case "dns": + err = unpopulate(val, "DNS", &a.DNS) + 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 ActiveDirectoryConnectorStatus. +func (a ActiveDirectoryConnectorStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lastUpdateTime", a.LastUpdateTime) + populate(objectMap, "observedGeneration", a.ObservedGeneration) + populate(objectMap, "state", a.State) + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorStatus. +func (a *ActiveDirectoryConnectorStatus) 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 "lastUpdateTime": + err = unpopulate(val, "LastUpdateTime", &a.LastUpdateTime) + delete(rawMsg, key) + case "observedGeneration": + err = unpopulate(val, "ObservedGeneration", &a.ObservedGeneration) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 ActiveDirectoryDomainController. +func (a ActiveDirectoryDomainController) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "hostname", a.Hostname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryDomainController. +func (a *ActiveDirectoryDomainController) 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 "hostname": + err = unpopulate(val, "Hostname", &a.Hostname) + 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 ActiveDirectoryDomainControllers. +func (a ActiveDirectoryDomainControllers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "primaryDomainController", a.PrimaryDomainController) + populate(objectMap, "secondaryDomainControllers", a.SecondaryDomainControllers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryDomainControllers. +func (a *ActiveDirectoryDomainControllers) 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 "primaryDomainController": + err = unpopulate(val, "PrimaryDomainController", &a.PrimaryDomainController) + delete(rawMsg, key) + case "secondaryDomainControllers": + err = unpopulate(val, "SecondaryDomainControllers", &a.SecondaryDomainControllers) + 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 ActiveDirectoryInformation. +func (a ActiveDirectoryInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keytabInformation", a.KeytabInformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryInformation. +func (a *ActiveDirectoryInformation) 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 "keytabInformation": + err = unpopulate(val, "KeytabInformation", &a.KeytabInformation) + 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 ArcSQLServerDatabaseListResult. +func (a ArcSQLServerDatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcSQLServerDatabaseListResult. +func (a *ArcSQLServerDatabaseListResult) 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 BasicLoginInformation. +func (b BasicLoginInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "password", b.Password) + populate(objectMap, "username", b.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BasicLoginInformation. +func (b *BasicLoginInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, "Password", &b.Password) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &b.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommonSKU. +func (c CommonSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", c.Capacity) + populate(objectMap, "dev", c.Dev) + populate(objectMap, "family", c.Family) + populate(objectMap, "name", c.Name) + populate(objectMap, "size", c.Size) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonSKU. +func (c *CommonSKU) 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 "capacity": + err = unpopulate(val, "Capacity", &c.Capacity) + delete(rawMsg, key) + case "dev": + err = unpopulate(val, "Dev", &c.Dev) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &c.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &c.Size) + 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 DataControllerProperties. +func (d DataControllerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "basicLoginInformation", d.BasicLoginInformation) + populate(objectMap, "clusterId", d.ClusterID) + populate(objectMap, "extensionId", d.ExtensionID) + populate(objectMap, "infrastructure", d.Infrastructure) + populate(objectMap, "k8sRaw", &d.K8SRaw) + populateTimeRFC3339(objectMap, "lastUploadedDate", d.LastUploadedDate) + populate(objectMap, "logAnalyticsWorkspaceConfig", d.LogAnalyticsWorkspaceConfig) + populate(objectMap, "logsDashboardCredential", d.LogsDashboardCredential) + populate(objectMap, "metricsDashboardCredential", d.MetricsDashboardCredential) + populate(objectMap, "onPremiseProperty", d.OnPremiseProperty) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "uploadServicePrincipal", d.UploadServicePrincipal) + populate(objectMap, "uploadWatermark", d.UploadWatermark) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataControllerProperties. +func (d *DataControllerProperties) 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 "basicLoginInformation": + err = unpopulate(val, "BasicLoginInformation", &d.BasicLoginInformation) + delete(rawMsg, key) + case "clusterId": + err = unpopulate(val, "ClusterID", &d.ClusterID) + delete(rawMsg, key) + case "extensionId": + err = unpopulate(val, "ExtensionID", &d.ExtensionID) + delete(rawMsg, key) + case "infrastructure": + err = unpopulate(val, "Infrastructure", &d.Infrastructure) + delete(rawMsg, key) + case "k8sRaw": + err = unpopulate(val, "K8SRaw", &d.K8SRaw) + delete(rawMsg, key) + case "lastUploadedDate": + err = unpopulateTimeRFC3339(val, "LastUploadedDate", &d.LastUploadedDate) + delete(rawMsg, key) + case "logAnalyticsWorkspaceConfig": + err = unpopulate(val, "LogAnalyticsWorkspaceConfig", &d.LogAnalyticsWorkspaceConfig) + delete(rawMsg, key) + case "logsDashboardCredential": + err = unpopulate(val, "LogsDashboardCredential", &d.LogsDashboardCredential) + delete(rawMsg, key) + case "metricsDashboardCredential": + err = unpopulate(val, "MetricsDashboardCredential", &d.MetricsDashboardCredential) + delete(rawMsg, key) + case "onPremiseProperty": + err = unpopulate(val, "OnPremiseProperty", &d.OnPremiseProperty) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "uploadServicePrincipal": + err = unpopulate(val, "UploadServicePrincipal", &d.UploadServicePrincipal) + delete(rawMsg, key) + case "uploadWatermark": + err = unpopulate(val, "UploadWatermark", &d.UploadWatermark) + 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 DataControllerResource. +func (d DataControllerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", d.ExtendedLocation) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataControllerResource. +func (d *DataControllerResource) 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &d.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + 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 DataControllerUpdate. +func (d DataControllerUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataControllerUpdate. +func (d *DataControllerUpdate) 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 "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. +func (e *ErrorResponseBody) 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 "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + 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 ExtendedLocation. +func (e ExtendedLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedLocation. +func (e *ExtendedLocation) 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 "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + 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 FailoverGroupListResult. +func (f FailoverGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupListResult. +func (f *FailoverGroupListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FailoverGroupProperties. +func (f FailoverGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "partnerManagedInstanceId", f.PartnerManagedInstanceID) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "spec", f.Spec) + populate(objectMap, "status", f.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupProperties. +func (f *FailoverGroupProperties) 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 "partnerManagedInstanceId": + err = unpopulate(val, "PartnerManagedInstanceID", &f.PartnerManagedInstanceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "spec": + err = unpopulate(val, "Spec", &f.Spec) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &f.Status) + 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 FailoverGroupResource. +func (f FailoverGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupResource. +func (f *FailoverGroupResource) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FailoverGroupSpec. +func (f FailoverGroupSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "partnerManagedInstance", f.PartnerManagedInstance) + populate(objectMap, "partnerMirroringCert", f.PartnerMirroringCert) + populate(objectMap, "partnerMirroringURL", f.PartnerMirroringURL) + populate(objectMap, "partnerSyncMode", f.PartnerSyncMode) + populate(objectMap, "role", f.Role) + populate(objectMap, "sharedName", f.SharedName) + populate(objectMap, "sourceManagedInstance", f.SourceManagedInstance) + if f.AdditionalProperties != nil { + for key, val := range f.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupSpec. +func (f *FailoverGroupSpec) 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 "partnerManagedInstance": + err = unpopulate(val, "PartnerManagedInstance", &f.PartnerManagedInstance) + delete(rawMsg, key) + case "partnerMirroringCert": + err = unpopulate(val, "PartnerMirroringCert", &f.PartnerMirroringCert) + delete(rawMsg, key) + case "partnerMirroringURL": + err = unpopulate(val, "PartnerMirroringURL", &f.PartnerMirroringURL) + delete(rawMsg, key) + case "partnerSyncMode": + err = unpopulate(val, "PartnerSyncMode", &f.PartnerSyncMode) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &f.Role) + delete(rawMsg, key) + case "sharedName": + err = unpopulate(val, "SharedName", &f.SharedName) + delete(rawMsg, key) + case "sourceManagedInstance": + err = unpopulate(val, "SourceManagedInstance", &f.SourceManagedInstance) + delete(rawMsg, key) + default: + if f.AdditionalProperties == nil { + f.AdditionalProperties = map[string]*string{} + } + if val != nil { + var aux string + err = json.Unmarshal(val, &aux) + f.AdditionalProperties[key] = &aux + } + 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 FailoverGroupStatus. +func (f FailoverGroupStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "lastUpdateTime", f.LastUpdateTime) + populate(objectMap, "observedGeneration", f.ObservedGeneration) + populate(objectMap, "replicas", f.Replicas) + populate(objectMap, "results", f.Results) + populate(objectMap, "role", f.Role) + populate(objectMap, "state", f.State) + if f.AdditionalProperties != nil { + for key, val := range f.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverGroupStatus. +func (f *FailoverGroupStatus) 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 "lastUpdateTime": + err = unpopulateTimeRFC3339(val, "LastUpdateTime", &f.LastUpdateTime) + delete(rawMsg, key) + case "observedGeneration": + err = unpopulate(val, "ObservedGeneration", &f.ObservedGeneration) + delete(rawMsg, key) + case "replicas": + err = unpopulate(val, "Replicas", &f.Replicas) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &f.Results) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &f.Role) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &f.State) + delete(rawMsg, key) + default: + if f.AdditionalProperties == nil { + f.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + f.AdditionalProperties[key] = aux + } + 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 K8SResourceRequirements. +func (k K8SResourceRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "limits", k.Limits) + populate(objectMap, "requests", k.Requests) + if k.AdditionalProperties != nil { + for key, val := range k.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SResourceRequirements. +func (k *K8SResourceRequirements) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "limits": + err = unpopulate(val, "Limits", &k.Limits) + delete(rawMsg, key) + case "requests": + err = unpopulate(val, "Requests", &k.Requests) + delete(rawMsg, key) + default: + if k.AdditionalProperties == nil { + k.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + k.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type K8SScheduling. +func (k K8SScheduling) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "default", k.Default) + if k.AdditionalProperties != nil { + for key, val := range k.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SScheduling. +func (k *K8SScheduling) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &k.Default) + delete(rawMsg, key) + default: + if k.AdditionalProperties == nil { + k.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + k.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type K8SSchedulingOptions. +func (k K8SSchedulingOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resources", k.Resources) + if k.AdditionalProperties != nil { + for key, val := range k.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type K8SSchedulingOptions. +func (k *K8SSchedulingOptions) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resources": + err = unpopulate(val, "Resources", &k.Resources) + delete(rawMsg, key) + default: + if k.AdditionalProperties == nil { + k.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + k.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeytabInformation. +func (k KeytabInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keytab", k.Keytab) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeytabInformation. +func (k *KeytabInformation) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keytab": + err = unpopulate(val, "Keytab", &k.Keytab) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsWorkspaceConfig. +func (l LogAnalyticsWorkspaceConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "primaryKey", l.PrimaryKey) + populate(objectMap, "workspaceId", l.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsWorkspaceConfig. +func (l *LogAnalyticsWorkspaceConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &l.PrimaryKey) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OnPremiseProperty. +func (o OnPremiseProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", o.ID) + populate(objectMap, "publicSigningKey", o.PublicSigningKey) + populate(objectMap, "signingCertificateThumbprint", o.SigningCertificateThumbprint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseProperty. +func (o *OnPremiseProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "publicSigningKey": + err = unpopulate(val, "PublicSigningKey", &o.PublicSigningKey) + delete(rawMsg, key) + case "signingCertificateThumbprint": + err = unpopulate(val, "SigningCertificateThumbprint", &o.SigningCertificateThumbprint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PageOfDataControllerResource. +func (p PageOfDataControllerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PageOfDataControllerResource. +func (p *PageOfDataControllerResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostgresInstance. +func (p PostgresInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", p.ExtendedLocation) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostgresInstance. +func (p *PostgresInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &p.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostgresInstanceListResult. +func (p PostgresInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostgresInstanceListResult. +func (p *PostgresInstanceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostgresInstanceProperties. +func (p PostgresInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "admin", p.Admin) + populate(objectMap, "basicLoginInformation", p.BasicLoginInformation) + populate(objectMap, "dataControllerId", p.DataControllerID) + populate(objectMap, "k8sRaw", &p.K8SRaw) + populateTimeRFC3339(objectMap, "lastUploadedDate", p.LastUploadedDate) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostgresInstanceProperties. +func (p *PostgresInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "admin": + err = unpopulate(val, "Admin", &p.Admin) + delete(rawMsg, key) + case "basicLoginInformation": + err = unpopulate(val, "BasicLoginInformation", &p.BasicLoginInformation) + delete(rawMsg, key) + case "dataControllerId": + err = unpopulate(val, "DataControllerID", &p.DataControllerID) + delete(rawMsg, key) + case "k8sRaw": + err = unpopulate(val, "K8SRaw", &p.K8SRaw) + delete(rawMsg, key) + case "lastUploadedDate": + err = unpopulateTimeRFC3339(val, "LastUploadedDate", &p.LastUploadedDate) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostgresInstanceSKU. +func (p PostgresInstanceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", p.Capacity) + populate(objectMap, "dev", p.Dev) + populate(objectMap, "family", p.Family) + populate(objectMap, "name", p.Name) + populate(objectMap, "size", p.Size) + objectMap["tier"] = "Hyperscale" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostgresInstanceSKU. +func (p *PostgresInstanceSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &p.Capacity) + delete(rawMsg, key) + case "dev": + err = unpopulate(val, "Dev", &p.Dev) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &p.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &p.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostgresInstanceUpdate. +func (p PostgresInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostgresInstanceUpdate. +func (p *PostgresInstanceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstance. +func (s SQLManagedInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "extendedLocation", s.ExtendedLocation) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstance. +func (s *SQLManagedInstance) 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 "extendedLocation": + err = unpopulate(val, "ExtendedLocation", &s.ExtendedLocation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + 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 "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SQLManagedInstanceK8SRaw. +func (s SQLManagedInstanceK8SRaw) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "spec", s.Spec) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SRaw. +func (s *SQLManagedInstanceK8SRaw) 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 "spec": + err = unpopulate(val, "Spec", &s.Spec) + delete(rawMsg, key) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } + 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 SQLManagedInstanceK8SSpec. +func (s SQLManagedInstanceK8SSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "replicas", s.Replicas) + populate(objectMap, "scheduling", s.Scheduling) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SSpec. +func (s *SQLManagedInstanceK8SSpec) 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 "replicas": + err = unpopulate(val, "Replicas", &s.Replicas) + delete(rawMsg, key) + case "scheduling": + err = unpopulate(val, "Scheduling", &s.Scheduling) + delete(rawMsg, key) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } + 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 SQLManagedInstanceListResult. +func (s SQLManagedInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceListResult. +func (s *SQLManagedInstanceListResult) 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 SQLManagedInstanceProperties. +func (s SQLManagedInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activeDirectoryInformation", s.ActiveDirectoryInformation) + populate(objectMap, "admin", s.Admin) + populate(objectMap, "basicLoginInformation", s.BasicLoginInformation) + populate(objectMap, "clusterId", s.ClusterID) + populate(objectMap, "dataControllerId", s.DataControllerID) + populate(objectMap, "endTime", s.EndTime) + populate(objectMap, "extensionId", s.ExtensionID) + populate(objectMap, "k8sRaw", s.K8SRaw) + populateTimeRFC3339(objectMap, "lastUploadedDate", s.LastUploadedDate) + populate(objectMap, "licenseType", s.LicenseType) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "startTime", s.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceProperties. +func (s *SQLManagedInstanceProperties) 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 "activeDirectoryInformation": + err = unpopulate(val, "ActiveDirectoryInformation", &s.ActiveDirectoryInformation) + delete(rawMsg, key) + case "admin": + err = unpopulate(val, "Admin", &s.Admin) + delete(rawMsg, key) + case "basicLoginInformation": + err = unpopulate(val, "BasicLoginInformation", &s.BasicLoginInformation) + delete(rawMsg, key) + case "clusterId": + err = unpopulate(val, "ClusterID", &s.ClusterID) + delete(rawMsg, key) + case "dataControllerId": + err = unpopulate(val, "DataControllerID", &s.DataControllerID) + delete(rawMsg, key) + case "endTime": + err = unpopulate(val, "EndTime", &s.EndTime) + delete(rawMsg, key) + case "extensionId": + err = unpopulate(val, "ExtensionID", &s.ExtensionID) + delete(rawMsg, key) + case "k8sRaw": + err = unpopulate(val, "K8SRaw", &s.K8SRaw) + delete(rawMsg, key) + case "lastUploadedDate": + err = unpopulateTimeRFC3339(val, "LastUploadedDate", &s.LastUploadedDate) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &s.LicenseType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &s.StartTime) + 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 SQLManagedInstanceSKU. +func (s SQLManagedInstanceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "dev", s.Dev) + populate(objectMap, "family", s.Family) + objectMap["name"] = "vCore" + populate(objectMap, "size", s.Size) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceSKU. +func (s *SQLManagedInstanceSKU) 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 "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "dev": + err = unpopulate(val, "Dev", &s.Dev) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + 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 SQLManagedInstanceUpdate. +func (s SQLManagedInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceUpdate. +func (s *SQLManagedInstanceUpdate) 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 "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SQLServerDatabaseResource. +func (s SQLServerDatabaseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResource. +func (s *SQLServerDatabaseResource) 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 "location": + err = unpopulate(val, "Location", &s.Location) + 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 "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SQLServerDatabaseResourceProperties. +func (s SQLServerDatabaseResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupInformation", s.BackupInformation) + populate(objectMap, "collationName", s.CollationName) + populate(objectMap, "compatibilityLevel", s.CompatibilityLevel) + populateTimeRFC3339(objectMap, "databaseCreationDate", s.DatabaseCreationDate) + populate(objectMap, "databaseOptions", s.DatabaseOptions) + populate(objectMap, "isReadOnly", s.IsReadOnly) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "recoveryMode", s.RecoveryMode) + populate(objectMap, "sizeMB", s.SizeMB) + populate(objectMap, "spaceAvailableMB", s.SpaceAvailableMB) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResourceProperties. +func (s *SQLServerDatabaseResourceProperties) 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 "backupInformation": + err = unpopulate(val, "BackupInformation", &s.BackupInformation) + delete(rawMsg, key) + case "collationName": + err = unpopulate(val, "CollationName", &s.CollationName) + delete(rawMsg, key) + case "compatibilityLevel": + err = unpopulate(val, "CompatibilityLevel", &s.CompatibilityLevel) + delete(rawMsg, key) + case "databaseCreationDate": + err = unpopulateTimeRFC3339(val, "DatabaseCreationDate", &s.DatabaseCreationDate) + delete(rawMsg, key) + case "databaseOptions": + err = unpopulate(val, "DatabaseOptions", &s.DatabaseOptions) + delete(rawMsg, key) + case "isReadOnly": + err = unpopulate(val, "IsReadOnly", &s.IsReadOnly) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "recoveryMode": + err = unpopulate(val, "RecoveryMode", &s.RecoveryMode) + delete(rawMsg, key) + case "sizeMB": + err = unpopulate(val, "SizeMB", &s.SizeMB) + delete(rawMsg, key) + case "spaceAvailableMB": + err = unpopulate(val, "SpaceAvailableMB", &s.SpaceAvailableMB) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + 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 SQLServerDatabaseResourcePropertiesBackupInformation. +func (s SQLServerDatabaseResourcePropertiesBackupInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "lastFullBackup", s.LastFullBackup) + populateTimeRFC3339(objectMap, "lastLogBackup", s.LastLogBackup) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResourcePropertiesBackupInformation. +func (s *SQLServerDatabaseResourcePropertiesBackupInformation) 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 "lastFullBackup": + err = unpopulateTimeRFC3339(val, "LastFullBackup", &s.LastFullBackup) + delete(rawMsg, key) + case "lastLogBackup": + err = unpopulateTimeRFC3339(val, "LastLogBackup", &s.LastLogBackup) + 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 SQLServerDatabaseResourcePropertiesDatabaseOptions. +func (s SQLServerDatabaseResourcePropertiesDatabaseOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isAutoCloseOn", s.IsAutoCloseOn) + populate(objectMap, "isAutoCreateStatsOn", s.IsAutoCreateStatsOn) + populate(objectMap, "isAutoShrinkOn", s.IsAutoShrinkOn) + populate(objectMap, "isAutoUpdateStatsOn", s.IsAutoUpdateStatsOn) + populate(objectMap, "isEncrypted", s.IsEncrypted) + populate(objectMap, "isMemoryOptimizationEnabled", s.IsMemoryOptimizationEnabled) + populate(objectMap, "isRemoteDataArchiveEnabled", s.IsRemoteDataArchiveEnabled) + populate(objectMap, "isTrustworthyOn", s.IsTrustworthyOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseResourcePropertiesDatabaseOptions. +func (s *SQLServerDatabaseResourcePropertiesDatabaseOptions) 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 "isAutoCloseOn": + err = unpopulate(val, "IsAutoCloseOn", &s.IsAutoCloseOn) + delete(rawMsg, key) + case "isAutoCreateStatsOn": + err = unpopulate(val, "IsAutoCreateStatsOn", &s.IsAutoCreateStatsOn) + delete(rawMsg, key) + case "isAutoShrinkOn": + err = unpopulate(val, "IsAutoShrinkOn", &s.IsAutoShrinkOn) + delete(rawMsg, key) + case "isAutoUpdateStatsOn": + err = unpopulate(val, "IsAutoUpdateStatsOn", &s.IsAutoUpdateStatsOn) + delete(rawMsg, key) + case "isEncrypted": + err = unpopulate(val, "IsEncrypted", &s.IsEncrypted) + delete(rawMsg, key) + case "isMemoryOptimizationEnabled": + err = unpopulate(val, "IsMemoryOptimizationEnabled", &s.IsMemoryOptimizationEnabled) + delete(rawMsg, key) + case "isRemoteDataArchiveEnabled": + err = unpopulate(val, "IsRemoteDataArchiveEnabled", &s.IsRemoteDataArchiveEnabled) + delete(rawMsg, key) + case "isTrustworthyOn": + err = unpopulate(val, "IsTrustworthyOn", &s.IsTrustworthyOn) + 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 SQLServerDatabaseUpdate. +func (s SQLServerDatabaseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerDatabaseUpdate. +func (s *SQLServerDatabaseUpdate) 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 "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SQLServerInstance. +func (s SQLServerInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerInstance. +func (s *SQLServerInstance) 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 "location": + err = unpopulate(val, "Location", &s.Location) + 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 "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SQLServerInstanceListResult. +func (s SQLServerInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerInstanceListResult. +func (s *SQLServerInstanceListResult) 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 SQLServerInstanceProperties. +func (s SQLServerInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureDefenderStatus", s.AzureDefenderStatus) + populateTimeRFC3339(objectMap, "azureDefenderStatusLastUpdated", s.AzureDefenderStatusLastUpdated) + populate(objectMap, "collation", s.Collation) + populate(objectMap, "containerResourceId", s.ContainerResourceID) + populate(objectMap, "cores", s.Cores) + populate(objectMap, "createTime", s.CreateTime) + populate(objectMap, "currentVersion", s.CurrentVersion) + populate(objectMap, "edition", s.Edition) + populate(objectMap, "hostType", s.HostType) + populate(objectMap, "instanceName", s.InstanceName) + populate(objectMap, "licenseType", s.LicenseType) + populate(objectMap, "patchLevel", s.PatchLevel) + populate(objectMap, "productId", s.ProductID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "status", s.Status) + populate(objectMap, "tcpDynamicPorts", s.TCPDynamicPorts) + populate(objectMap, "tcpStaticPorts", s.TCPStaticPorts) + populate(objectMap, "vCore", s.VCore) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerInstanceProperties. +func (s *SQLServerInstanceProperties) 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 "azureDefenderStatus": + err = unpopulate(val, "AzureDefenderStatus", &s.AzureDefenderStatus) + delete(rawMsg, key) + case "azureDefenderStatusLastUpdated": + err = unpopulateTimeRFC3339(val, "AzureDefenderStatusLastUpdated", &s.AzureDefenderStatusLastUpdated) + delete(rawMsg, key) + case "collation": + err = unpopulate(val, "Collation", &s.Collation) + delete(rawMsg, key) + case "containerResourceId": + err = unpopulate(val, "ContainerResourceID", &s.ContainerResourceID) + delete(rawMsg, key) + case "cores": + err = unpopulate(val, "Cores", &s.Cores) + delete(rawMsg, key) + case "createTime": + err = unpopulate(val, "CreateTime", &s.CreateTime) + delete(rawMsg, key) + case "currentVersion": + err = unpopulate(val, "CurrentVersion", &s.CurrentVersion) + delete(rawMsg, key) + case "edition": + err = unpopulate(val, "Edition", &s.Edition) + delete(rawMsg, key) + case "hostType": + err = unpopulate(val, "HostType", &s.HostType) + delete(rawMsg, key) + case "instanceName": + err = unpopulate(val, "InstanceName", &s.InstanceName) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, "LicenseType", &s.LicenseType) + delete(rawMsg, key) + case "patchLevel": + err = unpopulate(val, "PatchLevel", &s.PatchLevel) + delete(rawMsg, key) + case "productId": + err = unpopulate(val, "ProductID", &s.ProductID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "tcpDynamicPorts": + err = unpopulate(val, "TCPDynamicPorts", &s.TCPDynamicPorts) + delete(rawMsg, key) + case "tcpStaticPorts": + err = unpopulate(val, "TCPStaticPorts", &s.TCPStaticPorts) + delete(rawMsg, key) + case "vCore": + err = unpopulate(val, "VCore", &s.VCore) + 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) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerInstanceUpdate. +func (s SQLServerInstanceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerInstanceUpdate. +func (s *SQLServerInstanceUpdate) 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 "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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 TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + 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) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UploadServicePrincipal. +func (u UploadServicePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authority", u.Authority) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "clientSecret", u.ClientSecret) + populate(objectMap, "tenantId", u.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UploadServicePrincipal. +func (u *UploadServicePrincipal) 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 "authority": + err = unpopulate(val, "Authority", &u.Authority) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &u.ClientSecret) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &u.TenantID) + 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 UploadWatermark. +func (u UploadWatermark) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "logs", u.Logs) + populateTimeRFC3339(objectMap, "metrics", u.Metrics) + populateTimeRFC3339(objectMap, "usages", u.Usages) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UploadWatermark. +func (u *UploadWatermark) 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 "logs": + err = unpopulateTimeRFC3339(val, "Logs", &u.Logs) + delete(rawMsg, key) + case "metrics": + err = unpopulateTimeRFC3339(val, "Metrics", &u.Metrics) + delete(rawMsg, key) + case "usages": + err = unpopulateTimeRFC3339(val, "Usages", &u.Usages) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_operations_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go similarity index 89% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_operations_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go index 215f83c55fde..8641941208a6 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_operations_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -27,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -49,9 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Azure Data Services on Azure Arc API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-01-15-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -88,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_postgresinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go similarity index 88% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_postgresinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go index 4d246fc35e9b..2f65269dcda1 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_postgresinstances_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -31,9 +32,9 @@ type PostgresInstancesClient struct { } // NewPostgresInstancesClient creates a new instance of PostgresInstancesClient with the specified values. -// subscriptionID - The ID of the Azure subscription -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPostgresInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PostgresInstancesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,12 +57,13 @@ func NewPostgresInstancesClient(subscriptionID string, credential azcore.TokenCr // BeginCreate - Creates or replaces a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// postgresInstanceName - Name of Postgres Instance -// resource - The postgres instance -// options - PostgresInstancesClientBeginCreateOptions contains the optional parameters for the PostgresInstancesClient.BeginCreate -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - postgresInstanceName - Name of Postgres Instance +// - resource - The postgres instance +// - options - PostgresInstancesClientBeginCreateOptions contains the optional parameters for the PostgresInstancesClient.BeginCreate +// method. func (client *PostgresInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, postgresInstanceName string, resource PostgresInstance, options *PostgresInstancesClientBeginCreateOptions) (*runtime.Poller[PostgresInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, postgresInstanceName, resource, options) @@ -78,7 +80,8 @@ func (client *PostgresInstancesClient) BeginCreate(ctx context.Context, resource // Create - Creates or replaces a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *PostgresInstancesClient) create(ctx context.Context, resourceGroupName string, postgresInstanceName string, resource PostgresInstance, options *PostgresInstancesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, postgresInstanceName, resource, options) if err != nil { @@ -114,7 +117,7 @@ func (client *PostgresInstancesClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) @@ -122,11 +125,12 @@ func (client *PostgresInstancesClient) createCreateRequest(ctx context.Context, // BeginDelete - Deletes a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// postgresInstanceName - Name of Postgres Instance -// options - PostgresInstancesClientBeginDeleteOptions contains the optional parameters for the PostgresInstancesClient.BeginDelete -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - postgresInstanceName - Name of Postgres Instance +// - options - PostgresInstancesClientBeginDeleteOptions contains the optional parameters for the PostgresInstancesClient.BeginDelete +// method. func (client *PostgresInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, postgresInstanceName string, options *PostgresInstancesClientBeginDeleteOptions) (*runtime.Poller[PostgresInstancesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, postgresInstanceName, options) @@ -141,7 +145,8 @@ func (client *PostgresInstancesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *PostgresInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, postgresInstanceName string, options *PostgresInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, postgresInstanceName, options) if err != nil { @@ -177,7 +182,7 @@ func (client *PostgresInstancesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,10 +190,11 @@ func (client *PostgresInstancesClient) deleteCreateRequest(ctx context.Context, // Get - Retrieves a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// postgresInstanceName - Name of Postgres Instance -// options - PostgresInstancesClientGetOptions contains the optional parameters for the PostgresInstancesClient.Get method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - postgresInstanceName - Name of Postgres Instance +// - options - PostgresInstancesClientGetOptions contains the optional parameters for the PostgresInstancesClient.Get method. func (client *PostgresInstancesClient) Get(ctx context.Context, resourceGroupName string, postgresInstanceName string, options *PostgresInstancesClientGetOptions) (PostgresInstancesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, postgresInstanceName, options) if err != nil { @@ -224,7 +230,7 @@ func (client *PostgresInstancesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,9 +246,10 @@ func (client *PostgresInstancesClient) getHandleResponse(resp *http.Response) (P } // NewListPager - List postgres Instance resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// options - PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.List method. +// +// Generated from API version 2023-01-15-preview +// - options - PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.NewListPager +// method. func (client *PostgresInstancesClient) NewListPager(options *PostgresInstancesClientListOptions) *runtime.Pager[PostgresInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PostgresInstancesClientListResponse]{ More: func(page PostgresInstancesClientListResponse) bool { @@ -283,7 +290,7 @@ func (client *PostgresInstancesClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,11 +306,11 @@ func (client *PostgresInstancesClient) listHandleResponse(resp *http.Response) ( } // NewListByResourceGroupPager - Get a postgres Instances list by Resource group name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// options - PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - options - PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.NewListByResourceGroupPager +// method. func (client *PostgresInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *PostgresInstancesClientListByResourceGroupOptions) *runtime.Pager[PostgresInstancesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[PostgresInstancesClientListByResourceGroupResponse]{ More: func(page PostgresInstancesClientListByResourceGroupResponse) bool { @@ -348,7 +355,7 @@ func (client *PostgresInstancesClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,12 +372,13 @@ func (client *PostgresInstancesClient) listByResourceGroupHandleResponse(resp *h // Update - Updates a postgres Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// postgresInstanceName - Name of Postgres Instance -// parameters - The Postgres Instance. -// options - PostgresInstancesClientUpdateOptions contains the optional parameters for the PostgresInstancesClient.Update -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - postgresInstanceName - Name of Postgres Instance +// - parameters - The Postgres Instance. +// - options - PostgresInstancesClientUpdateOptions contains the optional parameters for the PostgresInstancesClient.Update +// method. func (client *PostgresInstancesClient) Update(ctx context.Context, resourceGroupName string, postgresInstanceName string, parameters PostgresInstanceUpdate, options *PostgresInstancesClientUpdateOptions) (PostgresInstancesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, postgresInstanceName, parameters, options) if err != nil { @@ -406,7 +414,7 @@ func (client *PostgresInstancesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go similarity index 63% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go index af0c54e4b084..a18f1931c9d1 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go @@ -5,15 +5,16 @@ // 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 armazurearcdata -// ActiveDirectoryConnectorsClientCreateResponse contains the response from method ActiveDirectoryConnectorsClient.Create. +// ActiveDirectoryConnectorsClientCreateResponse contains the response from method ActiveDirectoryConnectorsClient.BeginCreate. type ActiveDirectoryConnectorsClientCreateResponse struct { ActiveDirectoryConnectorResource } -// ActiveDirectoryConnectorsClientDeleteResponse contains the response from method ActiveDirectoryConnectorsClient.Delete. +// ActiveDirectoryConnectorsClientDeleteResponse contains the response from method ActiveDirectoryConnectorsClient.BeginDelete. type ActiveDirectoryConnectorsClientDeleteResponse struct { // placeholder for future response values } @@ -23,12 +24,12 @@ type ActiveDirectoryConnectorsClientGetResponse struct { ActiveDirectoryConnectorResource } -// ActiveDirectoryConnectorsClientListResponse contains the response from method ActiveDirectoryConnectorsClient.List. +// ActiveDirectoryConnectorsClientListResponse contains the response from method ActiveDirectoryConnectorsClient.NewListPager. type ActiveDirectoryConnectorsClientListResponse struct { ActiveDirectoryConnectorListResult } -// DataControllersClientDeleteDataControllerResponse contains the response from method DataControllersClient.DeleteDataController. +// DataControllersClientDeleteDataControllerResponse contains the response from method DataControllersClient.BeginDeleteDataController. type DataControllersClientDeleteDataControllerResponse struct { // placeholder for future response values } @@ -38,37 +39,57 @@ type DataControllersClientGetDataControllerResponse struct { DataControllerResource } -// DataControllersClientListInGroupResponse contains the response from method DataControllersClient.ListInGroup. +// DataControllersClientListInGroupResponse contains the response from method DataControllersClient.NewListInGroupPager. type DataControllersClientListInGroupResponse struct { PageOfDataControllerResource } -// DataControllersClientListInSubscriptionResponse contains the response from method DataControllersClient.ListInSubscription. +// DataControllersClientListInSubscriptionResponse contains the response from method DataControllersClient.NewListInSubscriptionPager. type DataControllersClientListInSubscriptionResponse struct { PageOfDataControllerResource } -// DataControllersClientPatchDataControllerResponse contains the response from method DataControllersClient.PatchDataController. +// DataControllersClientPatchDataControllerResponse contains the response from method DataControllersClient.BeginPatchDataController. type DataControllersClientPatchDataControllerResponse struct { DataControllerResource } -// DataControllersClientPutDataControllerResponse contains the response from method DataControllersClient.PutDataController. +// DataControllersClientPutDataControllerResponse contains the response from method DataControllersClient.BeginPutDataController. type DataControllersClientPutDataControllerResponse struct { DataControllerResource } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// FailoverGroupsClientCreateResponse contains the response from method FailoverGroupsClient.BeginCreate. +type FailoverGroupsClientCreateResponse struct { + FailoverGroupResource +} + +// FailoverGroupsClientDeleteResponse contains the response from method FailoverGroupsClient.BeginDelete. +type FailoverGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// FailoverGroupsClientGetResponse contains the response from method FailoverGroupsClient.Get. +type FailoverGroupsClientGetResponse struct { + FailoverGroupResource +} + +// FailoverGroupsClientListResponse contains the response from method FailoverGroupsClient.NewListPager. +type FailoverGroupsClientListResponse struct { + FailoverGroupListResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// PostgresInstancesClientCreateResponse contains the response from method PostgresInstancesClient.Create. +// PostgresInstancesClientCreateResponse contains the response from method PostgresInstancesClient.BeginCreate. type PostgresInstancesClientCreateResponse struct { PostgresInstance } -// PostgresInstancesClientDeleteResponse contains the response from method PostgresInstancesClient.Delete. +// PostgresInstancesClientDeleteResponse contains the response from method PostgresInstancesClient.BeginDelete. type PostgresInstancesClientDeleteResponse struct { // placeholder for future response values } @@ -78,12 +99,12 @@ type PostgresInstancesClientGetResponse struct { PostgresInstance } -// PostgresInstancesClientListByResourceGroupResponse contains the response from method PostgresInstancesClient.ListByResourceGroup. +// PostgresInstancesClientListByResourceGroupResponse contains the response from method PostgresInstancesClient.NewListByResourceGroupPager. type PostgresInstancesClientListByResourceGroupResponse struct { PostgresInstanceListResult } -// PostgresInstancesClientListResponse contains the response from method PostgresInstancesClient.List. +// PostgresInstancesClientListResponse contains the response from method PostgresInstancesClient.NewListPager. type PostgresInstancesClientListResponse struct { PostgresInstanceListResult } @@ -93,12 +114,12 @@ type PostgresInstancesClientUpdateResponse struct { PostgresInstance } -// SQLManagedInstancesClientCreateResponse contains the response from method SQLManagedInstancesClient.Create. +// SQLManagedInstancesClientCreateResponse contains the response from method SQLManagedInstancesClient.BeginCreate. type SQLManagedInstancesClientCreateResponse struct { SQLManagedInstance } -// SQLManagedInstancesClientDeleteResponse contains the response from method SQLManagedInstancesClient.Delete. +// SQLManagedInstancesClientDeleteResponse contains the response from method SQLManagedInstancesClient.BeginDelete. type SQLManagedInstancesClientDeleteResponse struct { // placeholder for future response values } @@ -108,12 +129,12 @@ type SQLManagedInstancesClientGetResponse struct { SQLManagedInstance } -// SQLManagedInstancesClientListByResourceGroupResponse contains the response from method SQLManagedInstancesClient.ListByResourceGroup. +// SQLManagedInstancesClientListByResourceGroupResponse contains the response from method SQLManagedInstancesClient.NewListByResourceGroupPager. type SQLManagedInstancesClientListByResourceGroupResponse struct { SQLManagedInstanceListResult } -// SQLManagedInstancesClientListResponse contains the response from method SQLManagedInstancesClient.List. +// SQLManagedInstancesClientListResponse contains the response from method SQLManagedInstancesClient.NewListPager. type SQLManagedInstancesClientListResponse struct { SQLManagedInstanceListResult } @@ -123,12 +144,37 @@ type SQLManagedInstancesClientUpdateResponse struct { SQLManagedInstance } -// SQLServerInstancesClientCreateResponse contains the response from method SQLServerInstancesClient.Create. +// SQLServerDatabasesClientCreateResponse contains the response from method SQLServerDatabasesClient.Create. +type SQLServerDatabasesClientCreateResponse struct { + SQLServerDatabaseResource +} + +// SQLServerDatabasesClientDeleteResponse contains the response from method SQLServerDatabasesClient.Delete. +type SQLServerDatabasesClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLServerDatabasesClientGetResponse contains the response from method SQLServerDatabasesClient.Get. +type SQLServerDatabasesClientGetResponse struct { + SQLServerDatabaseResource +} + +// SQLServerDatabasesClientListResponse contains the response from method SQLServerDatabasesClient.NewListPager. +type SQLServerDatabasesClientListResponse struct { + ArcSQLServerDatabaseListResult +} + +// SQLServerDatabasesClientUpdateResponse contains the response from method SQLServerDatabasesClient.Update. +type SQLServerDatabasesClientUpdateResponse struct { + SQLServerDatabaseResource +} + +// SQLServerInstancesClientCreateResponse contains the response from method SQLServerInstancesClient.BeginCreate. type SQLServerInstancesClientCreateResponse struct { SQLServerInstance } -// SQLServerInstancesClientDeleteResponse contains the response from method SQLServerInstancesClient.Delete. +// SQLServerInstancesClientDeleteResponse contains the response from method SQLServerInstancesClient.BeginDelete. type SQLServerInstancesClientDeleteResponse struct { // placeholder for future response values } @@ -138,12 +184,12 @@ type SQLServerInstancesClientGetResponse struct { SQLServerInstance } -// SQLServerInstancesClientListByResourceGroupResponse contains the response from method SQLServerInstancesClient.ListByResourceGroup. +// SQLServerInstancesClientListByResourceGroupResponse contains the response from method SQLServerInstancesClient.NewListByResourceGroupPager. type SQLServerInstancesClientListByResourceGroupResponse struct { SQLServerInstanceListResult } -// SQLServerInstancesClientListResponse contains the response from method SQLServerInstancesClient.List. +// SQLServerInstancesClientListResponse contains the response from method SQLServerInstancesClient.NewListPager. type SQLServerInstancesClientListResponse struct { SQLServerInstanceListResult } diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go similarity index 87% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go index dc02bca4675b..b29f9f48459f 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -31,9 +32,9 @@ type SQLManagedInstancesClient struct { } // NewSQLManagedInstancesClient creates a new instance of SQLManagedInstancesClient with the specified values. -// subscriptionID - The ID of the Azure subscription -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSQLManagedInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLManagedInstancesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,12 +57,13 @@ func NewSQLManagedInstancesClient(subscriptionID string, credential azcore.Token // BeginCreate - Creates or replaces a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlManagedInstanceName - Name of SQL Managed Instance -// sqlManagedInstance - The SQL Managed Instance to be created or updated. -// options - SQLManagedInstancesClientBeginCreateOptions contains the optional parameters for the SQLManagedInstancesClient.BeginCreate -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - sqlManagedInstance - The SQL Managed Instance to be created or updated. +// - options - SQLManagedInstancesClientBeginCreateOptions contains the optional parameters for the SQLManagedInstancesClient.BeginCreate +// method. func (client *SQLManagedInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, sqlManagedInstance SQLManagedInstance, options *SQLManagedInstancesClientBeginCreateOptions) (*runtime.Poller[SQLManagedInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, options) @@ -78,7 +80,8 @@ func (client *SQLManagedInstancesClient) BeginCreate(ctx context.Context, resour // Create - Creates or replaces a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *SQLManagedInstancesClient) create(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, sqlManagedInstance SQLManagedInstance, options *SQLManagedInstancesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, sqlManagedInstance, options) if err != nil { @@ -114,7 +117,7 @@ func (client *SQLManagedInstancesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sqlManagedInstance) @@ -122,11 +125,12 @@ func (client *SQLManagedInstancesClient) createCreateRequest(ctx context.Context // BeginDelete - Deletes a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlManagedInstanceName - Name of SQL Managed Instance -// options - SQLManagedInstancesClientBeginDeleteOptions contains the optional parameters for the SQLManagedInstancesClient.BeginDelete -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - options - SQLManagedInstancesClientBeginDeleteOptions contains the optional parameters for the SQLManagedInstancesClient.BeginDelete +// method. func (client *SQLManagedInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, options *SQLManagedInstancesClientBeginDeleteOptions) (*runtime.Poller[SQLManagedInstancesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sqlManagedInstanceName, options) @@ -141,7 +145,8 @@ func (client *SQLManagedInstancesClient) BeginDelete(ctx context.Context, resour // Delete - Deletes a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *SQLManagedInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, options *SQLManagedInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, options) if err != nil { @@ -177,7 +182,7 @@ func (client *SQLManagedInstancesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,10 +190,11 @@ func (client *SQLManagedInstancesClient) deleteCreateRequest(ctx context.Context // Get - Retrieves a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlManagedInstanceName - Name of SQL Managed Instance -// options - SQLManagedInstancesClientGetOptions contains the optional parameters for the SQLManagedInstancesClient.Get method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - options - SQLManagedInstancesClientGetOptions contains the optional parameters for the SQLManagedInstancesClient.Get method. func (client *SQLManagedInstancesClient) Get(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, options *SQLManagedInstancesClientGetOptions) (SQLManagedInstancesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, options) if err != nil { @@ -224,7 +230,7 @@ func (client *SQLManagedInstancesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,10 +246,10 @@ func (client *SQLManagedInstancesClient) getHandleResponse(resp *http.Response) } // NewListPager - List sqlManagedInstance resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// options - SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.List -// method. +// +// Generated from API version 2023-01-15-preview +// - options - SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.NewListPager +// method. func (client *SQLManagedInstancesClient) NewListPager(options *SQLManagedInstancesClientListOptions) *runtime.Pager[SQLManagedInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SQLManagedInstancesClientListResponse]{ More: func(page SQLManagedInstancesClientListResponse) bool { @@ -284,7 +290,7 @@ func (client *SQLManagedInstancesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,11 +306,11 @@ func (client *SQLManagedInstancesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all sqlManagedInstances in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// options - SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - options - SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.NewListByResourceGroupPager +// method. func (client *SQLManagedInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *SQLManagedInstancesClientListByResourceGroupOptions) *runtime.Pager[SQLManagedInstancesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[SQLManagedInstancesClientListByResourceGroupResponse]{ More: func(page SQLManagedInstancesClientListByResourceGroupResponse) bool { @@ -349,7 +355,7 @@ func (client *SQLManagedInstancesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,12 +372,13 @@ func (client *SQLManagedInstancesClient) listByResourceGroupHandleResponse(resp // Update - Updates a SQL Managed Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlManagedInstanceName - Name of SQL Managed Instance -// parameters - The SQL Managed Instance. -// options - SQLManagedInstancesClientUpdateOptions contains the optional parameters for the SQLManagedInstancesClient.Update -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlManagedInstanceName - Name of SQL Managed Instance +// - parameters - The SQL Managed Instance. +// - options - SQLManagedInstancesClientUpdateOptions contains the optional parameters for the SQLManagedInstancesClient.Update +// method. func (client *SQLManagedInstancesClient) Update(ctx context.Context, resourceGroupName string, sqlManagedInstanceName string, parameters SQLManagedInstanceUpdate, options *SQLManagedInstancesClientUpdateOptions) (SQLManagedInstancesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlManagedInstanceName, parameters, options) if err != nil { @@ -407,7 +414,7 @@ func (client *SQLManagedInstancesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go new file mode 100644 index 000000000000..5c73ed65bf06 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go @@ -0,0 +1,370 @@ +//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 armazurearcdata + +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" +) + +// SQLServerDatabasesClient contains the methods for the SQLServerDatabases group. +// Don't use this type directly, use NewSQLServerDatabasesClient() instead. +type SQLServerDatabasesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSQLServerDatabasesClient creates a new instance of SQLServerDatabasesClient with the specified values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSQLServerDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLServerDatabasesClient, 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 := &SQLServerDatabasesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Creates or replaces an Arc Sql Server Database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - sqlServerDatabaseResource - The request body for database resource. +// - options - SQLServerDatabasesClientCreateOptions contains the optional parameters for the SQLServerDatabasesClient.Create +// method. +func (client *SQLServerDatabasesClient) Create(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseResource SQLServerDatabaseResource, options *SQLServerDatabasesClientCreateOptions) (SQLServerDatabasesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseResource, options) + if err != nil { + return SQLServerDatabasesClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SQLServerDatabasesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *SQLServerDatabasesClient) createCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseResource SQLServerDatabaseResource, options *SQLServerDatabasesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlServerDatabaseResource) +} + +// createHandleResponse handles the Create response. +func (client *SQLServerDatabasesClient) createHandleResponse(resp *http.Response) (SQLServerDatabasesClientCreateResponse, error) { + result := SQLServerDatabasesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerDatabaseResource); err != nil { + return SQLServerDatabasesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an Arc Sql Server database resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - options - SQLServerDatabasesClientDeleteOptions contains the optional parameters for the SQLServerDatabasesClient.Delete +// method. +func (client *SQLServerDatabasesClient) Delete(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientDeleteOptions) (SQLServerDatabasesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, options) + if err != nil { + return SQLServerDatabasesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SQLServerDatabasesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SQLServerDatabasesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SQLServerDatabasesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLServerDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves an Arc Sql Server database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - options - SQLServerDatabasesClientGetOptions contains the optional parameters for the SQLServerDatabasesClient.Get method. +func (client *SQLServerDatabasesClient) Get(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientGetOptions) (SQLServerDatabasesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, options) + if err != nil { + return SQLServerDatabasesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SQLServerDatabasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SQLServerDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, options *SQLServerDatabasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SQLServerDatabasesClient) getHandleResponse(resp *http.Response) (SQLServerDatabasesClientGetResponse, error) { + result := SQLServerDatabasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerDatabaseResource); err != nil { + return SQLServerDatabasesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List the databases associated with the given Arc Sql Server. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - options - SQLServerDatabasesClientListOptions contains the optional parameters for the SQLServerDatabasesClient.NewListPager +// method. +func (client *SQLServerDatabasesClient) NewListPager(resourceGroupName string, sqlServerInstanceName string, options *SQLServerDatabasesClientListOptions) *runtime.Pager[SQLServerDatabasesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLServerDatabasesClientListResponse]{ + More: func(page SQLServerDatabasesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLServerDatabasesClientListResponse) (SQLServerDatabasesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SQLServerDatabasesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SQLServerDatabasesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SQLServerDatabasesClient) listCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerDatabasesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + 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", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SQLServerDatabasesClient) listHandleResponse(resp *http.Response) (SQLServerDatabasesClientListResponse, error) { + result := SQLServerDatabasesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArcSQLServerDatabaseListResult); err != nil { + return SQLServerDatabasesClientListResponse{}, err + } + return result, nil +} + +// Update - Updates an existing database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - databaseName - Name of the database +// - sqlServerDatabaseUpdate - The requested database resource state. +// - options - SQLServerDatabasesClientUpdateOptions contains the optional parameters for the SQLServerDatabasesClient.Update +// method. +func (client *SQLServerDatabasesClient) Update(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseUpdate SQLServerDatabaseUpdate, options *SQLServerDatabasesClientUpdateOptions) (SQLServerDatabasesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, databaseName, sqlServerDatabaseUpdate, options) + if err != nil { + return SQLServerDatabasesClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SQLServerDatabasesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SQLServerDatabasesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SQLServerDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, databaseName string, sqlServerDatabaseUpdate SQLServerDatabaseUpdate, options *SQLServerDatabasesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlServerInstanceName == "" { + return nil, errors.New("parameter sqlServerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlServerInstanceName}", url.PathEscape(sqlServerInstanceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, sqlServerDatabaseUpdate) +} + +// updateHandleResponse handles the Update response. +func (client *SQLServerDatabasesClient) updateHandleResponse(resp *http.Response) (SQLServerDatabasesClientUpdateResponse, error) { + result := SQLServerDatabasesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLServerDatabaseResource); err != nil { + return SQLServerDatabasesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlserverinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go similarity index 87% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlserverinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go index 4947972c62cc..b7e8da2ec6f5 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlserverinstances_client.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -31,9 +32,9 @@ type SQLServerInstancesClient struct { } // NewSQLServerInstancesClient creates a new instance of SQLServerInstancesClient with the specified values. -// subscriptionID - The ID of the Azure subscription -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the Azure subscription +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSQLServerInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLServerInstancesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,12 +57,13 @@ func NewSQLServerInstancesClient(subscriptionID string, credential azcore.TokenC // BeginCreate - Creates or replaces a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlServerInstanceName - Name of SQL Server Instance -// sqlServerInstance - The SQL Server Instance to be created or updated. -// options - SQLServerInstancesClientBeginCreateOptions contains the optional parameters for the SQLServerInstancesClient.BeginCreate -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - sqlServerInstance - The SQL Server Instance to be created or updated. +// - options - SQLServerInstancesClientBeginCreateOptions contains the optional parameters for the SQLServerInstancesClient.BeginCreate +// method. func (client *SQLServerInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlServerInstance SQLServerInstance, options *SQLServerInstancesClientBeginCreateOptions) (*runtime.Poller[SQLServerInstancesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, sqlServerInstanceName, sqlServerInstance, options) @@ -78,7 +80,8 @@ func (client *SQLServerInstancesClient) BeginCreate(ctx context.Context, resourc // Create - Creates or replaces a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *SQLServerInstancesClient) create(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, sqlServerInstance SQLServerInstance, options *SQLServerInstancesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, sqlServerInstance, options) if err != nil { @@ -114,7 +117,7 @@ func (client *SQLServerInstancesClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sqlServerInstance) @@ -122,11 +125,12 @@ func (client *SQLServerInstancesClient) createCreateRequest(ctx context.Context, // BeginDelete - Deletes a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlServerInstanceName - Name of SQL Server Instance -// options - SQLServerInstancesClientBeginDeleteOptions contains the optional parameters for the SQLServerInstancesClient.BeginDelete -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - options - SQLServerInstancesClientBeginDeleteOptions contains the optional parameters for the SQLServerInstancesClient.BeginDelete +// method. func (client *SQLServerInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerInstancesClientBeginDeleteOptions) (*runtime.Poller[SQLServerInstancesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sqlServerInstanceName, options) @@ -141,7 +145,8 @@ func (client *SQLServerInstancesClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview +// +// Generated from API version 2023-01-15-preview func (client *SQLServerInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, options) if err != nil { @@ -177,7 +182,7 @@ func (client *SQLServerInstancesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,10 +190,11 @@ func (client *SQLServerInstancesClient) deleteCreateRequest(ctx context.Context, // Get - Retrieves a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlServerInstanceName - Name of SQL Server Instance -// options - SQLServerInstancesClientGetOptions contains the optional parameters for the SQLServerInstancesClient.Get method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - options - SQLServerInstancesClientGetOptions contains the optional parameters for the SQLServerInstancesClient.Get method. func (client *SQLServerInstancesClient) Get(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, options *SQLServerInstancesClientGetOptions) (SQLServerInstancesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, options) if err != nil { @@ -224,7 +230,7 @@ func (client *SQLServerInstancesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,9 +246,10 @@ func (client *SQLServerInstancesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - List sqlServerInstance resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// options - SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.List method. +// +// Generated from API version 2023-01-15-preview +// - options - SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.NewListPager +// method. func (client *SQLServerInstancesClient) NewListPager(options *SQLServerInstancesClientListOptions) *runtime.Pager[SQLServerInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SQLServerInstancesClientListResponse]{ More: func(page SQLServerInstancesClientListResponse) bool { @@ -283,7 +290,7 @@ func (client *SQLServerInstancesClient) listCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,11 +306,11 @@ func (client *SQLServerInstancesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all sqlServerInstances in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// options - SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - options - SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.NewListByResourceGroupPager +// method. func (client *SQLServerInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *SQLServerInstancesClientListByResourceGroupOptions) *runtime.Pager[SQLServerInstancesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[SQLServerInstancesClientListByResourceGroupResponse]{ More: func(page SQLServerInstancesClientListByResourceGroupResponse) bool { @@ -348,7 +355,7 @@ func (client *SQLServerInstancesClient) listByResourceGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,12 +372,13 @@ func (client *SQLServerInstancesClient) listByResourceGroupHandleResponse(resp * // Update - Updates a SQL Server Instance resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01-preview -// resourceGroupName - The name of the Azure resource group -// sqlServerInstanceName - Name of SQL Server Instance -// parameters - The SQL Server Instance. -// options - SQLServerInstancesClientUpdateOptions contains the optional parameters for the SQLServerInstancesClient.Update -// method. +// +// Generated from API version 2023-01-15-preview +// - resourceGroupName - The name of the Azure resource group +// - sqlServerInstanceName - Name of SQL Server Instance +// - parameters - The SQL Server Instance. +// - options - SQLServerInstancesClientUpdateOptions contains the optional parameters for the SQLServerInstancesClient.Update +// method. func (client *SQLServerInstancesClient) Update(ctx context.Context, resourceGroupName string, sqlServerInstanceName string, parameters SQLServerInstanceUpdate, options *SQLServerInstancesClientUpdateOptions) (SQLServerInstancesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlServerInstanceName, parameters, options) if err != nil { @@ -406,7 +414,7 @@ func (client *SQLServerInstancesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2023-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_time_rfc3339.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/time_rfc3339.go index 2b9ef2fbbd2c..ee71306a2b54 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armazurearcdata @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_activedirectoryconnectors_client_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_activedirectoryconnectors_client_test.go deleted file mode 100644 index 2c81b125f400..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_activedirectoryconnectors_client_test.go +++ /dev/null @@ -1,148 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByDataControllerActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewActiveDirectoryConnectorsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("testrg", - "testdataController", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewActiveDirectoryConnectorsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testrg", - "testdataController", - "testADConnector", - armazurearcdata.ActiveDirectoryConnectorResource{ - Properties: &armazurearcdata.ActiveDirectoryConnectorProperties{ - Spec: &armazurearcdata.ActiveDirectoryConnectorSpec{ - ActiveDirectory: &armazurearcdata.ActiveDirectoryConnectorDomainDetails{ - DomainControllers: &armazurearcdata.ActiveDirectoryDomainControllers{ - PrimaryDomainController: &armazurearcdata.ActiveDirectoryDomainController{ - Hostname: to.Ptr("dc1.contoso.local"), - }, - SecondaryDomainControllers: []*armazurearcdata.ActiveDirectoryDomainController{ - { - Hostname: to.Ptr("dc2.contoso.local"), - }, - { - Hostname: to.Ptr("dc3.contoso.local"), - }}, - }, - Realm: to.Ptr("CONTOSO.LOCAL"), - ServiceAccountProvisioning: to.Ptr(armazurearcdata.AccountProvisioningModeManual), - }, - DNS: &armazurearcdata.ActiveDirectoryConnectorDNSDetails{ - NameserverIPAddresses: []*string{ - to.Ptr("11.11.111.111"), - to.Ptr("22.22.222.222")}, - PreferK8SDNSForPtrLookups: to.Ptr(false), - Replicas: to.Ptr[int64](1), - }, - }, - }, - }, - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewActiveDirectoryConnectorsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "testdataController", - "testADConnector", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetActiveDirectoryConnector.json -func ExampleActiveDirectoryConnectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewActiveDirectoryConnectorsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testdataController", - "testADConnector", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_datacontrollers_client_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_datacontrollers_client_test.go deleted file mode 100644 index 6ee03226dbb2..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_datacontrollers_client_test.go +++ /dev/null @@ -1,218 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionDataController.json -func ExampleDataControllersClient_NewListInSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewDataControllersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListInSubscriptionPager(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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupDataController.json -func ExampleDataControllersClient_NewListInGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewDataControllersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListInGroupPager("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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateDataController.json -func ExampleDataControllersClient_BeginPutDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewDataControllersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPutDataController(ctx, - "testrg", - "testdataController", - armazurearcdata.DataControllerResource{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - ExtendedLocation: &armazurearcdata.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurearcdata.DataControllerProperties{ - BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - Infrastructure: to.Ptr(armazurearcdata.InfrastructureOnpremises), - LogAnalyticsWorkspaceConfig: &armazurearcdata.LogAnalyticsWorkspaceConfig{ - PrimaryKey: to.Ptr("********"), - WorkspaceID: to.Ptr("00000000-1111-2222-3333-444444444444"), - }, - LogsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - MetricsDashboardCredential: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - OnPremiseProperty: &armazurearcdata.OnPremiseProperty{ - ID: to.Ptr("12345678-1234-1234-ab12-1a2b3c4d5e6f"), - PublicSigningKey: to.Ptr("publicOnPremSigningKey"), - }, - UploadServicePrincipal: &armazurearcdata.UploadServicePrincipal{ - Authority: to.Ptr("https://login.microsoftonline.com/"), - ClientID: to.Ptr("00000000-1111-2222-3333-444444444444"), - ClientSecret: to.Ptr("********"), - TenantID: to.Ptr("00000000-1111-2222-3333-444444444444"), - }, - UploadWatermark: &armazurearcdata.UploadWatermark{ - Logs: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t }()), - Metrics: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t }()), - Usages: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t }()), - }, - }, - }, - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteDataController.json -func ExampleDataControllersClient_BeginDeleteDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewDataControllersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDeleteDataController(ctx, - "testrg", - "testdataController", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetDataController.json -func ExampleDataControllersClient_GetDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewDataControllersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDataController(ctx, - "testrg", - "testdataController", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateDataController.json -func ExampleDataControllersClient_BeginPatchDataController() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewDataControllersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPatchDataController(ctx, - "testrg", - "testdataController1", - armazurearcdata.DataControllerUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_operations_client_test.go deleted file mode 100644 index 78875ad95dc8..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armazurearcdata_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListOperation.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_postgresinstances_client_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_postgresinstances_client_test.go deleted file mode 100644 index 3551a1c512a5..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_postgresinstances_client_test.go +++ /dev/null @@ -1,258 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionPostgresInstance.json -func ExamplePostgresInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewPostgresInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupPostgresInstance.json -func ExamplePostgresInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewPostgresInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetPostgresInstance.json -func ExamplePostgresInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewPostgresInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testpostgresInstances", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdatePostgresInstance.json -func ExamplePostgresInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewPostgresInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testrg", - "testpostgresInstance", - armazurearcdata.PostgresInstance{ - Location: to.Ptr("eastus"), - ExtendedLocation: &armazurearcdata.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurearcdata.PostgresInstanceProperties{ - Admin: to.Ptr("admin"), - BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - DataControllerID: to.Ptr("dataControllerId"), - K8SRaw: map[string]interface{}{ - "apiVersion": "apiVersion", - "kind": "postgresql-12", - "metadata": map[string]interface{}{ - "name": "pg1", - "creationTimestamp": "2020-08-25T14:55:10Z", - "generation": float64(1), - "namespace": "test", - "resourceVersion": "527780", - "selfLink": "/apis/arcdata.microsoft.com/v1alpha1/namespaces/test/postgresql-12s/pg1", - "uid": "1111aaaa-ffff-ffff-ffff-99999aaaaaaa", - }, - "spec": map[string]interface{}{ - "backups": map[string]interface{}{ - "deltaMinutes": float64(3), - "fullMinutes": float64(10), - "tiers": []interface{}{ - map[string]interface{}{ - "retention": map[string]interface{}{ - "maximums": []interface{}{ - "6", - "512MB", - }, - "minimums": []interface{}{ - "3", - }, - }, - "storage": map[string]interface{}{ - "volumeSize": "1Gi", - }, - }, - }, - }, - "engine": map[string]interface{}{ - "extensions": []interface{}{ - map[string]interface{}{ - "name": "citus", - }, - }, - }, - "scale": map[string]interface{}{ - "shards": float64(3), - }, - "scheduling": map[string]interface{}{ - "default": map[string]interface{}{ - "resources": map[string]interface{}{ - "requests": map[string]interface{}{ - "memory": "256Mi", - }, - }, - }, - }, - "service": map[string]interface{}{ - "type": "NodePort", - }, - "storage": map[string]interface{}{ - "data": map[string]interface{}{ - "className": "local-storage", - "size": "5Gi", - }, - "logs": map[string]interface{}{ - "className": "local-storage", - "size": "5Gi", - }, - }, - }, - "status": map[string]interface{}{ - "externalEndpoint": nil, - "readyPods": "4/4", - "state": "Ready", - }, - }, - }, - SKU: &armazurearcdata.PostgresInstanceSKU{ - Name: to.Ptr("default"), - Dev: to.Ptr(true), - Tier: to.Ptr("Hyperscale"), - }, - }, - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeletePostgresInstance.json -func ExamplePostgresInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewPostgresInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "testpostgresInstance", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdatePostgresInstance.json -func ExamplePostgresInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewPostgresInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "testrg", - "testpostgresInstance", - armazurearcdata.PostgresInstanceUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlmanagedinstances_client_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlmanagedinstances_client_test.go deleted file mode 100644 index 357f3bd56c98..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlmanagedinstances_client_test.go +++ /dev/null @@ -1,222 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLManagedInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLManagedInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLManagedInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testsqlManagedInstance", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLManagedInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testrg", - "testsqlManagedInstance", - armazurearcdata.SQLManagedInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - ExtendedLocation: &armazurearcdata.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/arclocation"), - Type: to.Ptr(armazurearcdata.ExtendedLocationTypesCustomLocation), - }, - Properties: &armazurearcdata.SQLManagedInstanceProperties{ - ActiveDirectoryInformation: &armazurearcdata.ActiveDirectoryInformation{ - KeytabInformation: &armazurearcdata.KeytabInformation{ - Keytab: to.Ptr("********"), - }, - }, - Admin: to.Ptr("Admin user"), - BasicLoginInformation: &armazurearcdata.BasicLoginInformation{ - Password: to.Ptr("********"), - Username: to.Ptr("username"), - }, - ClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s"), - EndTime: to.Ptr("Instance end time"), - ExtensionID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Kubernetes/connectedClusters/connectedk8s/providers/Microsoft.KubernetesConfiguration/extensions/extension"), - K8SRaw: &armazurearcdata.SQLManagedInstanceK8SRaw{ - AdditionalProperties: map[string]interface{}{ - "additionalProperty": float64(1234), - }, - Spec: &armazurearcdata.SQLManagedInstanceK8SSpec{ - Replicas: to.Ptr[int32](1), - Scheduling: &armazurearcdata.K8SScheduling{ - Default: &armazurearcdata.K8SSchedulingOptions{ - Resources: &armazurearcdata.K8SResourceRequirements{ - Limits: map[string]*string{ - "additionalProperty": to.Ptr("additionalValue"), - "cpu": to.Ptr("1"), - "memory": to.Ptr("8Gi"), - }, - Requests: map[string]*string{ - "additionalProperty": to.Ptr("additionalValue"), - "cpu": to.Ptr("1"), - "memory": to.Ptr("8Gi"), - }, - }, - }, - }, - }, - }, - LicenseType: to.Ptr(armazurearcdata.ArcSQLManagedInstanceLicenseTypeLicenseIncluded), - StartTime: to.Ptr("Instance start time"), - }, - SKU: &armazurearcdata.SQLManagedInstanceSKU{ - Name: to.Ptr("vCore"), - Dev: to.Ptr(true), - Tier: to.Ptr(armazurearcdata.SQLManagedInstanceSKUTierGeneralPurpose), - }, - }, - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLManagedInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "testsqlManagedInstance", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateSqlManagedInstance.json -func ExampleSQLManagedInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLManagedInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "testrg", - "testsqlManagedInstance", - armazurearcdata.SQLManagedInstanceUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlserverinstances_client_test.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlserverinstances_client_test.go deleted file mode 100644 index da18924ffc89..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlserverinstances_client_test.go +++ /dev/null @@ -1,192 +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 armazurearcdata_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/azurearcdata/armazurearcdata" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionSqlServerInstance.json -func ExampleSQLServerInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLServerInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupSqlServerInstance.json -func ExampleSQLServerInstancesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLServerInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetSqlServerInstance.json -func ExampleSQLServerInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLServerInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "testrg", - "testsqlServerInstance", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateSqlServerInstance.json -func ExampleSQLServerInstancesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLServerInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "testrg", - "testsqlServerInstance", - armazurearcdata.SQLServerInstance{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - Properties: &armazurearcdata.SQLServerInstanceProperties{ - AzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected), - AzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t }()), - Collation: to.Ptr("collation"), - ContainerResourceID: to.Ptr("Resource id of hosting Arc Machine"), - CurrentVersion: to.Ptr("2012"), - Edition: to.Ptr(armazurearcdata.EditionTypeDeveloper), - HostType: to.Ptr(armazurearcdata.HostTypePhysicalServer), - InstanceName: to.Ptr("name of instance"), - LicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree), - PatchLevel: to.Ptr("patchlevel"), - ProductID: to.Ptr("sql id"), - Status: to.Ptr(armazurearcdata.ConnectionStatusRegistered), - TCPDynamicPorts: to.Ptr("1433"), - TCPStaticPorts: to.Ptr("1433"), - VCore: to.Ptr("4"), - Version: to.Ptr(armazurearcdata.SQLVersionSQLServer2012), - }, - }, - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteSqlServerInstance.json -func ExampleSQLServerInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLServerInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "testrg", - "testsqlServerInstance", - 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/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateSqlServerInstance.json -func ExampleSQLServerInstancesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armazurearcdata.NewSQLServerInstancesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "testrg", - "testsqlServerInstance", - armazurearcdata.SQLServerInstanceUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models_serde.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models_serde.go deleted file mode 100644 index 7fba1eac6ee0..000000000000 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models_serde.go +++ /dev/null @@ -1,791 +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 armazurearcdata - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ActiveDirectoryConnectorDNSDetails. -func (a ActiveDirectoryConnectorDNSDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "domainName", a.DomainName) - populate(objectMap, "nameserverIPAddresses", a.NameserverIPAddresses) - populate(objectMap, "preferK8sDnsForPtrLookups", a.PreferK8SDNSForPtrLookups) - populate(objectMap, "replicas", a.Replicas) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActiveDirectoryConnectorStatus. -func (a ActiveDirectoryConnectorStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "lastUpdateTime", a.LastUpdateTime) - populate(objectMap, "observedGeneration", a.ObservedGeneration) - populate(objectMap, "state", a.State) - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryConnectorStatus. -func (a *ActiveDirectoryConnectorStatus) 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 "lastUpdateTime": - err = unpopulate(val, "LastUpdateTime", &a.LastUpdateTime) - delete(rawMsg, key) - case "observedGeneration": - err = unpopulate(val, "ObservedGeneration", &a.ObservedGeneration) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &a.State) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - a.AdditionalProperties[key] = aux - } - 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 ActiveDirectoryDomainControllers. -func (a ActiveDirectoryDomainControllers) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "primaryDomainController", a.PrimaryDomainController) - populate(objectMap, "secondaryDomainControllers", a.SecondaryDomainControllers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataControllerProperties. -func (d DataControllerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "basicLoginInformation", d.BasicLoginInformation) - populate(objectMap, "clusterId", d.ClusterID) - populate(objectMap, "extensionId", d.ExtensionID) - populate(objectMap, "infrastructure", d.Infrastructure) - populate(objectMap, "k8sRaw", &d.K8SRaw) - populateTimeRFC3339(objectMap, "lastUploadedDate", d.LastUploadedDate) - populate(objectMap, "logAnalyticsWorkspaceConfig", d.LogAnalyticsWorkspaceConfig) - populate(objectMap, "logsDashboardCredential", d.LogsDashboardCredential) - populate(objectMap, "metricsDashboardCredential", d.MetricsDashboardCredential) - populate(objectMap, "onPremiseProperty", d.OnPremiseProperty) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "uploadServicePrincipal", d.UploadServicePrincipal) - populate(objectMap, "uploadWatermark", d.UploadWatermark) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataControllerProperties. -func (d *DataControllerProperties) 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 "basicLoginInformation": - err = unpopulate(val, "BasicLoginInformation", &d.BasicLoginInformation) - delete(rawMsg, key) - case "clusterId": - err = unpopulate(val, "ClusterID", &d.ClusterID) - delete(rawMsg, key) - case "extensionId": - err = unpopulate(val, "ExtensionID", &d.ExtensionID) - delete(rawMsg, key) - case "infrastructure": - err = unpopulate(val, "Infrastructure", &d.Infrastructure) - delete(rawMsg, key) - case "k8sRaw": - err = unpopulate(val, "K8SRaw", &d.K8SRaw) - delete(rawMsg, key) - case "lastUploadedDate": - err = unpopulateTimeRFC3339(val, "LastUploadedDate", &d.LastUploadedDate) - delete(rawMsg, key) - case "logAnalyticsWorkspaceConfig": - err = unpopulate(val, "LogAnalyticsWorkspaceConfig", &d.LogAnalyticsWorkspaceConfig) - delete(rawMsg, key) - case "logsDashboardCredential": - err = unpopulate(val, "LogsDashboardCredential", &d.LogsDashboardCredential) - delete(rawMsg, key) - case "metricsDashboardCredential": - err = unpopulate(val, "MetricsDashboardCredential", &d.MetricsDashboardCredential) - delete(rawMsg, key) - case "onPremiseProperty": - err = unpopulate(val, "OnPremiseProperty", &d.OnPremiseProperty) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "uploadServicePrincipal": - err = unpopulate(val, "UploadServicePrincipal", &d.UploadServicePrincipal) - delete(rawMsg, key) - case "uploadWatermark": - err = unpopulate(val, "UploadWatermark", &d.UploadWatermark) - 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 DataControllerResource. -func (d DataControllerResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extendedLocation", d.ExtendedLocation) - populate(objectMap, "id", d.ID) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataControllerUpdate. -func (d DataControllerUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "tags", d.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type K8SResourceRequirements. -func (k K8SResourceRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "limits", k.Limits) - populate(objectMap, "requests", k.Requests) - if k.AdditionalProperties != nil { - for key, val := range k.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type K8SResourceRequirements. -func (k *K8SResourceRequirements) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "limits": - err = unpopulate(val, "Limits", &k.Limits) - delete(rawMsg, key) - case "requests": - err = unpopulate(val, "Requests", &k.Requests) - delete(rawMsg, key) - default: - if k.AdditionalProperties == nil { - k.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - k.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type K8SScheduling. -func (k K8SScheduling) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "default", k.Default) - if k.AdditionalProperties != nil { - for key, val := range k.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type K8SScheduling. -func (k *K8SScheduling) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "default": - err = unpopulate(val, "Default", &k.Default) - delete(rawMsg, key) - default: - if k.AdditionalProperties == nil { - k.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - k.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type K8SSchedulingOptions. -func (k K8SSchedulingOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "resources", k.Resources) - if k.AdditionalProperties != nil { - for key, val := range k.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type K8SSchedulingOptions. -func (k *K8SSchedulingOptions) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resources": - err = unpopulate(val, "Resources", &k.Resources) - delete(rawMsg, key) - default: - if k.AdditionalProperties == nil { - k.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - k.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PostgresInstance. -func (p PostgresInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extendedLocation", p.ExtendedLocation) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "sku", p.SKU) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PostgresInstanceProperties. -func (p PostgresInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "admin", p.Admin) - populate(objectMap, "basicLoginInformation", p.BasicLoginInformation) - populate(objectMap, "dataControllerId", p.DataControllerID) - populate(objectMap, "k8sRaw", &p.K8SRaw) - populateTimeRFC3339(objectMap, "lastUploadedDate", p.LastUploadedDate) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PostgresInstanceProperties. -func (p *PostgresInstanceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "admin": - err = unpopulate(val, "Admin", &p.Admin) - delete(rawMsg, key) - case "basicLoginInformation": - err = unpopulate(val, "BasicLoginInformation", &p.BasicLoginInformation) - delete(rawMsg, key) - case "dataControllerId": - err = unpopulate(val, "DataControllerID", &p.DataControllerID) - delete(rawMsg, key) - case "k8sRaw": - err = unpopulate(val, "K8SRaw", &p.K8SRaw) - delete(rawMsg, key) - case "lastUploadedDate": - err = unpopulateTimeRFC3339(val, "LastUploadedDate", &p.LastUploadedDate) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PostgresInstanceUpdate. -func (p PostgresInstanceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstance. -func (s SQLManagedInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extendedLocation", s.ExtendedLocation) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLManagedInstanceK8SRaw. -func (s SQLManagedInstanceK8SRaw) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "spec", s.Spec) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SRaw. -func (s *SQLManagedInstanceK8SRaw) 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 "spec": - err = unpopulate(val, "Spec", &s.Spec) - delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } - 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 SQLManagedInstanceK8SSpec. -func (s SQLManagedInstanceK8SSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "replicas", s.Replicas) - populate(objectMap, "scheduling", s.Scheduling) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceK8SSpec. -func (s *SQLManagedInstanceK8SSpec) 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 "replicas": - err = unpopulate(val, "Replicas", &s.Replicas) - delete(rawMsg, key) - case "scheduling": - err = unpopulate(val, "Scheduling", &s.Scheduling) - delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } - 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 SQLManagedInstanceProperties. -func (s SQLManagedInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "activeDirectoryInformation", s.ActiveDirectoryInformation) - populate(objectMap, "admin", s.Admin) - populate(objectMap, "basicLoginInformation", s.BasicLoginInformation) - populate(objectMap, "clusterId", s.ClusterID) - populate(objectMap, "dataControllerId", s.DataControllerID) - populate(objectMap, "endTime", s.EndTime) - populate(objectMap, "extensionId", s.ExtensionID) - populate(objectMap, "k8sRaw", s.K8SRaw) - populateTimeRFC3339(objectMap, "lastUploadedDate", s.LastUploadedDate) - populate(objectMap, "licenseType", s.LicenseType) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "startTime", s.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLManagedInstanceProperties. -func (s *SQLManagedInstanceProperties) 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 "activeDirectoryInformation": - err = unpopulate(val, "ActiveDirectoryInformation", &s.ActiveDirectoryInformation) - delete(rawMsg, key) - case "admin": - err = unpopulate(val, "Admin", &s.Admin) - delete(rawMsg, key) - case "basicLoginInformation": - err = unpopulate(val, "BasicLoginInformation", &s.BasicLoginInformation) - delete(rawMsg, key) - case "clusterId": - err = unpopulate(val, "ClusterID", &s.ClusterID) - delete(rawMsg, key) - case "dataControllerId": - err = unpopulate(val, "DataControllerID", &s.DataControllerID) - delete(rawMsg, key) - case "endTime": - err = unpopulate(val, "EndTime", &s.EndTime) - delete(rawMsg, key) - case "extensionId": - err = unpopulate(val, "ExtensionID", &s.ExtensionID) - delete(rawMsg, key) - case "k8sRaw": - err = unpopulate(val, "K8SRaw", &s.K8SRaw) - delete(rawMsg, key) - case "lastUploadedDate": - err = unpopulateTimeRFC3339(val, "LastUploadedDate", &s.LastUploadedDate) - delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, "LicenseType", &s.LicenseType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "startTime": - err = unpopulate(val, "StartTime", &s.StartTime) - 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 SQLManagedInstanceUpdate. -func (s SQLManagedInstanceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLServerInstance. -func (s SQLServerInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLServerInstanceProperties. -func (s SQLServerInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "azureDefenderStatus", s.AzureDefenderStatus) - populateTimeRFC3339(objectMap, "azureDefenderStatusLastUpdated", s.AzureDefenderStatusLastUpdated) - populate(objectMap, "collation", s.Collation) - populate(objectMap, "containerResourceId", s.ContainerResourceID) - populate(objectMap, "createTime", s.CreateTime) - populate(objectMap, "currentVersion", s.CurrentVersion) - populate(objectMap, "edition", s.Edition) - populate(objectMap, "hostType", s.HostType) - populate(objectMap, "instanceName", s.InstanceName) - populate(objectMap, "licenseType", s.LicenseType) - populate(objectMap, "patchLevel", s.PatchLevel) - populate(objectMap, "productId", s.ProductID) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "status", s.Status) - populate(objectMap, "tcpDynamicPorts", s.TCPDynamicPorts) - populate(objectMap, "tcpStaticPorts", s.TCPStaticPorts) - populate(objectMap, "vCore", s.VCore) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerInstanceProperties. -func (s *SQLServerInstanceProperties) 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 "azureDefenderStatus": - err = unpopulate(val, "AzureDefenderStatus", &s.AzureDefenderStatus) - delete(rawMsg, key) - case "azureDefenderStatusLastUpdated": - err = unpopulateTimeRFC3339(val, "AzureDefenderStatusLastUpdated", &s.AzureDefenderStatusLastUpdated) - delete(rawMsg, key) - case "collation": - err = unpopulate(val, "Collation", &s.Collation) - delete(rawMsg, key) - case "containerResourceId": - err = unpopulate(val, "ContainerResourceID", &s.ContainerResourceID) - delete(rawMsg, key) - case "createTime": - err = unpopulate(val, "CreateTime", &s.CreateTime) - delete(rawMsg, key) - case "currentVersion": - err = unpopulate(val, "CurrentVersion", &s.CurrentVersion) - delete(rawMsg, key) - case "edition": - err = unpopulate(val, "Edition", &s.Edition) - delete(rawMsg, key) - case "hostType": - err = unpopulate(val, "HostType", &s.HostType) - delete(rawMsg, key) - case "instanceName": - err = unpopulate(val, "InstanceName", &s.InstanceName) - delete(rawMsg, key) - case "licenseType": - err = unpopulate(val, "LicenseType", &s.LicenseType) - delete(rawMsg, key) - case "patchLevel": - err = unpopulate(val, "PatchLevel", &s.PatchLevel) - delete(rawMsg, key) - case "productId": - err = unpopulate(val, "ProductID", &s.ProductID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "tcpDynamicPorts": - err = unpopulate(val, "TCPDynamicPorts", &s.TCPDynamicPorts) - delete(rawMsg, key) - case "tcpStaticPorts": - err = unpopulate(val, "TCPStaticPorts", &s.TCPStaticPorts) - delete(rawMsg, key) - case "vCore": - err = unpopulate(val, "VCore", &s.VCore) - 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) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SQLServerInstanceUpdate. -func (s SQLServerInstanceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) 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 "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - 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 TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type UploadWatermark. -func (u UploadWatermark) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "logs", u.Logs) - populateTimeRFC3339(objectMap, "metrics", u.Metrics) - populateTimeRFC3339(objectMap, "usages", u.Usages) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UploadWatermark. -func (u *UploadWatermark) 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 "logs": - err = unpopulateTimeRFC3339(val, "Logs", &u.Logs) - delete(rawMsg, key) - case "metrics": - err = unpopulateTimeRFC3339(val, "Metrics", &u.Metrics) - delete(rawMsg, key) - case "usages": - err = unpopulateTimeRFC3339(val, "Usages", &u.Usages) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}