From dacf8573ed48911b347d3db3770edff920c5e8d5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 28 Jul 2022 05:11:29 +0000 Subject: [PATCH] CodeGen from PR 18743 in Azure/azure-rest-api-specs Merge 845c26ba3af5e6f2e4f3bbfffee623c1682e604c into 7b68a8cd8cb3f2328d4830fbbac41d8ad5febb67 --- .../iothub/armiothub/CHANGELOG.md | 16 + .../iothub/armiothub/autorest.md | 6 +- ...cates_client.go => certificates_client.go} | 25 +- .../{zz_generated_client.go => client.go} | 7 +- ...zz_generated_constants.go => constants.go} | 9 +- sdk/resourcemanager/iothub/armiothub/go.mod | 14 +- sdk/resourcemanager/iothub/armiothub/go.sum | 24 +- .../{zz_generated_models.go => models.go} | 97 +- .../iothub/armiothub/models_serde.go | 3386 +++++++++++++++++ ...rations_client.go => operations_client.go} | 5 +- ...o => privateendpointconnections_client.go} | 21 +- ...ient.go => privatelinkresources_client.go} | 9 +- ..._resource_client.go => resource_client.go} | 105 +- ...nt.go => resourceprovidercommon_client.go} | 5 +- ...ed_response_types.go => response_types.go} | 1 + ...erated_time_rfc1123.go => time_rfc1123.go} | 1 + ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...erated_example_certificates_client_test.go | 164 - ...ze_generated_example_iothub_client_test.go | 45 - ...ated_example_iothubresource_client_test.go | 672 ---- ...enerated_example_operations_client_test.go | 41 - ..._privateendpointconnections_client_test.go | 125 - ...xample_privatelinkresources_client_test.go | 62 - ...mple_resourceprovidercommon_client_test.go | 37 - .../armiothub/zz_generated_models_serde.go | 405 -- 25 files changed, 3607 insertions(+), 1676 deletions(-) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_certificates_client.go => certificates_client.go} (97%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_client.go => client.go} (96%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_constants.go => constants.go} (98%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_models.go => models.go} (93%) create mode 100644 sdk/resourcemanager/iothub/armiothub/models_serde.go rename sdk/resourcemanager/iothub/armiothub/{zz_generated_operations_client.go => operations_client.go} (97%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (96%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (97%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_resource_client.go => resource_client.go} (96%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_resourceprovidercommon_client.go => resourceprovidercommon_client.go} (97%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_response_types.go => response_types.go} (99%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_time_rfc1123.go => time_rfc1123.go} (99%) rename sdk/resourcemanager/iothub/armiothub/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_certificates_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothub_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothubresource_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/ze_generated_example_resourceprovidercommon_client_test.go delete mode 100644 sdk/resourcemanager/iothub/armiothub/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md b/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md index 8335606ba654..c20ee84d736b 100644 --- a/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md +++ b/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.1.0-beta.1 (2022-07-28) +### Features Added + +- New const `RoutingSourceDigitalTwinChangeEvents` +- New const `RoutingSourceMqttBrokerMessages` +- New struct `EncryptionPropertiesDescription` +- New struct `KeyVaultKeyProperties` +- New struct `PropertiesDeviceStreams` +- New struct `RootCertificateProperties` +- New struct `RoutingCosmosDBSQLAPIProperties` +- New field `CosmosDBSQLCollections` in struct `RoutingEndpoints` +- New field `RootCertificate` in struct `Properties` +- New field `DeviceStreams` in struct `Properties` +- New field `Encryption` in struct `Properties` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/iothub/armiothub/autorest.md b/sdk/resourcemanager/iothub/armiothub/autorest.md index 0e53c30652db..06b564866fe7 100644 --- a/sdk/resourcemanager/iothub/armiothub/autorest.md +++ b/sdk/resourcemanager/iothub/armiothub/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/iothub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/iothub/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/iothub/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/iothub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.1.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go b/sdk/resourcemanager/iothub/armiothub/certificates_client.go similarity index 97% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go rename to sdk/resourcemanager/iothub/armiothub/certificates_client.go index 40e7ee3dcce1..80ba9eb940c5 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go +++ b/sdk/resourcemanager/iothub/armiothub/certificates_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 armiothub @@ -56,7 +57,7 @@ func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Adds new or replaces existing certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // certificateName - The name of the certificate @@ -102,7 +103,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -122,7 +123,7 @@ func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Deletes an existing X509 certificate or does nothing if it does not exist. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // certificateName - The name of the certificate @@ -167,7 +168,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -177,7 +178,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou // GenerateVerificationCode - Generates verification code for proof of possession flow. The verification code will be used // to generate a leaf certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // certificateName - The name of the certificate @@ -223,7 +224,7 @@ func (client *CertificatesClient) generateVerificationCodeCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -241,7 +242,7 @@ func (client *CertificatesClient) generateVerificationCodeHandleResponse(resp *h // Get - Returns the certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // certificateName - The name of the certificate @@ -285,7 +286,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,7 +303,7 @@ func (client *CertificatesClient) getHandleResponse(resp *http.Response) (Certif // ListByIotHub - Returns the list of certificates. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - CertificatesClientListByIotHubOptions contains the optional parameters for the CertificatesClient.ListByIotHub @@ -342,7 +343,7 @@ func (client *CertificatesClient) listByIotHubCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,7 +361,7 @@ func (client *CertificatesClient) listByIotHubHandleResponse(resp *http.Response // Verify - Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded // certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // certificateName - The name of the certificate @@ -406,7 +407,7 @@ func (client *CertificatesClient) verifyCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_client.go b/sdk/resourcemanager/iothub/armiothub/client.go similarity index 96% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_client.go rename to sdk/resourcemanager/iothub/armiothub/client.go index 238139cf1542..044727f41fe3 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_client.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -56,7 +57,7 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // BeginManualFailover - Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // iotHubName - Name of the IoT hub to failover // resourceGroupName - Name of the resource group containing the IoT hub resource // failoverInput - Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the @@ -76,7 +77,7 @@ func (client *Client) BeginManualFailover(ctx context.Context, iotHubName string // ManualFailover - Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview func (client *Client) manualFailover(ctx context.Context, iotHubName string, resourceGroupName string, failoverInput FailoverInput, options *ClientBeginManualFailoverOptions) (*http.Response, error) { req, err := client.manualFailoverCreateRequest(ctx, iotHubName, resourceGroupName, failoverInput, options) if err != nil { @@ -112,7 +113,7 @@ func (client *Client) manualFailoverCreateRequest(ctx context.Context, iotHubNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, failoverInput) diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go b/sdk/resourcemanager/iothub/armiothub/constants.go similarity index 98% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go rename to sdk/resourcemanager/iothub/armiothub/constants.go index 167ce18c6e4a..8d4162e80c99 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub const ( moduleName = "armiothub" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0-beta.1" ) // AccessRights - The permissions assigned to the shared access policy. @@ -370,7 +371,7 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } -// ResourceIdentityType - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both +// ResourceIdentityType - The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both // an implicitly created identity and a set of user assigned identities. The type 'None' will remove any // identities from the service. type ResourceIdentityType string @@ -416,7 +417,9 @@ const ( RoutingSourceDeviceJobLifecycleEvents RoutingSource = "DeviceJobLifecycleEvents" RoutingSourceDeviceLifecycleEvents RoutingSource = "DeviceLifecycleEvents" RoutingSourceDeviceMessages RoutingSource = "DeviceMessages" + RoutingSourceDigitalTwinChangeEvents RoutingSource = "DigitalTwinChangeEvents" RoutingSourceInvalid RoutingSource = "Invalid" + RoutingSourceMqttBrokerMessages RoutingSource = "MqttBrokerMessages" RoutingSourceTwinChangeEvents RoutingSource = "TwinChangeEvents" ) @@ -427,7 +430,9 @@ func PossibleRoutingSourceValues() []RoutingSource { RoutingSourceDeviceJobLifecycleEvents, RoutingSourceDeviceLifecycleEvents, RoutingSourceDeviceMessages, + RoutingSourceDigitalTwinChangeEvents, RoutingSourceInvalid, + RoutingSourceMqttBrokerMessages, RoutingSourceTwinChangeEvents, } } diff --git a/sdk/resourcemanager/iothub/armiothub/go.mod b/sdk/resourcemanager/iothub/armiothub/go.mod index ee84a1dd5906..34d87bae6316 100644 --- a/sdk/resourcemanager/iothub/armiothub/go.mod +++ b/sdk/resourcemanager/iothub/armiothub/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub 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/iothub/armiothub/go.sum b/sdk/resourcemanager/iothub/armiothub/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/iothub/armiothub/go.sum +++ b/sdk/resourcemanager/iothub/armiothub/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/iothub/armiothub/zz_generated_models.go b/sdk/resourcemanager/iothub/armiothub/models.go similarity index 93% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_models.go rename to sdk/resourcemanager/iothub/armiothub/models.go index 1cd1a74c2563..4c250a55fe9a 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_models.go +++ b/sdk/resourcemanager/iothub/armiothub/models.go @@ -5,13 +5,14 @@ // 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 armiothub import "time" type ArmIdentity struct { - // The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created + // The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created // identity and a set of user assigned identities. The type 'None' will remove any // identities from the service. Type *ResourceIdentityType `json:"type,omitempty"` @@ -251,6 +252,15 @@ type DescriptionListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } +// EncryptionPropertiesDescription - The encryption properties for the IoT hub. +type EncryptionPropertiesDescription struct { + // The source of the key. + KeySource *string `json:"keySource,omitempty"` + + // The properties of the KeyVault key. + KeyVaultProperties []*KeyVaultKeyProperties `json:"keyVaultProperties,omitempty"` +} + // EndpointHealthData - The health data for an endpoint type EndpointHealthData struct { // Id of the endpoint @@ -498,7 +508,7 @@ type ImportDevicesRequest struct { // The value indicating whether configurations should be imported. IncludeConfigurations *bool `json:"includeConfigurations,omitempty"` - // The blob name to be used when importing from the provided input blob container. + // from the provided input blob container. InputBlobName *string `json:"inputBlobName,omitempty"` // The blob name to use for storing the status of the import job. @@ -541,6 +551,15 @@ type JobResponseListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } +// KeyVaultKeyProperties - The properties of the KeyVault key. +type KeyVaultKeyProperties struct { + // Managed identity properties of KeyVault Key. + Identity *ManagedIdentity `json:"identity,omitempty"` + + // The identifier of the key. + KeyIdentifier *string `json:"keyIdentifier,omitempty"` +} + // LocationDescription - Public representation of one of the locations where a resource is provisioned. type LocationDescription struct { // The name of the Azure region @@ -764,6 +783,9 @@ type Properties struct { // IoT hub comments. Comments *string `json:"comments,omitempty"` + // The device streams properties of iothub. + DeviceStreams *PropertiesDeviceStreams `json:"deviceStreams,omitempty"` + // If true, all device(including Edge devices but excluding modules) scoped SAS keys cannot be used for authentication. DisableDeviceSAS *bool `json:"disableDeviceSAS,omitempty"` @@ -779,6 +801,9 @@ type Properties struct { // If True, file upload notifications are enabled. EnableFileUploadNotifications *bool `json:"enableFileUploadNotifications,omitempty"` + // The encryption properties for the IoT hub. + Encryption *EncryptionPropertiesDescription `json:"encryption,omitempty"` + // The Event Hub-compatible endpoint properties. The only possible keys to this dictionary is events. This key has to be present // in the dictionary while making create or update calls for the IoT hub. EventHubEndpoints map[string]*EventHubProperties `json:"eventHubEndpoints,omitempty"` @@ -808,6 +833,9 @@ type Properties struct { // If true, egress from IotHub will be restricted to only the allowed FQDNs that are configured via allowedFqdnList. RestrictOutboundNetworkAccess *bool `json:"restrictOutboundNetworkAccess,omitempty"` + // This property store root certificate related information + RootCertificate *RootCertificateProperties `json:"rootCertificate,omitempty"` + // The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging Routing *RoutingProperties `json:"routing,omitempty"` @@ -830,6 +858,12 @@ type Properties struct { State *string `json:"state,omitempty" azure:"ro"` } +// PropertiesDeviceStreams - The device streams properties of iothub. +type PropertiesDeviceStreams struct { + // List of Device Streams Endpoints. + StreamingEndpoints []*string `json:"streamingEndpoints,omitempty"` +} + // QuotaMetricInfo - Quota metrics properties. type QuotaMetricInfo struct { // READ-ONLY; The current value for the quota metric. @@ -1012,6 +1046,15 @@ type ResourceProviderCommonClientGetSubscriptionQuotaOptions struct { // placeholder for future optional parameters } +// RootCertificateProperties - This property store root certificate related information +type RootCertificateProperties struct { + // This property when set to true, hub will use G2 cert; while it's set to false, hub uses Baltimore Cert. + EnableRootCertificateV2 *bool `json:"enableRootCertificateV2,omitempty"` + + // READ-ONLY; the last update time to root certificate flag. + LastUpdatedTimeUTC *time.Time `json:"lastUpdatedTimeUtc,omitempty" azure:"ro"` +} + // RouteCompilationError - Compilation error when evaluating route type RouteCompilationError struct { // Location where the route error happened @@ -1064,10 +1107,60 @@ type RouteProperties struct { Condition *string `json:"condition,omitempty"` } +// RoutingCosmosDBSQLAPIProperties - The properties related to a cosmos DB sql collection endpoint. +type RoutingCosmosDBSQLAPIProperties struct { + // REQUIRED; The name of the cosmos DB sql collection in the cosmos DB database. + CollectionName *string `json:"collectionName,omitempty"` + + // REQUIRED; The name of the cosmos DB database in the cosmos DB account. + DatabaseName *string `json:"databaseName,omitempty"` + + // REQUIRED; The url of the cosmos DB account. It must include the protocol https:// + EndpointURI *string `json:"endpointUri,omitempty"` + + // REQUIRED; The name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, + // hyphens and has a maximum length of 64 characters. The following names are reserved: + // events, fileNotifications, $default. Endpoint names must be unique across endpoint types. + Name *string `json:"name,omitempty"` + + // Method used to authenticate against the cosmos DB sql collection endpoint + AuthenticationType *AuthenticationType `json:"authenticationType,omitempty"` + + // Id of the cosmos DB sql collection endpoint + ID *string `json:"id,omitempty"` + + // Managed identity properties of routing cosmos DB collection endpoint. + Identity *ManagedIdentity `json:"identity,omitempty"` + + // The name of the partition key associated with this cosmos DB sql collection if one exists. This is an optional parameter. + PartitionKeyName *string `json:"partitionKeyName,omitempty"` + + // The template for generating a synthetic partition key value for use with this cosmos DB sql collection. The template must + // include at least one of the following placeholders: {iothub}, {deviceid}, + // {DD}, {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and non-placeholder components are + // arbitrary. This parameter is only required if PartitionKeyName is specified. + PartitionKeyTemplate *string `json:"partitionKeyTemplate,omitempty"` + + // The primary key of the cosmos DB account. + PrimaryKey *string `json:"primaryKey,omitempty"` + + // The name of the resource group of the cosmos DB account. + ResourceGroup *string `json:"resourceGroup,omitempty"` + + // The secondary key of the cosmos DB account. + SecondaryKey *string `json:"secondaryKey,omitempty"` + + // The subscription identifier of the cosmos DB account. + SubscriptionID *string `json:"subscriptionId,omitempty"` +} + // RoutingEndpoints - The properties related to the custom endpoints to which your IoT hub routes messages based on the routing // rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs // and only 1 custom endpoint is allowed across all endpoint types for free hubs. type RoutingEndpoints struct { + // The list of Cosmos DB collection endpoints that IoT hub routes messages to, based on the routing rules. + CosmosDBSQLCollections []*RoutingCosmosDBSQLAPIProperties `json:"cosmosDBSqlCollections,omitempty"` + // The list of Event Hubs endpoints that IoT hub routes messages to, based on the routing rules. This list does not include // the built-in Event Hubs endpoint. EventHubs []*RoutingEventHubProperties `json:"eventHubs,omitempty"` diff --git a/sdk/resourcemanager/iothub/armiothub/models_serde.go b/sdk/resourcemanager/iothub/armiothub/models_serde.go new file mode 100644 index 000000000000..7eec19a8c82d --- /dev/null +++ b/sdk/resourcemanager/iothub/armiothub/models_serde.go @@ -0,0 +1,3386 @@ +//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 armiothub + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ArmIdentity. +func (a ArmIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "type", a.Type) + populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmIdentity. +func (a *ArmIdentity) 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 "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &a.UserAssignedIdentities) + 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 ArmUserIdentity. +func (a ArmUserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "principalId", a.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmUserIdentity. +func (a *ArmUserIdentity) 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 "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + 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 Capacity. +func (c Capacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "default", c.Default) + populate(objectMap, "maximum", c.Maximum) + populate(objectMap, "minimum", c.Minimum) + populate(objectMap, "scaleType", c.ScaleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Capacity. +func (c *Capacity) 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 "default": + err = unpopulate(val, "Default", &c.Default) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &c.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &c.Minimum) + delete(rawMsg, key) + case "scaleType": + err = unpopulate(val, "ScaleType", &c.ScaleType) + 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 CertificateBodyDescription. +func (c CertificateBodyDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificate", c.Certificate) + populate(objectMap, "isVerified", c.IsVerified) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateBodyDescription. +func (c *CertificateBodyDescription) 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 "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "isVerified": + err = unpopulate(val, "IsVerified", &c.IsVerified) + 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 CertificateDescription. +func (c CertificateDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateDescription. +func (c *CertificateDescription) 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 "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateListDescription. +func (c CertificateListDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateListDescription. +func (c *CertificateListDescription) 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 "value": + err = unpopulate(val, "Value", &c.Value) + 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 CertificateProperties. +func (c CertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificate", c.Certificate) + populateTimeRFC1123(objectMap, "created", c.Created) + populateTimeRFC1123(objectMap, "expiry", c.Expiry) + populate(objectMap, "isVerified", c.IsVerified) + populate(objectMap, "subject", c.Subject) + populate(objectMap, "thumbprint", c.Thumbprint) + populateTimeRFC1123(objectMap, "updated", c.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. +func (c *CertificateProperties) 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 "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC1123(val, "Created", &c.Created) + delete(rawMsg, key) + case "expiry": + err = unpopulateTimeRFC1123(val, "Expiry", &c.Expiry) + delete(rawMsg, key) + case "isVerified": + err = unpopulate(val, "IsVerified", &c.IsVerified) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC1123(val, "Updated", &c.Updated) + 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 CertificatePropertiesWithNonce. +func (c CertificatePropertiesWithNonce) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificate", c.Certificate) + populateTimeRFC1123(objectMap, "created", c.Created) + populateTimeRFC1123(objectMap, "expiry", c.Expiry) + populate(objectMap, "isVerified", c.IsVerified) + populate(objectMap, "subject", c.Subject) + populate(objectMap, "thumbprint", c.Thumbprint) + populateTimeRFC1123(objectMap, "updated", c.Updated) + populate(objectMap, "verificationCode", c.VerificationCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificatePropertiesWithNonce. +func (c *CertificatePropertiesWithNonce) 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 "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC1123(val, "Created", &c.Created) + delete(rawMsg, key) + case "expiry": + err = unpopulateTimeRFC1123(val, "Expiry", &c.Expiry) + delete(rawMsg, key) + case "isVerified": + err = unpopulate(val, "IsVerified", &c.IsVerified) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, "Thumbprint", &c.Thumbprint) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC1123(val, "Updated", &c.Updated) + delete(rawMsg, key) + case "verificationCode": + err = unpopulate(val, "VerificationCode", &c.VerificationCode) + 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 CertificateVerificationDescription. +func (c CertificateVerificationDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "certificate", c.Certificate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateVerificationDescription. +func (c *CertificateVerificationDescription) 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 "certificate": + err = unpopulate(val, "Certificate", &c.Certificate) + 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 CertificateWithNonceDescription. +func (c CertificateWithNonceDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateWithNonceDescription. +func (c *CertificateWithNonceDescription) 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 "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudToDeviceProperties. +func (c CloudToDeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultTtlAsIso8601", c.DefaultTTLAsIso8601) + populate(objectMap, "feedback", c.Feedback) + populate(objectMap, "maxDeliveryCount", c.MaxDeliveryCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudToDeviceProperties. +func (c *CloudToDeviceProperties) 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 "defaultTtlAsIso8601": + err = unpopulate(val, "DefaultTTLAsIso8601", &c.DefaultTTLAsIso8601) + delete(rawMsg, key) + case "feedback": + err = unpopulate(val, "Feedback", &c.Feedback) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &c.MaxDeliveryCount) + 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 Description. +func (d Description) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) + 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 Description. +func (d *Description) 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 "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + 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 "sku": + err = unpopulate(val, "SKU", &d.SKU) + 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 DescriptionListResult. +func (d DescriptionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DescriptionListResult. +func (d *DescriptionListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 EncryptionPropertiesDescription. +func (e EncryptionPropertiesDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keySource", e.KeySource) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionPropertiesDescription. +func (e *EncryptionPropertiesDescription) 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 "keySource": + err = unpopulate(val, "KeySource", &e.KeySource) + delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + 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 EndpointHealthData. +func (e EndpointHealthData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpointId", e.EndpointID) + populate(objectMap, "healthStatus", e.HealthStatus) + populate(objectMap, "lastKnownError", e.LastKnownError) + populateTimeRFC1123(objectMap, "lastKnownErrorTime", e.LastKnownErrorTime) + populateTimeRFC1123(objectMap, "lastSendAttemptTime", e.LastSendAttemptTime) + populateTimeRFC1123(objectMap, "lastSuccessfulSendAttemptTime", e.LastSuccessfulSendAttemptTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointHealthData. +func (e *EndpointHealthData) 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 "endpointId": + err = unpopulate(val, "EndpointID", &e.EndpointID) + delete(rawMsg, key) + case "healthStatus": + err = unpopulate(val, "HealthStatus", &e.HealthStatus) + delete(rawMsg, key) + case "lastKnownError": + err = unpopulate(val, "LastKnownError", &e.LastKnownError) + delete(rawMsg, key) + case "lastKnownErrorTime": + err = unpopulateTimeRFC1123(val, "LastKnownErrorTime", &e.LastKnownErrorTime) + delete(rawMsg, key) + case "lastSendAttemptTime": + err = unpopulateTimeRFC1123(val, "LastSendAttemptTime", &e.LastSendAttemptTime) + delete(rawMsg, key) + case "lastSuccessfulSendAttemptTime": + err = unpopulateTimeRFC1123(val, "LastSuccessfulSendAttemptTime", &e.LastSuccessfulSendAttemptTime) + 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 EndpointHealthDataListResult. +func (e EndpointHealthDataListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointHealthDataListResult. +func (e *EndpointHealthDataListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + 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 EnrichmentProperties. +func (e EnrichmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpointNames", e.EndpointNames) + populate(objectMap, "key", e.Key) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentProperties. +func (e *EnrichmentProperties) 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 "endpointNames": + err = unpopulate(val, "EndpointNames", &e.EndpointNames) + delete(rawMsg, key) + case "key": + err = unpopulate(val, "Key", &e.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + 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 ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "httpStatusCode", e.HTTPStatusCode) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) 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 "httpStatusCode": + err = unpopulate(val, "HTTPStatusCode", &e.HTTPStatusCode) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + 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 EventHubConsumerGroupBodyDescription. +func (e EventHubConsumerGroupBodyDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupBodyDescription. +func (e *EventHubConsumerGroupBodyDescription) 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 "properties": + err = unpopulate(val, "Properties", &e.Properties) + 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 EventHubConsumerGroupInfo. +func (e EventHubConsumerGroupInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupInfo. +func (e *EventHubConsumerGroupInfo) 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 "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + 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 EventHubConsumerGroupName. +func (e EventHubConsumerGroupName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupName. +func (e *EventHubConsumerGroupName) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConsumerGroupsListResult. +func (e EventHubConsumerGroupsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConsumerGroupsListResult. +func (e *EventHubConsumerGroupsListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + 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 EventHubProperties. +func (e EventHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", e.Endpoint) + populate(objectMap, "partitionCount", e.PartitionCount) + populate(objectMap, "partitionIds", e.PartitionIDs) + populate(objectMap, "path", e.Path) + populate(objectMap, "retentionTimeInDays", e.RetentionTimeInDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubProperties. +func (e *EventHubProperties) 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 "endpoint": + err = unpopulate(val, "Endpoint", &e.Endpoint) + delete(rawMsg, key) + case "partitionCount": + err = unpopulate(val, "PartitionCount", &e.PartitionCount) + delete(rawMsg, key) + case "partitionIds": + err = unpopulate(val, "PartitionIDs", &e.PartitionIDs) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &e.Path) + delete(rawMsg, key) + case "retentionTimeInDays": + err = unpopulate(val, "RetentionTimeInDays", &e.RetentionTimeInDays) + 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 ExportDevicesRequest. +func (e ExportDevicesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", e.AuthenticationType) + populate(objectMap, "configurationsBlobName", e.ConfigurationsBlobName) + populate(objectMap, "excludeKeys", e.ExcludeKeys) + populate(objectMap, "exportBlobContainerUri", e.ExportBlobContainerURI) + populate(objectMap, "exportBlobName", e.ExportBlobName) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "includeConfigurations", e.IncludeConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportDevicesRequest. +func (e *ExportDevicesRequest) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &e.AuthenticationType) + delete(rawMsg, key) + case "configurationsBlobName": + err = unpopulate(val, "ConfigurationsBlobName", &e.ConfigurationsBlobName) + delete(rawMsg, key) + case "excludeKeys": + err = unpopulate(val, "ExcludeKeys", &e.ExcludeKeys) + delete(rawMsg, key) + case "exportBlobContainerUri": + err = unpopulate(val, "ExportBlobContainerURI", &e.ExportBlobContainerURI) + delete(rawMsg, key) + case "exportBlobName": + err = unpopulate(val, "ExportBlobName", &e.ExportBlobName) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "includeConfigurations": + err = unpopulate(val, "IncludeConfigurations", &e.IncludeConfigurations) + 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 FailoverInput. +func (f FailoverInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failoverRegion", f.FailoverRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverInput. +func (f *FailoverInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "failoverRegion": + err = unpopulate(val, "FailoverRegion", &f.FailoverRegion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FallbackRouteProperties. +func (f FallbackRouteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "condition", f.Condition) + populate(objectMap, "endpointNames", f.EndpointNames) + populate(objectMap, "isEnabled", f.IsEnabled) + populate(objectMap, "name", f.Name) + populate(objectMap, "source", f.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FallbackRouteProperties. +func (f *FallbackRouteProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "condition": + err = unpopulate(val, "Condition", &f.Condition) + delete(rawMsg, key) + case "endpointNames": + err = unpopulate(val, "EndpointNames", &f.EndpointNames) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &f.IsEnabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &f.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FeedbackProperties. +func (f FeedbackProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lockDurationAsIso8601", f.LockDurationAsIso8601) + populate(objectMap, "maxDeliveryCount", f.MaxDeliveryCount) + populate(objectMap, "ttlAsIso8601", f.TTLAsIso8601) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeedbackProperties. +func (f *FeedbackProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lockDurationAsIso8601": + err = unpopulate(val, "LockDurationAsIso8601", &f.LockDurationAsIso8601) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &f.MaxDeliveryCount) + delete(rawMsg, key) + case "ttlAsIso8601": + err = unpopulate(val, "TTLAsIso8601", &f.TTLAsIso8601) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupIDInformation. +func (g GroupIDInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupIDInformation. +func (g *GroupIDInformation) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupIDInformationProperties. +func (g GroupIDInformationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "requiredMembers", g.RequiredMembers) + populate(objectMap, "requiredZoneNames", g.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupIDInformationProperties. +func (g *GroupIDInformationProperties) 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", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &g.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &g.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &g.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPFilterRule. +func (i IPFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", i.Action) + populate(objectMap, "filterName", i.FilterName) + populate(objectMap, "ipMask", i.IPMask) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPFilterRule. +func (i *IPFilterRule) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "filterName": + err = unpopulate(val, "FilterName", &i.FilterName) + delete(rawMsg, key) + case "ipMask": + err = unpopulate(val, "IPMask", &i.IPMask) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImportDevicesRequest. +func (i ImportDevicesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", i.AuthenticationType) + populate(objectMap, "configurationsBlobName", i.ConfigurationsBlobName) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "includeConfigurations", i.IncludeConfigurations) + populate(objectMap, "inputBlobContainerUri", i.InputBlobContainerURI) + populate(objectMap, "inputBlobName", i.InputBlobName) + populate(objectMap, "outputBlobContainerUri", i.OutputBlobContainerURI) + populate(objectMap, "outputBlobName", i.OutputBlobName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportDevicesRequest. +func (i *ImportDevicesRequest) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &i.AuthenticationType) + delete(rawMsg, key) + case "configurationsBlobName": + err = unpopulate(val, "ConfigurationsBlobName", &i.ConfigurationsBlobName) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &i.Identity) + delete(rawMsg, key) + case "includeConfigurations": + err = unpopulate(val, "IncludeConfigurations", &i.IncludeConfigurations) + delete(rawMsg, key) + case "inputBlobContainerUri": + err = unpopulate(val, "InputBlobContainerURI", &i.InputBlobContainerURI) + delete(rawMsg, key) + case "inputBlobName": + err = unpopulate(val, "InputBlobName", &i.InputBlobName) + delete(rawMsg, key) + case "outputBlobContainerUri": + err = unpopulate(val, "OutputBlobContainerURI", &i.OutputBlobContainerURI) + delete(rawMsg, key) + case "outputBlobName": + err = unpopulate(val, "OutputBlobName", &i.OutputBlobName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobResponse. +func (j JobResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC1123(objectMap, "endTimeUtc", j.EndTimeUTC) + populate(objectMap, "failureReason", j.FailureReason) + populate(objectMap, "jobId", j.JobID) + populate(objectMap, "parentJobId", j.ParentJobID) + populateTimeRFC1123(objectMap, "startTimeUtc", j.StartTimeUTC) + populate(objectMap, "status", j.Status) + populate(objectMap, "statusMessage", j.StatusMessage) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResponse. +func (j *JobResponse) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeUtc": + err = unpopulateTimeRFC1123(val, "EndTimeUTC", &j.EndTimeUTC) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, "FailureReason", &j.FailureReason) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &j.JobID) + delete(rawMsg, key) + case "parentJobId": + err = unpopulate(val, "ParentJobID", &j.ParentJobID) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC1123(val, "StartTimeUTC", &j.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + case "statusMessage": + err = unpopulate(val, "StatusMessage", &j.StatusMessage) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobResponseListResult. +func (j JobResponseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobResponseListResult. +func (j *JobResponseListResult) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultKeyProperties. +func (k KeyVaultKeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", k.Identity) + populate(objectMap, "keyIdentifier", k.KeyIdentifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultKeyProperties. +func (k *KeyVaultKeyProperties) 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 "identity": + err = unpopulate(val, "Identity", &k.Identity) + delete(rawMsg, key) + case "keyIdentifier": + err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) + 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 LocationDescription. +func (l LocationDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", l.Location) + populate(objectMap, "role", l.Role) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationDescription. +func (l *LocationDescription) 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 "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &l.Role) + 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 ManagedIdentity. +func (m ManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "userAssignedIdentity", m.UserAssignedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentity. +func (m *ManagedIdentity) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "userAssignedIdentity": + err = unpopulate(val, "UserAssignedIdentity", &m.UserAssignedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MatchedRoute. +func (m MatchedRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchedRoute. +func (m *MatchedRoute) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MessagingEndpointProperties. +func (m MessagingEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lockDurationAsIso8601", m.LockDurationAsIso8601) + populate(objectMap, "maxDeliveryCount", m.MaxDeliveryCount) + populate(objectMap, "ttlAsIso8601", m.TTLAsIso8601) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MessagingEndpointProperties. +func (m *MessagingEndpointProperties) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lockDurationAsIso8601": + err = unpopulate(val, "LockDurationAsIso8601", &m.LockDurationAsIso8601) + delete(rawMsg, key) + case "maxDeliveryCount": + err = unpopulate(val, "MaxDeliveryCount", &m.MaxDeliveryCount) + delete(rawMsg, key) + case "ttlAsIso8601": + err = unpopulate(val, "TTLAsIso8601", &m.TTLAsIso8601) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Name. +func (n Name) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", n.LocalizedValue) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Name. +func (n *Name) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &n.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NameAvailabilityInfo. +func (n NameAvailabilityInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", n.Message) + populate(objectMap, "nameAvailable", n.NameAvailable) + populate(objectMap, "reason", n.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityInfo. +func (n *NameAvailabilityInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &n.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &n.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &n.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSetIPRule. +func (n NetworkRuleSetIPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", n.Action) + populate(objectMap, "filterName", n.FilterName) + populate(objectMap, "ipMask", n.IPMask) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSetIPRule. +func (n *NetworkRuleSetIPRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &n.Action) + delete(rawMsg, key) + case "filterName": + err = unpopulate(val, "FilterName", &n.FilterName) + delete(rawMsg, key) + case "ipMask": + err = unpopulate(val, "IPMask", &n.IPMask) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSetProperties. +func (n NetworkRuleSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applyToBuiltInEventHubEndpoint", n.ApplyToBuiltInEventHubEndpoint) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSetProperties. +func (n *NetworkRuleSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applyToBuiltInEventHubEndpoint": + err = unpopulate(val, "ApplyToBuiltInEventHubEndpoint", &n.ApplyToBuiltInEventHubEndpoint) + delete(rawMsg, key) + case "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + 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 "name": + err = unpopulate(val, "Name", &o.Name) + 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 OperationInputs. +func (o OperationInputs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationInputs. +func (o *OperationInputs) 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 "name": + err = unpopulate(val, "Name", &o.Name) + 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 PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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 "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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 "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + 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 PrivateLinkResources. +func (p PrivateLinkResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResources. +func (p *PrivateLinkResources) 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 "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 PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) 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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + 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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedFqdnList", p.AllowedFqdnList) + populate(objectMap, "authorizationPolicies", p.AuthorizationPolicies) + populate(objectMap, "cloudToDevice", p.CloudToDevice) + populate(objectMap, "comments", p.Comments) + populate(objectMap, "deviceStreams", p.DeviceStreams) + populate(objectMap, "disableDeviceSAS", p.DisableDeviceSAS) + populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) + populate(objectMap, "disableModuleSAS", p.DisableModuleSAS) + populate(objectMap, "enableDataResidency", p.EnableDataResidency) + populate(objectMap, "enableFileUploadNotifications", p.EnableFileUploadNotifications) + populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "eventHubEndpoints", p.EventHubEndpoints) + populate(objectMap, "features", p.Features) + populate(objectMap, "hostName", p.HostName) + populate(objectMap, "ipFilterRules", p.IPFilterRules) + populate(objectMap, "locations", p.Locations) + populate(objectMap, "messagingEndpoints", p.MessagingEndpoints) + populate(objectMap, "minTlsVersion", p.MinTLSVersion) + populate(objectMap, "networkRuleSets", p.NetworkRuleSets) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "restrictOutboundNetworkAccess", p.RestrictOutboundNetworkAccess) + populate(objectMap, "rootCertificate", p.RootCertificate) + populate(objectMap, "routing", p.Routing) + populate(objectMap, "state", p.State) + populate(objectMap, "storageEndpoints", p.StorageEndpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Properties. +func (p *Properties) 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 "allowedFqdnList": + err = unpopulate(val, "AllowedFqdnList", &p.AllowedFqdnList) + delete(rawMsg, key) + case "authorizationPolicies": + err = unpopulate(val, "AuthorizationPolicies", &p.AuthorizationPolicies) + delete(rawMsg, key) + case "cloudToDevice": + err = unpopulate(val, "CloudToDevice", &p.CloudToDevice) + delete(rawMsg, key) + case "comments": + err = unpopulate(val, "Comments", &p.Comments) + delete(rawMsg, key) + case "deviceStreams": + err = unpopulate(val, "DeviceStreams", &p.DeviceStreams) + delete(rawMsg, key) + case "disableDeviceSAS": + err = unpopulate(val, "DisableDeviceSAS", &p.DisableDeviceSAS) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &p.DisableLocalAuth) + delete(rawMsg, key) + case "disableModuleSAS": + err = unpopulate(val, "DisableModuleSAS", &p.DisableModuleSAS) + delete(rawMsg, key) + case "enableDataResidency": + err = unpopulate(val, "EnableDataResidency", &p.EnableDataResidency) + delete(rawMsg, key) + case "enableFileUploadNotifications": + err = unpopulate(val, "EnableFileUploadNotifications", &p.EnableFileUploadNotifications) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &p.Encryption) + delete(rawMsg, key) + case "eventHubEndpoints": + err = unpopulate(val, "EventHubEndpoints", &p.EventHubEndpoints) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &p.Features) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &p.HostName) + delete(rawMsg, key) + case "ipFilterRules": + err = unpopulate(val, "IPFilterRules", &p.IPFilterRules) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &p.Locations) + delete(rawMsg, key) + case "messagingEndpoints": + err = unpopulate(val, "MessagingEndpoints", &p.MessagingEndpoints) + delete(rawMsg, key) + case "minTlsVersion": + err = unpopulate(val, "MinTLSVersion", &p.MinTLSVersion) + delete(rawMsg, key) + case "networkRuleSets": + err = unpopulate(val, "NetworkRuleSets", &p.NetworkRuleSets) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + delete(rawMsg, key) + case "restrictOutboundNetworkAccess": + err = unpopulate(val, "RestrictOutboundNetworkAccess", &p.RestrictOutboundNetworkAccess) + delete(rawMsg, key) + case "rootCertificate": + err = unpopulate(val, "RootCertificate", &p.RootCertificate) + delete(rawMsg, key) + case "routing": + err = unpopulate(val, "Routing", &p.Routing) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "storageEndpoints": + err = unpopulate(val, "StorageEndpoints", &p.StorageEndpoints) + 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 PropertiesDeviceStreams. +func (p PropertiesDeviceStreams) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "streamingEndpoints", p.StreamingEndpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertiesDeviceStreams. +func (p *PropertiesDeviceStreams) 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 "streamingEndpoints": + err = unpopulate(val, "StreamingEndpoints", &p.StreamingEndpoints) + 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 QuotaMetricInfo. +func (q QuotaMetricInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", q.CurrentValue) + populate(objectMap, "maxValue", q.MaxValue) + populate(objectMap, "name", q.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaMetricInfo. +func (q *QuotaMetricInfo) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) + case "maxValue": + err = unpopulate(val, "MaxValue", &q.MaxValue) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaMetricInfoListResult. +func (q QuotaMetricInfoListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", q.NextLink) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaMetricInfoListResult. +func (q *QuotaMetricInfoListResult) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &q.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryStatistics. +func (r RegistryStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disabledDeviceCount", r.DisabledDeviceCount) + populate(objectMap, "enabledDeviceCount", r.EnabledDeviceCount) + populate(objectMap, "totalDeviceCount", r.TotalDeviceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryStatistics. +func (r *RegistryStatistics) 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 "disabledDeviceCount": + err = unpopulate(val, "DisabledDeviceCount", &r.DisabledDeviceCount) + delete(rawMsg, key) + case "enabledDeviceCount": + err = unpopulate(val, "EnabledDeviceCount", &r.EnabledDeviceCount) + delete(rawMsg, key) + case "totalDeviceCount": + err = unpopulate(val, "TotalDeviceCount", &r.TotalDeviceCount) + 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + 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 "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 RootCertificateProperties. +func (r RootCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableRootCertificateV2", r.EnableRootCertificateV2) + populateTimeRFC3339(objectMap, "lastUpdatedTimeUtc", r.LastUpdatedTimeUTC) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RootCertificateProperties. +func (r *RootCertificateProperties) 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 "enableRootCertificateV2": + err = unpopulate(val, "EnableRootCertificateV2", &r.EnableRootCertificateV2) + delete(rawMsg, key) + case "lastUpdatedTimeUtc": + err = unpopulateTimeRFC3339(val, "LastUpdatedTimeUTC", &r.LastUpdatedTimeUTC) + 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 RouteCompilationError. +func (r RouteCompilationError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", r.Location) + populate(objectMap, "message", r.Message) + populate(objectMap, "severity", r.Severity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteCompilationError. +func (r *RouteCompilationError) 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 "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &r.Message) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &r.Severity) + 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 RouteErrorPosition. +func (r RouteErrorPosition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "column", r.Column) + populate(objectMap, "line", r.Line) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteErrorPosition. +func (r *RouteErrorPosition) 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 "column": + err = unpopulate(val, "Column", &r.Column) + delete(rawMsg, key) + case "line": + err = unpopulate(val, "Line", &r.Line) + 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 RouteErrorRange. +func (r RouteErrorRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "end", r.End) + populate(objectMap, "start", r.Start) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteErrorRange. +func (r *RouteErrorRange) 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 "end": + err = unpopulate(val, "End", &r.End) + delete(rawMsg, key) + case "start": + err = unpopulate(val, "Start", &r.Start) + 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 RouteProperties. +func (r RouteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "endpointNames", r.EndpointNames) + populate(objectMap, "isEnabled", r.IsEnabled) + populate(objectMap, "name", r.Name) + populate(objectMap, "source", r.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RouteProperties. +func (r *RouteProperties) 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 "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "endpointNames": + err = unpopulate(val, "EndpointNames", &r.EndpointNames) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &r.IsEnabled) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &r.Source) + 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 RoutingCosmosDBSQLAPIProperties. +func (r RoutingCosmosDBSQLAPIProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "collectionName", r.CollectionName) + populate(objectMap, "databaseName", r.DatabaseName) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "partitionKeyName", r.PartitionKeyName) + populate(objectMap, "partitionKeyTemplate", r.PartitionKeyTemplate) + populate(objectMap, "primaryKey", r.PrimaryKey) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "secondaryKey", r.SecondaryKey) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingCosmosDBSQLAPIProperties. +func (r *RoutingCosmosDBSQLAPIProperties) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "collectionName": + err = unpopulate(val, "CollectionName", &r.CollectionName) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &r.DatabaseName) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "partitionKeyName": + err = unpopulate(val, "PartitionKeyName", &r.PartitionKeyName) + delete(rawMsg, key) + case "partitionKeyTemplate": + err = unpopulate(val, "PartitionKeyTemplate", &r.PartitionKeyTemplate) + delete(rawMsg, key) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &r.PrimaryKey) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &r.SecondaryKey) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + 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 RoutingEndpoints. +func (r RoutingEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cosmosDBSqlCollections", r.CosmosDBSQLCollections) + populate(objectMap, "eventHubs", r.EventHubs) + populate(objectMap, "serviceBusQueues", r.ServiceBusQueues) + populate(objectMap, "serviceBusTopics", r.ServiceBusTopics) + populate(objectMap, "storageContainers", r.StorageContainers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingEndpoints. +func (r *RoutingEndpoints) 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 "cosmosDBSqlCollections": + err = unpopulate(val, "CosmosDBSQLCollections", &r.CosmosDBSQLCollections) + delete(rawMsg, key) + case "eventHubs": + err = unpopulate(val, "EventHubs", &r.EventHubs) + delete(rawMsg, key) + case "serviceBusQueues": + err = unpopulate(val, "ServiceBusQueues", &r.ServiceBusQueues) + delete(rawMsg, key) + case "serviceBusTopics": + err = unpopulate(val, "ServiceBusTopics", &r.ServiceBusTopics) + delete(rawMsg, key) + case "storageContainers": + err = unpopulate(val, "StorageContainers", &r.StorageContainers) + 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 RoutingEventHubProperties. +func (r RoutingEventHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "entityPath", r.EntityPath) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingEventHubProperties. +func (r *RoutingEventHubProperties) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &r.EntityPath) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + 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 RoutingMessage. +func (r RoutingMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appProperties", r.AppProperties) + populate(objectMap, "body", r.Body) + populate(objectMap, "systemProperties", r.SystemProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingMessage. +func (r *RoutingMessage) 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 "appProperties": + err = unpopulate(val, "AppProperties", &r.AppProperties) + delete(rawMsg, key) + case "body": + err = unpopulate(val, "Body", &r.Body) + delete(rawMsg, key) + case "systemProperties": + err = unpopulate(val, "SystemProperties", &r.SystemProperties) + 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 RoutingProperties. +func (r RoutingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoints", r.Endpoints) + populate(objectMap, "enrichments", r.Enrichments) + populate(objectMap, "fallbackRoute", r.FallbackRoute) + populate(objectMap, "routes", r.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingProperties. +func (r *RoutingProperties) 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 "endpoints": + err = unpopulate(val, "Endpoints", &r.Endpoints) + delete(rawMsg, key) + case "enrichments": + err = unpopulate(val, "Enrichments", &r.Enrichments) + delete(rawMsg, key) + case "fallbackRoute": + err = unpopulate(val, "FallbackRoute", &r.FallbackRoute) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &r.Routes) + 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 RoutingServiceBusQueueEndpointProperties. +func (r RoutingServiceBusQueueEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "entityPath", r.EntityPath) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingServiceBusQueueEndpointProperties. +func (r *RoutingServiceBusQueueEndpointProperties) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &r.EntityPath) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + 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 RoutingServiceBusTopicEndpointProperties. +func (r RoutingServiceBusTopicEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "entityPath", r.EntityPath) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingServiceBusTopicEndpointProperties. +func (r *RoutingServiceBusTopicEndpointProperties) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &r.EntityPath) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + 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 RoutingStorageContainerProperties. +func (r RoutingStorageContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", r.AuthenticationType) + populate(objectMap, "batchFrequencyInSeconds", r.BatchFrequencyInSeconds) + populate(objectMap, "connectionString", r.ConnectionString) + populate(objectMap, "containerName", r.ContainerName) + populate(objectMap, "encoding", r.Encoding) + populate(objectMap, "endpointUri", r.EndpointURI) + populate(objectMap, "fileNameFormat", r.FileNameFormat) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "maxChunkSizeInBytes", r.MaxChunkSizeInBytes) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceGroup", r.ResourceGroup) + populate(objectMap, "subscriptionId", r.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingStorageContainerProperties. +func (r *RoutingStorageContainerProperties) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &r.AuthenticationType) + delete(rawMsg, key) + case "batchFrequencyInSeconds": + err = unpopulate(val, "BatchFrequencyInSeconds", &r.BatchFrequencyInSeconds) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &r.ConnectionString) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &r.ContainerName) + delete(rawMsg, key) + case "encoding": + err = unpopulate(val, "Encoding", &r.Encoding) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &r.EndpointURI) + delete(rawMsg, key) + case "fileNameFormat": + err = unpopulate(val, "FileNameFormat", &r.FileNameFormat) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "maxChunkSizeInBytes": + err = unpopulate(val, "MaxChunkSizeInBytes", &r.MaxChunkSizeInBytes) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceGroup": + err = unpopulate(val, "ResourceGroup", &r.ResourceGroup) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &r.SubscriptionID) + 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 RoutingTwin. +func (r RoutingTwin) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", &r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingTwin. +func (r *RoutingTwin) 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 "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 RoutingTwinProperties. +func (r RoutingTwinProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "desired", &r.Desired) + populate(objectMap, "reported", &r.Reported) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoutingTwinProperties. +func (r *RoutingTwinProperties) 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 "desired": + err = unpopulate(val, "Desired", &r.Desired) + delete(rawMsg, key) + case "reported": + err = unpopulate(val, "Reported", &r.Reported) + 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 SKUDescription. +func (s SKUDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "sku", s.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDescription. +func (s *SKUDescription) 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 "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + 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 SKUDescriptionListResult. +func (s SKUDescriptionListResult) 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 SKUDescriptionListResult. +func (s *SKUDescriptionListResult) 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 SKUInfo. +func (s SKUInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "name", s.Name) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUInfo. +func (s *SKUInfo) 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 "name": + err = unpopulate(val, "Name", &s.Name) + 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 SharedAccessSignatureAuthorizationRule. +func (s SharedAccessSignatureAuthorizationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyName", s.KeyName) + populate(objectMap, "primaryKey", s.PrimaryKey) + populate(objectMap, "rights", s.Rights) + populate(objectMap, "secondaryKey", s.SecondaryKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedAccessSignatureAuthorizationRule. +func (s *SharedAccessSignatureAuthorizationRule) 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 "keyName": + err = unpopulate(val, "KeyName", &s.KeyName) + delete(rawMsg, key) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &s.PrimaryKey) + delete(rawMsg, key) + case "rights": + err = unpopulate(val, "Rights", &s.Rights) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &s.SecondaryKey) + 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 SharedAccessSignatureAuthorizationRuleListResult. +func (s SharedAccessSignatureAuthorizationRuleListResult) 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 SharedAccessSignatureAuthorizationRuleListResult. +func (s *SharedAccessSignatureAuthorizationRuleListResult) 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 StorageEndpointProperties. +func (s StorageEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", s.AuthenticationType) + populate(objectMap, "connectionString", s.ConnectionString) + populate(objectMap, "containerName", s.ContainerName) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "sasTtlAsIso8601", s.SasTTLAsIso8601) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageEndpointProperties. +func (s *StorageEndpointProperties) 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 "authenticationType": + err = unpopulate(val, "AuthenticationType", &s.AuthenticationType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &s.ConnectionString) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &s.ContainerName) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "sasTtlAsIso8601": + err = unpopulate(val, "SasTTLAsIso8601", &s.SasTTLAsIso8601) + 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 TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) 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 "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 TestAllRoutesInput. +func (t TestAllRoutesInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", t.Message) + populate(objectMap, "routingSource", t.RoutingSource) + populate(objectMap, "twin", t.Twin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestAllRoutesInput. +func (t *TestAllRoutesInput) 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 "message": + err = unpopulate(val, "Message", &t.Message) + delete(rawMsg, key) + case "routingSource": + err = unpopulate(val, "RoutingSource", &t.RoutingSource) + delete(rawMsg, key) + case "twin": + err = unpopulate(val, "Twin", &t.Twin) + 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 TestAllRoutesResult. +func (t TestAllRoutesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "routes", t.Routes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestAllRoutesResult. +func (t *TestAllRoutesResult) 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 "routes": + err = unpopulate(val, "Routes", &t.Routes) + 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 TestRouteInput. +func (t TestRouteInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", t.Message) + populate(objectMap, "route", t.Route) + populate(objectMap, "twin", t.Twin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestRouteInput. +func (t *TestRouteInput) 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 "message": + err = unpopulate(val, "Message", &t.Message) + delete(rawMsg, key) + case "route": + err = unpopulate(val, "Route", &t.Route) + delete(rawMsg, key) + case "twin": + err = unpopulate(val, "Twin", &t.Twin) + 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 TestRouteResult. +func (t TestRouteResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "details", t.Details) + populate(objectMap, "result", t.Result) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestRouteResult. +func (t *TestRouteResult) 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 "details": + err = unpopulate(val, "Details", &t.Details) + delete(rawMsg, key) + case "result": + err = unpopulate(val, "Result", &t.Result) + 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 TestRouteResultDetails. +func (t TestRouteResultDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "compilationErrors", t.CompilationErrors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestRouteResultDetails. +func (t *TestRouteResultDetails) 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 "compilationErrors": + err = unpopulate(val, "CompilationErrors", &t.CompilationErrors) + 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 UserSubscriptionQuota. +func (u UserSubscriptionQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "id", u.ID) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + populate(objectMap, "type", u.Type) + populate(objectMap, "unit", u.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserSubscriptionQuota. +func (u *UserSubscriptionQuota) 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 "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + 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 UserSubscriptionQuotaListResult. +func (u UserSubscriptionQuotaListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserSubscriptionQuotaListResult. +func (u *UserSubscriptionQuotaListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + 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/iothub/armiothub/zz_generated_operations_client.go b/sdk/resourcemanager/iothub/armiothub/operations_client.go similarity index 97% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_operations_client.go rename to sdk/resourcemanager/iothub/armiothub/operations_client.go index ab646a14a17b..d2138580028f 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_operations_client.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub @@ -50,7 +51,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available IoT Hub REST API operations. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go similarity index 96% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/iothub/armiothub/privateendpointconnections_client.go index 3b8868f2503b..586c92f8cbac 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/iothub/armiothub/privateendpointconnections_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 armiothub @@ -56,7 +57,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Delete private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // privateEndpointConnectionName - The name of the private endpoint connection @@ -76,7 +77,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) if err != nil { @@ -116,7 +117,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -124,7 +125,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get private endpoint connection properties // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // privateEndpointConnectionName - The name of the private endpoint connection @@ -169,7 +170,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,7 +187,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // List - List private endpoint connection properties // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -226,7 +227,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +244,7 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // BeginUpdate - Update the status of a private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // privateEndpointConnectionName - The name of the private endpoint connection @@ -264,7 +265,7 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, // Update - Update the status of a private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { @@ -304,7 +305,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, privateEndpointConnection) diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go similarity index 97% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/iothub/armiothub/privatelinkresources_client.go index e6a766d5013c..93f92b996f8d 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/iothub/armiothub/privatelinkresources_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 armiothub @@ -56,7 +57,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Get the specified private link resource for the given IotHub // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // groupID - The name of the private link resource @@ -101,7 +102,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,7 +119,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // List - List private link resources for the given IotHub // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List @@ -158,7 +159,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_resource_client.go b/sdk/resourcemanager/iothub/armiothub/resource_client.go similarity index 96% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_resource_client.go rename to sdk/resourcemanager/iothub/armiothub/resource_client.go index ba0695a38eaf..2ff2dc3ae664 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_resource_client.go +++ b/sdk/resourcemanager/iothub/armiothub/resource_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 armiothub @@ -56,7 +57,7 @@ func NewResourceClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Check if an IoT hub name is available. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // operationInputs - Set the name parameter in the OperationInputs structure to the name of the IoT hub to check. // options - ResourceClientCheckNameAvailabilityOptions contains the optional parameters for the ResourceClient.CheckNameAvailability // method. @@ -87,7 +88,7 @@ func (client *ResourceClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, operationInputs) @@ -104,7 +105,7 @@ func (client *ResourceClient) checkNameAvailabilityHandleResponse(resp *http.Res // CreateEventHubConsumerGroup - Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // eventHubEndpointName - The name of the Event Hub-compatible endpoint in the IoT hub. @@ -155,7 +156,7 @@ func (client *ResourceClient) createEventHubConsumerGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, consumerGroupBody) @@ -172,10 +173,9 @@ func (client *ResourceClient) createEventHubConsumerGroupHandleResponse(resp *ht // BeginCreateOrUpdate - Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve // the IoT hub metadata and security metadata, and then combine them with the modified values in a new -// body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback -// to default, which may lead to unexpected behavior. +// body to update the IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // iotHubDescription - The IoT hub metadata and security metadata. @@ -195,10 +195,9 @@ func (client *ResourceClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the // IoT hub metadata and security metadata, and then combine them with the modified values in a new -// body to update the IoT hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback -// to default, which may lead to unexpected behavior. +// body to update the IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview func (client *ResourceClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, iotHubDescription Description, options *ResourceClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, iotHubDescription, options) if err != nil { @@ -234,7 +233,7 @@ func (client *ResourceClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -245,7 +244,7 @@ func (client *ResourceClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientBeginDeleteOptions contains the optional parameters for the ResourceClient.BeginDelete method. @@ -263,7 +262,7 @@ func (client *ResourceClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview func (client *ResourceClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ResourceClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -299,7 +298,7 @@ func (client *ResourceClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -307,7 +306,7 @@ func (client *ResourceClient) deleteCreateRequest(ctx context.Context, resourceG // DeleteEventHubConsumerGroup - Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // eventHubEndpointName - The name of the Event Hub-compatible endpoint in the IoT hub. @@ -357,7 +356,7 @@ func (client *ResourceClient) deleteEventHubConsumerGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +366,7 @@ func (client *ResourceClient) deleteEventHubConsumerGroupCreateRequest(ctx conte // For more information, see: // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // exportDevicesParameters - The parameters that specify the export devices operation. @@ -407,7 +406,7 @@ func (client *ResourceClient) exportDevicesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, exportDevicesParameters) @@ -424,7 +423,7 @@ func (client *ResourceClient) exportDevicesHandleResponse(resp *http.Response) ( // Get - Get the non-security related metadata of an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientGetOptions contains the optional parameters for the ResourceClient.Get method. @@ -463,7 +462,7 @@ func (client *ResourceClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -480,7 +479,7 @@ func (client *ResourceClient) getHandleResponse(resp *http.Response) (ResourceCl // NewGetEndpointHealthPager - Get the health for routing endpoints. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // options - ResourceClientGetEndpointHealthOptions contains the optional parameters for the ResourceClient.GetEndpointHealth // method. func (client *ResourceClient) NewGetEndpointHealthPager(resourceGroupName string, iotHubName string, options *ResourceClientGetEndpointHealthOptions) *runtime.Pager[ResourceClientGetEndpointHealthResponse] { @@ -531,7 +530,7 @@ func (client *ResourceClient) getEndpointHealthCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -548,7 +547,7 @@ func (client *ResourceClient) getEndpointHealthHandleResponse(resp *http.Respons // GetEventHubConsumerGroup - Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // eventHubEndpointName - The name of the Event Hub-compatible endpoint in the IoT hub. @@ -598,7 +597,7 @@ func (client *ResourceClient) getEventHubConsumerGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -615,7 +614,7 @@ func (client *ResourceClient) getEventHubConsumerGroupHandleResponse(resp *http. // GetJob - Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // jobID - The job identifier. @@ -659,7 +658,7 @@ func (client *ResourceClient) getJobCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -676,7 +675,7 @@ func (client *ResourceClient) getJobHandleResponse(resp *http.Response) (Resourc // GetKeysForKeyName - Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // keyName - The name of the shared access policy. @@ -721,7 +720,7 @@ func (client *ResourceClient) getKeysForKeyNameCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -738,7 +737,7 @@ func (client *ResourceClient) getKeysForKeyNameHandleResponse(resp *http.Respons // NewGetQuotaMetricsPager - Get the quota metrics for an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientGetQuotaMetricsOptions contains the optional parameters for the ResourceClient.GetQuotaMetrics @@ -791,7 +790,7 @@ func (client *ResourceClient) getQuotaMetricsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -808,7 +807,7 @@ func (client *ResourceClient) getQuotaMetricsHandleResponse(resp *http.Response) // GetStats - Get the statistics from an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientGetStatsOptions contains the optional parameters for the ResourceClient.GetStats method. @@ -847,7 +846,7 @@ func (client *ResourceClient) getStatsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -864,7 +863,7 @@ func (client *ResourceClient) getStatsHandleResponse(resp *http.Response) (Resou // NewGetValidSKUsPager - Get the list of valid SKUs for an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientGetValidSKUsOptions contains the optional parameters for the ResourceClient.GetValidSKUs method. @@ -916,7 +915,7 @@ func (client *ResourceClient) getValidSKUsCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -935,7 +934,7 @@ func (client *ResourceClient) getValidSKUsHandleResponse(resp *http.Response) (R // see: // https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // importDevicesParameters - The parameters that specify the import devices operation. @@ -975,7 +974,7 @@ func (client *ResourceClient) importDevicesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, importDevicesParameters) @@ -992,7 +991,7 @@ func (client *ResourceClient) importDevicesHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Get all the IoT hubs in a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // options - ResourceClientListByResourceGroupOptions contains the optional parameters for the ResourceClient.ListByResourceGroup // method. @@ -1040,7 +1039,7 @@ func (client *ResourceClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1057,7 +1056,7 @@ func (client *ResourceClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Get all the IoT hubs in a subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // options - ResourceClientListBySubscriptionOptions contains the optional parameters for the ResourceClient.ListBySubscription // method. func (client *ResourceClient) NewListBySubscriptionPager(options *ResourceClientListBySubscriptionOptions) *runtime.Pager[ResourceClientListBySubscriptionResponse] { @@ -1100,7 +1099,7 @@ func (client *ResourceClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1118,7 +1117,7 @@ func (client *ResourceClient) listBySubscriptionHandleResponse(resp *http.Respon // NewListEventHubConsumerGroupsPager - Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint // in an IoT hub. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // eventHubEndpointName - The name of the Event Hub-compatible endpoint. @@ -1176,7 +1175,7 @@ func (client *ResourceClient) listEventHubConsumerGroupsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1193,7 +1192,7 @@ func (client *ResourceClient) listEventHubConsumerGroupsHandleResponse(resp *htt // NewListJobsPager - Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientListJobsOptions contains the optional parameters for the ResourceClient.ListJobs method. @@ -1245,7 +1244,7 @@ func (client *ResourceClient) listJobsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1262,7 +1261,7 @@ func (client *ResourceClient) listJobsHandleResponse(resp *http.Response) (Resou // NewListKeysPager - Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - The name of the resource group that contains the IoT hub. // resourceName - The name of the IoT hub. // options - ResourceClientListKeysOptions contains the optional parameters for the ResourceClient.ListKeys method. @@ -1314,7 +1313,7 @@ func (client *ResourceClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1331,7 +1330,7 @@ func (client *ResourceClient) listKeysHandleResponse(resp *http.Response) (Resou // TestAllRoutes - Test all routes configured in this Iot Hub // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // iotHubName - IotHub to be tested // resourceGroupName - resource group which Iot Hub belongs to // input - Input for testing all routes @@ -1371,7 +1370,7 @@ func (client *ResourceClient) testAllRoutesCreateRequest(ctx context.Context, io return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, input) @@ -1388,7 +1387,7 @@ func (client *ResourceClient) testAllRoutesHandleResponse(resp *http.Response) ( // TestRoute - Test the new route for this Iot Hub // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // iotHubName - IotHub to be tested // resourceGroupName - resource group which Iot Hub belongs to // input - Route that needs to be tested @@ -1428,7 +1427,7 @@ func (client *ResourceClient) testRouteCreateRequest(ctx context.Context, iotHub return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, input) @@ -1445,7 +1444,7 @@ func (client *ResourceClient) testRouteHandleResponse(resp *http.Response) (Reso // BeginUpdate - Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // resourceGroupName - Resource group identifier. // resourceName - Name of iot hub to update. // iotHubTags - Updated tag information to set into the iot hub instance. @@ -1464,7 +1463,7 @@ func (client *ResourceClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview func (client *ResourceClient) update(ctx context.Context, resourceGroupName string, resourceName string, iotHubTags TagsResource, options *ResourceClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, iotHubTags, options) if err != nil { @@ -1500,7 +1499,7 @@ func (client *ResourceClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, iotHubTags) diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go b/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go similarity index 97% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go rename to sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_client.go index 2213381c8395..af482e8b16d9 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go +++ b/sdk/resourcemanager/iothub/armiothub/resourceprovidercommon_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 armiothub @@ -56,7 +57,7 @@ func NewResourceProviderCommonClient(subscriptionID string, credential azcore.To // GetSubscriptionQuota - Get the number of free and paid iot hubs in the subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-02 +// Generated from API version 2022-04-30-preview // options - ResourceProviderCommonClientGetSubscriptionQuotaOptions contains the optional parameters for the ResourceProviderCommonClient.GetSubscriptionQuota // method. func (client *ResourceProviderCommonClient) GetSubscriptionQuota(ctx context.Context, options *ResourceProviderCommonClientGetSubscriptionQuotaOptions) (ResourceProviderCommonClientGetSubscriptionQuotaResponse, error) { @@ -86,7 +87,7 @@ func (client *ResourceProviderCommonClient) getSubscriptionQuotaCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-02") + reqQP.Set("api-version", "2022-04-30-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go b/sdk/resourcemanager/iothub/armiothub/response_types.go similarity index 99% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go rename to sdk/resourcemanager/iothub/armiothub/response_types.go index aa5a2f7416f3..8b737ed98400 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go b/sdk/resourcemanager/iothub/armiothub/time_rfc1123.go similarity index 99% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go rename to sdk/resourcemanager/iothub/armiothub/time_rfc1123.go index e800b8e7dfd9..14f724c21424 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go +++ b/sdk/resourcemanager/iothub/armiothub/time_rfc1123.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 armiothub diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc3339.go b/sdk/resourcemanager/iothub/armiothub/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/iothub/armiothub/time_rfc3339.go index fdccc2db3f3a..ad9269a0317f 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/iothub/armiothub/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 armiothub diff --git a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_certificates_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_certificates_client_test.go deleted file mode 100644 index f9785cb678d4..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_certificates_client_test.go +++ /dev/null @@ -1,164 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listcertificates.json -func ExampleCertificatesClient_ListByIotHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewCertificatesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByIotHub(ctx, - "myResourceGroup", - "testhub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getcertificate.json -func ExampleCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewCertificatesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "testhub", - "cert", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_certificatescreateorupdate.json -func ExampleCertificatesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewCertificatesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myResourceGroup", - "iothub", - "cert", - armiothub.CertificateDescription{ - Properties: &armiothub.CertificateProperties{ - Certificate: to.Ptr("############################################"), - }, - }, - &armiothub.CertificatesClientCreateOrUpdateOptions{IfMatch: 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_certificatesdelete.json -func ExampleCertificatesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewCertificatesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myResourceGroup", - "myhub", - "cert", - "AAAAAAAADGk=", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_generateverificationcode.json -func ExampleCertificatesClient_GenerateVerificationCode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewCertificatesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GenerateVerificationCode(ctx, - "myResourceGroup", - "testHub", - "cert", - "AAAAAAAADGk=", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_certverify.json -func ExampleCertificatesClient_Verify() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewCertificatesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Verify(ctx, - "myResourceGroup", - "myFirstProvisioningService", - "cert", - "AAAAAAAADGk=", - armiothub.CertificateVerificationDescription{ - Certificate: to.Ptr("#####################################"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothub_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothub_client_test.go deleted file mode 100644 index 46872cd7ee06..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothub_client_test.go +++ /dev/null @@ -1,45 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/IotHub_ManualFailover.json -func ExampleClient_BeginManualFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginManualFailover(ctx, - "testHub", - "myResourceGroup", - armiothub.FailoverInput{ - FailoverRegion: to.Ptr("testHub"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothubresource_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothubresource_client_test.go deleted file mode 100644 index f73cdf92f74a..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_iothubresource_client_test.go +++ /dev/null @@ -1,672 +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 armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_get.json -func ExampleResourceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_createOrUpdate.json -func ExampleResourceClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "myResourceGroup", - "testHub", - armiothub.Description{ - Location: to.Ptr("centraluseuap"), - Tags: map[string]*string{}, - Etag: to.Ptr("AAAAAAFD6M4="), - Properties: &armiothub.Properties{ - CloudToDevice: &armiothub.CloudToDeviceProperties{ - DefaultTTLAsIso8601: to.Ptr("PT1H"), - Feedback: &armiothub.FeedbackProperties{ - LockDurationAsIso8601: to.Ptr("PT1M"), - MaxDeliveryCount: to.Ptr[int32](10), - TTLAsIso8601: to.Ptr("PT1H"), - }, - MaxDeliveryCount: to.Ptr[int32](10), - }, - EnableDataResidency: to.Ptr(true), - EnableFileUploadNotifications: to.Ptr(false), - EventHubEndpoints: map[string]*armiothub.EventHubProperties{ - "events": { - PartitionCount: to.Ptr[int32](2), - RetentionTimeInDays: to.Ptr[int64](1), - }, - }, - Features: to.Ptr(armiothub.CapabilitiesNone), - IPFilterRules: []*armiothub.IPFilterRule{}, - MessagingEndpoints: map[string]*armiothub.MessagingEndpointProperties{ - "fileNotifications": { - LockDurationAsIso8601: to.Ptr("PT1M"), - MaxDeliveryCount: to.Ptr[int32](10), - TTLAsIso8601: to.Ptr("PT1H"), - }, - }, - MinTLSVersion: to.Ptr("1.2"), - NetworkRuleSets: &armiothub.NetworkRuleSetProperties{ - ApplyToBuiltInEventHubEndpoint: to.Ptr(true), - DefaultAction: to.Ptr(armiothub.DefaultActionDeny), - IPRules: []*armiothub.NetworkRuleSetIPRule{ - { - Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - FilterName: to.Ptr("rule1"), - IPMask: to.Ptr("131.117.159.53"), - }, - { - Action: to.Ptr(armiothub.NetworkRuleIPActionAllow), - FilterName: to.Ptr("rule2"), - IPMask: to.Ptr("157.55.59.128/25"), - }}, - }, - Routing: &armiothub.RoutingProperties{ - Endpoints: &armiothub.RoutingEndpoints{ - EventHubs: []*armiothub.RoutingEventHubProperties{}, - ServiceBusQueues: []*armiothub.RoutingServiceBusQueueEndpointProperties{}, - ServiceBusTopics: []*armiothub.RoutingServiceBusTopicEndpointProperties{}, - StorageContainers: []*armiothub.RoutingStorageContainerProperties{}, - }, - FallbackRoute: &armiothub.FallbackRouteProperties{ - Name: to.Ptr("$fallback"), - Condition: to.Ptr("true"), - EndpointNames: []*string{ - to.Ptr("events")}, - IsEnabled: to.Ptr(true), - Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - }, - Routes: []*armiothub.RouteProperties{}, - }, - StorageEndpoints: map[string]*armiothub.StorageEndpointProperties{ - "$default": { - ConnectionString: to.Ptr(""), - ContainerName: to.Ptr(""), - SasTTLAsIso8601: to.Ptr("PT1H"), - }, - }, - }, - SKU: &armiothub.SKUInfo{ - Name: to.Ptr(armiothub.IotHubSKUS1), - Capacity: to.Ptr[int64](1), - }, - }, - &armiothub.ResourceClientBeginCreateOrUpdateOptions{IfMatch: 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_patch.json -func ExampleResourceClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "myHub", - armiothub.TagsResource{ - Tags: map[string]*string{ - "foo": to.Ptr("bar"), - }, - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_delete.json -func ExampleResourceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listbysubscription.json -func ExampleResourceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listbyrg.json -func ExampleResourceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_stats.json -func ExampleResourceClient_GetStats() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetStats(ctx, - "myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listehgroups.json -func ExampleResourceClient_NewListEventHubConsumerGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListEventHubConsumerGroupsPager("myResourceGroup", - "testHub", - "events", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getconsumergroup.json -func ExampleResourceClient_GetEventHubConsumerGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetEventHubConsumerGroup(ctx, - "myResourceGroup", - "testHub", - "events", - "test", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_createconsumergroup.json -func ExampleResourceClient_CreateEventHubConsumerGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateEventHubConsumerGroup(ctx, - "myResourceGroup", - "testHub", - "events", - "test", - armiothub.EventHubConsumerGroupBodyDescription{ - Properties: &armiothub.EventHubConsumerGroupName{ - Name: to.Ptr("test"), - }, - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_deleteconsumergroup.json -func ExampleResourceClient_DeleteEventHubConsumerGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DeleteEventHubConsumerGroup(ctx, - "myResourceGroup", - "testHub", - "events", - "test", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listjobs.json -func ExampleResourceClient_NewListJobsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListJobsPager("myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getjob.json -func ExampleResourceClient_GetJob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetJob(ctx, - "myResourceGroup", - "testHub", - "test", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_quotametrics.json -func ExampleResourceClient_NewGetQuotaMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetQuotaMetricsPager("myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_routingendpointhealth.json -func ExampleResourceClient_NewGetEndpointHealthPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetEndpointHealthPager("myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/checkNameAvailability.json -func ExampleResourceClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armiothub.OperationInputs{ - Name: to.Ptr("test-request"), - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_testallroutes.json -func ExampleResourceClient_TestAllRoutes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.TestAllRoutes(ctx, - "testHub", - "myResourceGroup", - armiothub.TestAllRoutesInput{ - Message: &armiothub.RoutingMessage{ - AppProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Body: to.Ptr("Body of message"), - SystemProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, - RoutingSource: to.Ptr(armiothub.RoutingSourceDeviceMessages), - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_testnewroute.json -func ExampleResourceClient_TestRoute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.TestRoute(ctx, - "testHub", - "myResourceGroup", - armiothub.TestRouteInput{ - Message: &armiothub.RoutingMessage{ - AppProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Body: to.Ptr("Body of message"), - SystemProperties: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, - Route: &armiothub.RouteProperties{ - Name: to.Ptr("Routeid"), - EndpointNames: []*string{ - to.Ptr("id1")}, - IsEnabled: to.Ptr(true), - Source: to.Ptr(armiothub.RoutingSourceDeviceMessages), - }, - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listkeys.json -func ExampleResourceClient_NewListKeysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListKeysPager("myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getkey.json -func ExampleResourceClient_GetKeysForKeyName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetKeysForKeyName(ctx, - "myResourceGroup", - "testHub", - "iothubowner", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_exportdevices.json -func ExampleResourceClient_ExportDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ExportDevices(ctx, - "myResourceGroup", - "testHub", - armiothub.ExportDevicesRequest{ - ExcludeKeys: to.Ptr(true), - ExportBlobContainerURI: to.Ptr("testBlob"), - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_importdevices.json -func ExampleResourceClient_ImportDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ImportDevices(ctx, - "myResourceGroup", - "testHub", - armiothub.ImportDevicesRequest{ - InputBlobContainerURI: to.Ptr("testBlob"), - OutputBlobContainerURI: to.Ptr("testBlob"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_operations_client_test.go deleted file mode 100644 index c0e913eb8553..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/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 armiothub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_operations.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 := armiothub.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/iothub/armiothub/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index a4bf9ca766dc..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,125 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armiothub_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/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listprivateendpointconnections.json -func ExamplePrivateEndpointConnectionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewPrivateEndpointConnectionsClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getprivateendpointconnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewPrivateEndpointConnectionsClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "testHub", - "myPrivateEndpointConnection", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_updateprivateendpointconnection.json -func ExamplePrivateEndpointConnectionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewPrivateEndpointConnectionsClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "myResourceGroup", - "testHub", - "myPrivateEndpointConnection", - armiothub.PrivateEndpointConnection{ - Properties: &armiothub.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armiothub.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armiothub.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_deleteprivateendpointconnection.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewPrivateEndpointConnectionsClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "myResourceGroup", - "testHub", - "myPrivateEndpointConnection", - 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/iothub/armiothub/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 31cf5eedae64..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,62 +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 armiothub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_listprivatelinkresources.json -func ExamplePrivateLinkResourcesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewPrivateLinkResourcesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "myResourceGroup", - "testHub", - 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/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_getprivatelinkresources.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewPrivateLinkResourcesClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "testHub", - "iotHub", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_resourceprovidercommon_client_test.go b/sdk/resourcemanager/iothub/armiothub/ze_generated_example_resourceprovidercommon_client_test.go deleted file mode 100644 index 00b58eab2e96..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/ze_generated_example_resourceprovidercommon_client_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armiothub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/iothub/resource-manager/Microsoft.Devices/stable/2021-07-02/examples/iothub_usages.json -func ExampleResourceProviderCommonClient_GetSubscriptionQuota() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armiothub.NewResourceProviderCommonClient("91d12660-3dec-467a-be2a-213b5544ddc0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetSubscriptionQuota(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_models_serde.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_models_serde.go deleted file mode 100644 index c76e8d9bfa94..000000000000 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_models_serde.go +++ /dev/null @@ -1,405 +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 armiothub - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ArmIdentity. -func (a ArmIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", a.PrincipalID) - populate(objectMap, "tenantId", a.TenantID) - populate(objectMap, "type", a.Type) - populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CertificateProperties. -func (c CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "certificate", c.Certificate) - populateTimeRFC1123(objectMap, "created", c.Created) - populateTimeRFC1123(objectMap, "expiry", c.Expiry) - populate(objectMap, "isVerified", c.IsVerified) - populate(objectMap, "subject", c.Subject) - populate(objectMap, "thumbprint", c.Thumbprint) - populateTimeRFC1123(objectMap, "updated", c.Updated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. -func (c *CertificateProperties) 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 "certificate": - err = unpopulate(val, "Certificate", &c.Certificate) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC1123(val, "Created", &c.Created) - delete(rawMsg, key) - case "expiry": - err = unpopulateTimeRFC1123(val, "Expiry", &c.Expiry) - delete(rawMsg, key) - case "isVerified": - err = unpopulate(val, "IsVerified", &c.IsVerified) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &c.Subject) - delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &c.Thumbprint) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC1123(val, "Updated", &c.Updated) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CertificatePropertiesWithNonce. -func (c *CertificatePropertiesWithNonce) 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 "certificate": - err = unpopulate(val, "Certificate", &c.Certificate) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC1123(val, "Created", &c.Created) - delete(rawMsg, key) - case "expiry": - err = unpopulateTimeRFC1123(val, "Expiry", &c.Expiry) - delete(rawMsg, key) - case "isVerified": - err = unpopulate(val, "IsVerified", &c.IsVerified) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &c.Subject) - delete(rawMsg, key) - case "thumbprint": - err = unpopulate(val, "Thumbprint", &c.Thumbprint) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC1123(val, "Updated", &c.Updated) - delete(rawMsg, key) - case "verificationCode": - err = unpopulate(val, "VerificationCode", &c.VerificationCode) - 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 Description. -func (d Description) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) - 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 EndpointHealthData. -func (e *EndpointHealthData) 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 "endpointId": - err = unpopulate(val, "EndpointID", &e.EndpointID) - delete(rawMsg, key) - case "healthStatus": - err = unpopulate(val, "HealthStatus", &e.HealthStatus) - delete(rawMsg, key) - case "lastKnownError": - err = unpopulate(val, "LastKnownError", &e.LastKnownError) - delete(rawMsg, key) - case "lastKnownErrorTime": - err = unpopulateTimeRFC1123(val, "LastKnownErrorTime", &e.LastKnownErrorTime) - delete(rawMsg, key) - case "lastSendAttemptTime": - err = unpopulateTimeRFC1123(val, "LastSendAttemptTime", &e.LastSendAttemptTime) - delete(rawMsg, key) - case "lastSuccessfulSendAttemptTime": - err = unpopulateTimeRFC1123(val, "LastSuccessfulSendAttemptTime", &e.LastSuccessfulSendAttemptTime) - 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 EnrichmentProperties. -func (e EnrichmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpointNames", e.EndpointNames) - populate(objectMap, "key", e.Key) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubProperties. -func (e EventHubProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpoint", e.Endpoint) - populate(objectMap, "partitionCount", e.PartitionCount) - populate(objectMap, "partitionIds", e.PartitionIDs) - populate(objectMap, "path", e.Path) - populate(objectMap, "retentionTimeInDays", e.RetentionTimeInDays) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FallbackRouteProperties. -func (f FallbackRouteProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "condition", f.Condition) - populate(objectMap, "endpointNames", f.EndpointNames) - populate(objectMap, "isEnabled", f.IsEnabled) - populate(objectMap, "name", f.Name) - populate(objectMap, "source", f.Source) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JobResponse. -func (j *JobResponse) 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", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTimeUtc": - err = unpopulateTimeRFC1123(val, "EndTimeUTC", &j.EndTimeUTC) - delete(rawMsg, key) - case "failureReason": - err = unpopulate(val, "FailureReason", &j.FailureReason) - delete(rawMsg, key) - case "jobId": - err = unpopulate(val, "JobID", &j.JobID) - delete(rawMsg, key) - case "parentJobId": - err = unpopulate(val, "ParentJobID", &j.ParentJobID) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC1123(val, "StartTimeUTC", &j.StartTimeUTC) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &j.Status) - delete(rawMsg, key) - case "statusMessage": - err = unpopulate(val, "StatusMessage", &j.StatusMessage) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &j.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSetProperties. -func (n NetworkRuleSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "applyToBuiltInEventHubEndpoint", n.ApplyToBuiltInEventHubEndpoint) - populate(objectMap, "defaultAction", n.DefaultAction) - populate(objectMap, "ipRules", n.IPRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedFqdnList", p.AllowedFqdnList) - populate(objectMap, "authorizationPolicies", p.AuthorizationPolicies) - populate(objectMap, "cloudToDevice", p.CloudToDevice) - populate(objectMap, "comments", p.Comments) - populate(objectMap, "disableDeviceSAS", p.DisableDeviceSAS) - populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) - populate(objectMap, "disableModuleSAS", p.DisableModuleSAS) - populate(objectMap, "enableDataResidency", p.EnableDataResidency) - populate(objectMap, "enableFileUploadNotifications", p.EnableFileUploadNotifications) - populate(objectMap, "eventHubEndpoints", p.EventHubEndpoints) - populate(objectMap, "features", p.Features) - populate(objectMap, "hostName", p.HostName) - populate(objectMap, "ipFilterRules", p.IPFilterRules) - populate(objectMap, "locations", p.Locations) - populate(objectMap, "messagingEndpoints", p.MessagingEndpoints) - populate(objectMap, "minTlsVersion", p.MinTLSVersion) - populate(objectMap, "networkRuleSets", p.NetworkRuleSets) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - populate(objectMap, "restrictOutboundNetworkAccess", p.RestrictOutboundNetworkAccess) - populate(objectMap, "routing", p.Routing) - populate(objectMap, "state", p.State) - populate(objectMap, "storageEndpoints", p.StorageEndpoints) - return json.Marshal(objectMap) -} - -// 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, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RouteProperties. -func (r RouteProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "endpointNames", r.EndpointNames) - populate(objectMap, "isEnabled", r.IsEnabled) - populate(objectMap, "name", r.Name) - populate(objectMap, "source", r.Source) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RoutingEndpoints. -func (r RoutingEndpoints) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eventHubs", r.EventHubs) - populate(objectMap, "serviceBusQueues", r.ServiceBusQueues) - populate(objectMap, "serviceBusTopics", r.ServiceBusTopics) - populate(objectMap, "storageContainers", r.StorageContainers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RoutingMessage. -func (r RoutingMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "appProperties", r.AppProperties) - populate(objectMap, "body", r.Body) - populate(objectMap, "systemProperties", r.SystemProperties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RoutingProperties. -func (r RoutingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpoints", r.Endpoints) - populate(objectMap, "enrichments", r.Enrichments) - populate(objectMap, "fallbackRoute", r.FallbackRoute) - populate(objectMap, "routes", r.Routes) - 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 TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -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 -}