From 0d319a9155ee57259c0d181a8b6e4bcd82807817 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 20 Oct 2022 17:06:22 +0000 Subject: [PATCH] CodeGen from PR 21176 in Azure/azure-rest-api-specs Merge 34a55e04cc3539eab6560f9b0a9bb6aa5767936c into 492cf91751be945ceae53cfdd53b1ff2fb878703 --- .../azurearcdata/armazurearcdata/CHANGELOG.md | 16 + ...go => activedirectoryconnectors_client.go} | 2 +- .../azurearcdata/armazurearcdata/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 43 +- ...rs_client.go => datacontrollers_client.go} | 3 +- .../azurearcdata/armazurearcdata/go.mod | 14 +- .../azurearcdata/armazurearcdata/go.sum | 24 +- .../{zz_generated_models.go => models.go} | 4 +- .../armazurearcdata/models_serde.go | 2085 +++++++++++++++++ ...rations_client.go => operations_client.go} | 2 +- ..._client.go => postgresinstances_client.go} | 3 +- ...ed_response_types.go => response_types.go} | 1 + ...lient.go => sqlmanagedinstances_client.go} | 3 +- ...client.go => sqlserverinstances_client.go} | 3 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...e_activedirectoryconnectors_client_test.go | 148 -- ...ted_example_datacontrollers_client_test.go | 218 -- ...enerated_example_operations_client_test.go | 41 - ...d_example_postgresinstances_client_test.go | 258 -- ...example_sqlmanagedinstances_client_test.go | 222 -- ..._example_sqlserverinstances_client_test.go | 192 -- .../zz_generated_models_serde.go | 791 ------- 22 files changed, 2154 insertions(+), 1926 deletions(-) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_activedirectoryconnectors_client.go => activedirectoryconnectors_client.go} (99%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_constants.go => constants.go} (82%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_datacontrollers_client.go => datacontrollers_client.go} (99%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_models.go => models.go} (99%) create mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_operations_client.go => operations_client.go} (98%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_postgresinstances_client.go => postgresinstances_client.go} (99%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_response_types.go => response_types.go} (99%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_sqlmanagedinstances_client.go => sqlmanagedinstances_client.go} (99%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_sqlserverinstances_client.go => sqlserverinstances_client.go} (99%) rename sdk/resourcemanager/azurearcdata/armazurearcdata/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_activedirectoryconnectors_client_test.go delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_datacontrollers_client_test.go delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_postgresinstances_client_test.go delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlmanagedinstances_client_test.go delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/ze_generated_example_sqlserverinstances_client_test.go delete mode 100644 sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md index d62a45f1cc1c..592878fa32e0 100644 --- a/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 0.6.0 (2022-10-20) +### Features Added + +- New const `ArcSQLServerLicenseTypePAYG` +- New const `HostTypeGCPKubernetesService` +- New const `HostTypeAzureVirtualMachine` +- New const `ArcSQLServerLicenseTypeLicenseOnly` +- New const `HostTypeAzureKubernetesService` +- New const `HostTypeGCPVMWareVirtualMachine` +- New const `HostTypeContainer` +- New const `ArcSQLServerLicenseTypeServerCAL` +- New const `HostTypeAWSVMWareVirtualMachine` +- New const `HostTypeAzureVMWareVirtualMachine` +- New const `HostTypeAWSKubernetesService` + + ## 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 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_activedirectoryconnectors_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/activedirectoryconnectors_client.go index 3a95e25b50c9..d0b1880b3be1 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 @@ -256,7 +257,6 @@ func (client *ActiveDirectoryConnectorsClient) getHandleResponse(resp *http.Resp } // NewListPager - List the active directory connectors associated with the given data controller. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // resourceGroupName - The name of the Azure resource group // dataControllerName - The name of the data controller 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 82% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_constants.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/constants.go index 3312e57a6b2c..da4d4dc10ce4 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, } } @@ -167,17 +174,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, diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go similarity index 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_datacontrollers_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/datacontrollers_client.go index f0e9d2d5bbb5..701979b98637 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 @@ -175,7 +176,6 @@ func (client *DataControllersClient) getDataControllerHandleResponse(resp *http. } // NewListInGroupPager - List dataController resources in the resource group -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // resourceGroupName - The name of the Azure resource group // options - DataControllersClientListInGroupOptions contains the optional parameters for the DataControllersClient.ListInGroup @@ -240,7 +240,6 @@ func (client *DataControllersClient) listInGroupHandleResponse(resp *http.Respon } // NewListInSubscriptionPager - List dataController resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // options - DataControllersClientListInSubscriptionOptions contains the optional parameters for the DataControllersClient.ListInSubscription // method. 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 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_models.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/models.go index 8a1ef2b936d0..eeed772c985f 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 @@ -711,7 +712,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 diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go new file mode 100644 index 000000000000..67ef2d703060 --- /dev/null +++ b/sdk/resourcemanager/azurearcdata/armazurearcdata/models_serde.go @@ -0,0 +1,2085 @@ +//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 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 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, "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) +} + +// 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 98% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_operations_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/operations_client.go index 215f83c55fde..4e56b5cb653d 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,7 +50,6 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Azure Data Services on Azure Arc API operations. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_postgresinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go similarity index 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_postgresinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/postgresinstances_client.go index 4d246fc35e9b..a610114033de 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 @@ -240,7 +241,6 @@ func (client *PostgresInstancesClient) getHandleResponse(resp *http.Response) (P } // NewListPager - List postgres Instance resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // options - PostgresInstancesClientListOptions contains the optional parameters for the PostgresInstancesClient.List method. func (client *PostgresInstancesClient) NewListPager(options *PostgresInstancesClientListOptions) *runtime.Pager[PostgresInstancesClientListResponse] { @@ -299,7 +299,6 @@ func (client *PostgresInstancesClient) listHandleResponse(resp *http.Response) ( } // NewListByResourceGroupPager - Get a postgres Instances list by Resource group name. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // resourceGroupName - The name of the Azure resource group // options - PostgresInstancesClientListByResourceGroupOptions contains the optional parameters for the PostgresInstancesClient.ListByResourceGroup diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go similarity index 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_response_types.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/response_types.go index af0c54e4b084..bd882d1cc1d0 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 diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go similarity index 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlmanagedinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/sqlmanagedinstances_client.go index dc02bca4675b..f7fcf80e63a6 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 @@ -240,7 +241,6 @@ func (client *SQLManagedInstancesClient) getHandleResponse(resp *http.Response) } // NewListPager - List sqlManagedInstance resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // options - SQLManagedInstancesClientListOptions contains the optional parameters for the SQLManagedInstancesClient.List // method. @@ -300,7 +300,6 @@ func (client *SQLManagedInstancesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all sqlManagedInstances in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // resourceGroupName - The name of the Azure resource group // options - SQLManagedInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLManagedInstancesClient.ListByResourceGroup diff --git a/sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlserverinstances_client.go b/sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go similarity index 99% rename from sdk/resourcemanager/azurearcdata/armazurearcdata/zz_generated_sqlserverinstances_client.go rename to sdk/resourcemanager/azurearcdata/armazurearcdata/sqlserverinstances_client.go index 4947972c62cc..f1958df0c4a1 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 @@ -240,7 +241,6 @@ func (client *SQLServerInstancesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - List sqlServerInstance resources in the subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // options - SQLServerInstancesClientListOptions contains the optional parameters for the SQLServerInstancesClient.List method. func (client *SQLServerInstancesClient) NewListPager(options *SQLServerInstancesClientListOptions) *runtime.Pager[SQLServerInstancesClientListResponse] { @@ -299,7 +299,6 @@ func (client *SQLServerInstancesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all sqlServerInstances in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-03-01-preview // resourceGroupName - The name of the Azure resource group // options - SQLServerInstancesClientListByResourceGroupOptions contains the optional parameters for the SQLServerInstancesClient.ListByResourceGroup 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 -}