diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md index d62a45f1cc1c..a2422c5953be 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md @@ -1,5 +1,29 @@ # Release History +## 0.6.0 (2022-12-12) +### Features Added + +- New value `ArcSQLServerLicenseTypeLicenseOnly`, `ArcSQLServerLicenseTypePAYG`, `ArcSQLServerLicenseTypeServerCAL` added to type alias `ArcSQLServerLicenseType` +- 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 `RecoveryMode` with values `RecoveryModeBulkLogged`, `RecoveryModeFull`, `RecoveryModeSimple` +- 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 `ArcSQLServerDatabaseListResult` +- New struct `SQLServerDatabaseResource` +- New struct `SQLServerDatabaseResourceProperties` +- New struct `SQLServerDatabaseResourcePropertiesBackupInformation` +- New struct `SQLServerDatabaseResourcePropertiesDatabaseOptions` +- New struct `SQLServerDatabaseUpdate` +- New struct `SQLServerDatabasesClient` +- New struct `SQLServerDatabasesClientListResponse` +- 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 96% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_activedirectoryconnectors_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go index 3a95e25b50c9..12fb3cac21af 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 @@ -56,7 +57,7 @@ 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 +// Generated from API version 2022-06-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 @@ -79,7 +80,7 @@ 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 2022-06-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 +120,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, activeDirectoryConnectorResource) @@ -127,7 +128,7 @@ 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 +// Generated from API version 2022-06-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 @@ -147,7 +148,7 @@ 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 2022-06-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 +188,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +196,7 @@ 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 +// Generated from API version 2022-06-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 @@ -240,7 +241,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,8 +257,7 @@ 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 +// Generated from API version 2022-06-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.List @@ -310,7 +310,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", "2022-06-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 71% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_constants.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go index 3312e57a6b2c..12a516722f7e 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 @@ -167,17 +204,33 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { 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, @@ -225,6 +278,24 @@ func PossibleOperationOriginValues() []OperationOrigin { } } +// 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 diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go similarity index 96% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go index f0e9d2d5bbb5..8a24c3ae65e3 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 @@ -56,7 +57,7 @@ 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 +// Generated from API version 2022-06-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 @@ -75,7 +76,7 @@ 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 2022-06-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 +112,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +120,7 @@ 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 +// Generated from API version 2022-06-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 @@ -159,7 +160,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,8 +176,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // options - DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.ListInGroup // method. @@ -224,7 +224,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +240,7 @@ 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 +// Generated from API version 2022-06-15-preview // options - DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.ListInSubscription // method. func (client *DataControllersClient) NewListInSubscriptionPager(options *DataControllersClientListInSubscriptionOptions) *runtime.Pager[DataControllersClientListInSubscriptionResponse] { @@ -284,7 +283,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,7 +300,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // dataControllerName - The name of the data controller // dataControllerResource - The update data controller resource @@ -323,7 +322,7 @@ 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 2022-06-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 +358,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataControllerResource) @@ -367,7 +366,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // dataControllerName - The name of the data controller // dataControllerResource - desc @@ -389,7 +388,7 @@ 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 2022-06-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 +424,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", "2022-06-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/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 88% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/models.go index 8a1ef2b936d0..b854e68712e0 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models.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,12 +28,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"` @@ -157,6 +158,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. @@ -711,7 +721,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 @@ -771,6 +782,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.List 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 +945,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"` diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go new file mode 100644 index 000000000000..4128a3c11153 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go @@ -0,0 +1,2355 @@ +//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 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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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]interface{}) + 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]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 ActiveDirectoryDomainController. +func (a ActiveDirectoryDomainController) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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 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 KeytabInformation. +func (k KeytabInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]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 PostgresInstanceSKU. +func (p PostgresInstanceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// 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]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// 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]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) +} + +// 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]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 SQLManagedInstanceListResult. +func (s SQLManagedInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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]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 SQLManagedInstanceSKU. +func (s SQLManagedInstanceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]interface{}) + 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]interface{}) + 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]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) +} + +// 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]interface{}) + 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]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 +} diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_operations_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go similarity index 95% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_operations_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go index 215f83c55fde..766cbd86da48 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 @@ -49,8 +50,7 @@ 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 +// Generated from API version 2022-06-15-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01-preview") + reqQP.Set("api-version", "2022-06-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 96% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_postgresinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go index 4d246fc35e9b..3bc37e7e8c54 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 @@ -56,7 +57,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // postgresInstanceName - Name of Postgres Instance // resource - The postgres instance @@ -78,7 +79,7 @@ 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 2022-06-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 +115,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, resource) @@ -122,7 +123,7 @@ 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 +// Generated from API version 2022-06-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 @@ -141,7 +142,7 @@ 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 2022-06-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 +178,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +186,7 @@ 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 +// Generated from API version 2022-06-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. @@ -224,7 +225,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +241,7 @@ 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 +// Generated from API version 2022-06-15-preview // options - PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.List method. func (client *PostgresInstancesClient) NewListPager(options *PostgresInstancesClientListOptions) *runtime.Pager[PostgresInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PostgresInstancesClientListResponse]{ @@ -283,7 +283,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,8 +299,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // options - PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.ListByResourceGroup // method. @@ -348,7 +347,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,7 +364,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // postgresInstanceName - Name of Postgres Instance // parameters - The Postgres Instance. @@ -406,7 +405,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", "2022-06-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 86% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go index af0c54e4b084..de83c7e73dca 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.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 @@ -123,6 +124,31 @@ type SQLManagedInstancesClientUpdateResponse struct { SQLManagedInstance } +// 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.List. +type SQLServerDatabasesClientListResponse struct { + ArcSQLServerDatabaseListResult +} + +// SQLServerDatabasesClientUpdateResponse contains the response from method SQLServerDatabasesClient.Update. +type SQLServerDatabasesClientUpdateResponse struct { + SQLServerDatabaseResource +} + // SQLServerInstancesClientCreateResponse contains the response from method SQLServerInstancesClient.Create. type SQLServerInstancesClientCreateResponse struct { SQLServerInstance diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go similarity index 96% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go index dc02bca4675b..e68ab796485a 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 @@ -56,7 +57,7 @@ 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 +// Generated from API version 2022-06-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. @@ -78,7 +79,7 @@ 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 2022-06-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 +115,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sqlManagedInstance) @@ -122,7 +123,7 @@ 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 +// Generated from API version 2022-06-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 @@ -141,7 +142,7 @@ 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 2022-06-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 +178,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +186,7 @@ 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 +// Generated from API version 2022-06-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. @@ -224,7 +225,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +241,7 @@ 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 +// Generated from API version 2022-06-15-preview // options - SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.List // method. func (client *SQLManagedInstancesClient) NewListPager(options *SQLManagedInstancesClientListOptions) *runtime.Pager[SQLManagedInstancesClientListResponse] { @@ -284,7 +284,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,8 +300,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // options - SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.ListByResourceGroup // method. @@ -349,7 +348,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +365,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // sqlManagedInstanceName - Name of SQL Managed Instance // parameters - The SQL Managed Instance. @@ -407,7 +406,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", "2022-06-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..dac5effb3d34 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverdatabases_client.go @@ -0,0 +1,364 @@ +//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 2022-06-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", "2022-06-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 2022-06-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", "2022-06-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 2022-06-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", "2022-06-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 2022-06-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.List 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", "2022-06-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 2022-06-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", "2022-06-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 96% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlserverinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go index 4947972c62cc..90b5b1b0f008 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 @@ -56,7 +57,7 @@ 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 +// Generated from API version 2022-06-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. @@ -78,7 +79,7 @@ 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 2022-06-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 +115,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sqlServerInstance) @@ -122,7 +123,7 @@ 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 +// Generated from API version 2022-06-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 @@ -141,7 +142,7 @@ 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 2022-06-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 +178,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,7 +186,7 @@ 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 +// Generated from API version 2022-06-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. @@ -224,7 +225,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +241,7 @@ 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 +// Generated from API version 2022-06-15-preview // options - SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.List method. func (client *SQLServerInstancesClient) NewListPager(options *SQLServerInstancesClientListOptions) *runtime.Pager[SQLServerInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SQLServerInstancesClientListResponse]{ @@ -283,7 +283,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,8 +299,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // options - SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.ListByResourceGroup // method. @@ -348,7 +347,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", "2022-06-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,7 +364,7 @@ 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 +// Generated from API version 2022-06-15-preview // resourceGroupName - The name of the Azure resource group // sqlServerInstanceName - Name of SQL Server Instance // parameters - The SQL Server Instance. @@ -406,7 +405,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", "2022-06-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 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/time_rfc3339.go index 2b9ef2fbbd2c..0255d9a00213 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 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 -}