From 2c0d10c574f4ac03d70287dfd6d08d728bb24de9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 29 Sep 2022 10:14:49 +0000 Subject: [PATCH] CodeGen from PR 20670 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.DigitalTwins to add version preview/2021-06-30-preview (#20670) * graph history table and consumer group name defaults * Add period Co-authored-by: Ayodeji Marquis --- .../digitaltwins/armdigitaltwins/CHANGELOG.md | 4 + .../digitaltwins/armdigitaltwins/autorest.md | 6 +- .../{zz_generated_client.go => client.go} | 3 +- ...zz_generated_constants.go => constants.go} | 3 +- ..._endpoint_client.go => endpoint_client.go} | 2 +- .../digitaltwins/armdigitaltwins/go.mod | 14 +- .../digitaltwins/armdigitaltwins/go.sum | 24 +- .../{zz_generated_models.go => models.go} | 4 +- .../armdigitaltwins/models_serde.go | 1426 +++++++++++++++++ ...rations_client.go => operations_client.go} | 2 +- ...phic_helpers.go => polymorphic_helpers.go} | 1 + ...o => privateendpointconnections_client.go} | 1 + ...ient.go => privatelinkresources_client.go} | 1 + ...ed_response_types.go => response_types.go} | 1 + ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...> timeseriesdatabaseconnections_client.go} | 2 +- ...erated_example_digitaltwins_client_test.go | 200 --- ...xample_digitaltwinsendpoint_client_test.go | 129 -- ...enerated_example_operations_client_test.go | 41 - ..._privateendpointconnections_client_test.go | 123 -- ...xample_privatelinkresources_client_test.go | 62 - ...meseriesdatabaseconnections_client_test.go | 133 -- .../zz_generated_models_serde.go | 557 ------- 23 files changed, 1453 insertions(+), 1287 deletions(-) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_client.go => client.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_endpoint_client.go => endpoint_client.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_models.go => models.go} (99%) create mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/models_serde.go rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_operations_client.go => operations_client.go} (98%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_polymorphic_helpers.go => polymorphic_helpers.go} (98%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_response_types.go => response_types.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) rename sdk/resourcemanager/digitaltwins/armdigitaltwins/{zz_generated_timeseriesdatabaseconnections_client.go => timeseriesdatabaseconnections_client.go} (99%) delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwins_client_test.go delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwinsendpoint_client_test.go delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_timeseriesdatabaseconnections_client_test.go delete mode 100644 sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/CHANGELOG.md b/sdk/resourcemanager/digitaltwins/armdigitaltwins/CHANGELOG.md index 111269af6133..3d463edeed17 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/CHANGELOG.md +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2022-09-29) +### Other Changes + + ## 1.0.0 (2022-06-14) ### Features Added diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/autorest.md b/sdk/resourcemanager/digitaltwins/armdigitaltwins/autorest.md index b30ae8b0a2b8..730310a22401 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/autorest.md +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/59b4132646a92806a6aefb0f28d87ad2bd1f21d2/specification/digitaltwins/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/59b4132646a92806a6aefb0f28d87ad2bd1f21d2/specification/digitaltwins/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_client.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/client.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_client.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/client.go index d96268537bb4..c93ca24efe90 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_client.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins @@ -293,7 +294,6 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, } // NewListPager - Get all the DigitalTwinsInstances in a subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-05-31 // options - ClientListOptions contains the optional parameters for the Client.List method. func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse] { @@ -352,7 +352,6 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons } // NewListByResourceGroupPager - Get all the DigitalTwinsInstances in a resource group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-05-31 // resourceGroupName - The name of the resource group that contains the DigitalTwinsInstance. // options - ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_constants.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/constants.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_constants.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/constants.go index cbc8112a555e..0e1082a37577 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_constants.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins const ( moduleName = "armdigitaltwins" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_endpoint_client.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/endpoint_client.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_endpoint_client.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/endpoint_client.go index c1ece750c10a..4fbf447fed8f 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_endpoint_client.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/endpoint_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 armdigitaltwins @@ -252,7 +253,6 @@ func (client *EndpointClient) getHandleResponse(resp *http.Response) (EndpointCl } // NewListPager - Get DigitalTwinsInstance Endpoints. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-05-31 // resourceGroupName - The name of the resource group that contains the DigitalTwinsInstance. // resourceName - The name of the DigitalTwinsInstance. diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.mod b/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.mod index 5979113677fc..1e6a772ada46 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.mod +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/digitaltwins/armdig go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.sum b/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.sum +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_models.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/models.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_models.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/models.go index 5f6bd08f5154..b6a244fce927 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_models.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armdigitaltwins @@ -58,7 +59,8 @@ type CheckNameRequest struct { // REQUIRED; Resource name. Name *string `json:"name,omitempty"` - // REQUIRED; The type of resource, for instance Microsoft.DigitalTwins/digitalTwinsInstances. + // CONSTANT; The type of resource, for instance Microsoft.DigitalTwins/digitalTwinsInstances. + // Field has constant value "Microsoft.DigitalTwins/digitalTwinsInstances", any specified value is ignored. Type *string `json:"type,omitempty"` } diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/models_serde.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/models_serde.go new file mode 100644 index 000000000000..1ac49494e03b --- /dev/null +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/models_serde.go @@ -0,0 +1,1426 @@ +//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 armdigitaltwins + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AzureDataExplorerConnectionProperties. +func (a AzureDataExplorerConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "adxDatabaseName", a.AdxDatabaseName) + populate(objectMap, "adxEndpointUri", a.AdxEndpointURI) + populate(objectMap, "adxResourceId", a.AdxResourceID) + populate(objectMap, "adxTableName", a.AdxTableName) + objectMap["connectionType"] = ConnectionTypeAzureDataExplorer + populate(objectMap, "eventHubConsumerGroup", a.EventHubConsumerGroup) + populate(objectMap, "eventHubEndpointUri", a.EventHubEndpointURI) + populate(objectMap, "eventHubEntityPath", a.EventHubEntityPath) + populate(objectMap, "eventHubNamespaceResourceId", a.EventHubNamespaceResourceID) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDataExplorerConnectionProperties. +func (a *AzureDataExplorerConnectionProperties) UnmarshalJSON(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 "adxDatabaseName": + err = unpopulate(val, "AdxDatabaseName", &a.AdxDatabaseName) + delete(rawMsg, key) + case "adxEndpointUri": + err = unpopulate(val, "AdxEndpointURI", &a.AdxEndpointURI) + delete(rawMsg, key) + case "adxResourceId": + err = unpopulate(val, "AdxResourceID", &a.AdxResourceID) + delete(rawMsg, key) + case "adxTableName": + err = unpopulate(val, "AdxTableName", &a.AdxTableName) + delete(rawMsg, key) + case "connectionType": + err = unpopulate(val, "ConnectionType", &a.ConnectionType) + delete(rawMsg, key) + case "eventHubConsumerGroup": + err = unpopulate(val, "EventHubConsumerGroup", &a.EventHubConsumerGroup) + delete(rawMsg, key) + case "eventHubEndpointUri": + err = unpopulate(val, "EventHubEndpointURI", &a.EventHubEndpointURI) + delete(rawMsg, key) + case "eventHubEntityPath": + err = unpopulate(val, "EventHubEntityPath", &a.EventHubEntityPath) + delete(rawMsg, key) + case "eventHubNamespaceResourceId": + err = unpopulate(val, "EventHubNamespaceResourceID", &a.EventHubNamespaceResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + 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 CheckNameRequest. +func (c CheckNameRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + objectMap["type"] = "Microsoft.DigitalTwins/digitalTwinsInstances" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameRequest. +func (c *CheckNameRequest) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameResult. +func (c CheckNameResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameResult. +func (c *CheckNameResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionProperties. +func (c ConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", c.GroupIDs) + populate(objectMap, "privateEndpoint", c.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", c.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionProperties. +func (c *ConnectionProperties) UnmarshalJSON(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 "groupIds": + err = unpopulate(val, "GroupIDs", &c.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &c.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &c.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + 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 ConnectionPropertiesPrivateLinkServiceConnectionState. +func (c ConnectionPropertiesPrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", c.ActionsRequired) + populate(objectMap, "description", c.Description) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionPropertiesPrivateLinkServiceConnectionState. +func (c *ConnectionPropertiesPrivateLinkServiceConnectionState) UnmarshalJSON(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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &c.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + 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 ConnectionState. +func (c ConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", c.ActionsRequired) + populate(objectMap, "description", c.Description) + populate(objectMap, "status", c.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionState. +func (c *ConnectionState) UnmarshalJSON(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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &c.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + 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, "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, "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 "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 "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 EndpointResource. +func (e EndpointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResource. +func (e *EndpointResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + e.Properties, err = unmarshalEndpointResourcePropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + 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 EndpointResourceListResult. +func (e EndpointResourceListResult) 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 EndpointResourceListResult. +func (e *EndpointResourceListResult) UnmarshalJSON(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 EndpointResourceProperties. +func (e EndpointResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", e.AuthenticationType) + populateTimeRFC3339(objectMap, "createdTime", e.CreatedTime) + populate(objectMap, "deadLetterSecret", e.DeadLetterSecret) + populate(objectMap, "deadLetterUri", e.DeadLetterURI) + objectMap["endpointType"] = e.EndpointType + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResourceProperties. +func (e *EndpointResourceProperties) UnmarshalJSON(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 "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &e.CreatedTime) + delete(rawMsg, key) + case "deadLetterSecret": + err = unpopulate(val, "DeadLetterSecret", &e.DeadLetterSecret) + delete(rawMsg, key) + case "deadLetterUri": + err = unpopulate(val, "DeadLetterURI", &e.DeadLetterURI) + delete(rawMsg, key) + case "endpointType": + err = unpopulate(val, "EndpointType", &e.EndpointType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + 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 ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. +func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventGrid. +func (e EventGrid) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessKey1", e.AccessKey1) + populate(objectMap, "accessKey2", e.AccessKey2) + populate(objectMap, "authenticationType", e.AuthenticationType) + populateTimeRFC3339(objectMap, "createdTime", e.CreatedTime) + populate(objectMap, "deadLetterSecret", e.DeadLetterSecret) + populate(objectMap, "deadLetterUri", e.DeadLetterURI) + objectMap["endpointType"] = EndpointTypeEventGrid + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "TopicEndpoint", e.TopicEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGrid. +func (e *EventGrid) UnmarshalJSON(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 "accessKey1": + err = unpopulate(val, "AccessKey1", &e.AccessKey1) + delete(rawMsg, key) + case "accessKey2": + err = unpopulate(val, "AccessKey2", &e.AccessKey2) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &e.AuthenticationType) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &e.CreatedTime) + delete(rawMsg, key) + case "deadLetterSecret": + err = unpopulate(val, "DeadLetterSecret", &e.DeadLetterSecret) + delete(rawMsg, key) + case "deadLetterUri": + err = unpopulate(val, "DeadLetterURI", &e.DeadLetterURI) + delete(rawMsg, key) + case "endpointType": + err = unpopulate(val, "EndpointType", &e.EndpointType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "TopicEndpoint": + err = unpopulate(val, "TopicEndpoint", &e.TopicEndpoint) + 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 EventHub. +func (e EventHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", e.AuthenticationType) + populate(objectMap, "connectionStringPrimaryKey", e.ConnectionStringPrimaryKey) + populate(objectMap, "connectionStringSecondaryKey", e.ConnectionStringSecondaryKey) + populateTimeRFC3339(objectMap, "createdTime", e.CreatedTime) + populate(objectMap, "deadLetterSecret", e.DeadLetterSecret) + populate(objectMap, "deadLetterUri", e.DeadLetterURI) + objectMap["endpointType"] = EndpointTypeEventHub + populate(objectMap, "endpointUri", e.EndpointURI) + populate(objectMap, "entityPath", e.EntityPath) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHub. +func (e *EventHub) UnmarshalJSON(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 "connectionStringPrimaryKey": + err = unpopulate(val, "ConnectionStringPrimaryKey", &e.ConnectionStringPrimaryKey) + delete(rawMsg, key) + case "connectionStringSecondaryKey": + err = unpopulate(val, "ConnectionStringSecondaryKey", &e.ConnectionStringSecondaryKey) + delete(rawMsg, key) + case "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &e.CreatedTime) + delete(rawMsg, key) + case "deadLetterSecret": + err = unpopulate(val, "DeadLetterSecret", &e.DeadLetterSecret) + delete(rawMsg, key) + case "deadLetterUri": + err = unpopulate(val, "DeadLetterURI", &e.DeadLetterURI) + delete(rawMsg, key) + case "endpointType": + err = unpopulate(val, "EndpointType", &e.EndpointType) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &e.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &e.EntityPath) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + 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 ExternalResource. +func (e ExternalResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalResource. +func (e *ExternalResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + 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 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 GroupIDInformationResponse. +func (g GroupIDInformationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupIDInformationResponse. +func (g *GroupIDInformationResponse) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &g.Value) + 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 Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchDescription. +func (p PatchDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchDescription. +func (p *PatchDescription) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchProperties. +func (p PatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchProperties. +func (p *PatchProperties) UnmarshalJSON(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 "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + 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 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, "systemData", p.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionsResponse. +func (p PrivateEndpointConnectionsResponse) 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 PrivateEndpointConnectionsResponse. +func (p *PrivateEndpointConnectionsResponse) UnmarshalJSON(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 Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdTime", p.CreatedTime) + populate(objectMap, "hostName", p.HostName) + populateTimeRFC3339(objectMap, "lastUpdatedTime", p.LastUpdatedTime) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + 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 "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &p.CreatedTime) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &p.HostName) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &p.LastUpdatedTime) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + 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 "identity": + err = unpopulate(val, "Identity", &r.Identity) + 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 ServiceBus. +func (s ServiceBus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationType", s.AuthenticationType) + populateTimeRFC3339(objectMap, "createdTime", s.CreatedTime) + populate(objectMap, "deadLetterSecret", s.DeadLetterSecret) + populate(objectMap, "deadLetterUri", s.DeadLetterURI) + objectMap["endpointType"] = EndpointTypeServiceBus + populate(objectMap, "endpointUri", s.EndpointURI) + populate(objectMap, "entityPath", s.EntityPath) + populate(objectMap, "primaryConnectionString", s.PrimaryConnectionString) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "secondaryConnectionString", s.SecondaryConnectionString) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBus. +func (s *ServiceBus) UnmarshalJSON(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 "createdTime": + err = unpopulateTimeRFC3339(val, "CreatedTime", &s.CreatedTime) + delete(rawMsg, key) + case "deadLetterSecret": + err = unpopulate(val, "DeadLetterSecret", &s.DeadLetterSecret) + delete(rawMsg, key) + case "deadLetterUri": + err = unpopulate(val, "DeadLetterURI", &s.DeadLetterURI) + delete(rawMsg, key) + case "endpointType": + err = unpopulate(val, "EndpointType", &s.EndpointType) + delete(rawMsg, key) + case "endpointUri": + err = unpopulate(val, "EndpointURI", &s.EndpointURI) + delete(rawMsg, key) + case "entityPath": + err = unpopulate(val, "EntityPath", &s.EntityPath) + delete(rawMsg, key) + case "primaryConnectionString": + err = unpopulate(val, "PrimaryConnectionString", &s.PrimaryConnectionString) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "secondaryConnectionString": + err = unpopulate(val, "SecondaryConnectionString", &s.SecondaryConnectionString) + 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 TimeSeriesDatabaseConnection. +func (t TimeSeriesDatabaseConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesDatabaseConnection. +func (t *TimeSeriesDatabaseConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + t.Properties, err = unmarshalTimeSeriesDatabaseConnectionPropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimeSeriesDatabaseConnectionListResult. +func (t TimeSeriesDatabaseConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesDatabaseConnectionListResult. +func (t *TimeSeriesDatabaseConnectionListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + 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 TimeSeriesDatabaseConnectionProperties. +func (t TimeSeriesDatabaseConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["connectionType"] = t.ConnectionType + populate(objectMap, "provisioningState", t.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesDatabaseConnectionProperties. +func (t *TimeSeriesDatabaseConnectionProperties) UnmarshalJSON(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 "connectionType": + err = unpopulate(val, "ConnectionType", &t.ConnectionType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, 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/digitaltwins/armdigitaltwins/zz_generated_operations_client.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/operations_client.go similarity index 98% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_operations_client.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/operations_client.go index 5afee0954230..10fe3298fed0 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_operations_client.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins @@ -49,7 +50,6 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available DigitalTwins service REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-05-31 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/polymorphic_helpers.go similarity index 98% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/polymorphic_helpers.go index 838149ed3c61..a48967d7cfe6 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/polymorphic_helpers.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 armdigitaltwins diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/privateendpointconnections_client.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/privateendpointconnections_client.go index 77fae5c3db1b..9d09b9d8160c 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/privatelinkresources_client.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/privatelinkresources_client.go index 785cc3ecde8e..b3925a980791 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_response_types.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/response_types.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_response_types.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/response_types.go index bdc9357ad691..b317167540f9 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_response_types.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_time_rfc3339.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/time_rfc3339.go index 0bfc4210bc3a..4ac377d23c1e 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_timeseriesdatabaseconnections_client.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/timeseriesdatabaseconnections_client.go similarity index 99% rename from sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_timeseriesdatabaseconnections_client.go rename to sdk/resourcemanager/digitaltwins/armdigitaltwins/timeseriesdatabaseconnections_client.go index acef075d3ea2..3b5ec5552f3b 100644 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_timeseriesdatabaseconnections_client.go +++ b/sdk/resourcemanager/digitaltwins/armdigitaltwins/timeseriesdatabaseconnections_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 armdigitaltwins @@ -254,7 +255,6 @@ func (client *TimeSeriesDatabaseConnectionsClient) getHandleResponse(resp *http. } // NewListPager - Get all existing time series database connections for this DigitalTwins instance. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2022-05-31 // resourceGroupName - The name of the resource group that contains the DigitalTwinsInstance. // resourceName - The name of the DigitalTwinsInstance. diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwins_client_test.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwins_client_test.go deleted file mode 100644 index 563a95ce1714..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwins_client_test.go +++ /dev/null @@ -1,200 +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 armdigitaltwins_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/digitaltwins/armdigitaltwins" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsGet_example.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "resRg", - "myDigitalTwinsService", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsPut_example.json -func ExampleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "resRg", - "myDigitalTwinsService", - armdigitaltwins.Description{ - Location: to.Ptr("WestUS2"), - }, - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsPatch_example.json -func ExampleClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "resRg", - "myDigitalTwinsService", - armdigitaltwins.PatchDescription{ - Tags: map[string]*string{ - "purpose": to.Ptr("dev"), - }, - }, - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsDelete_example.json -func ExampleClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "resRg", - "myDigitalTwinsService", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsList_example.json -func ExampleClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsListByResourceGroup_example.json -func ExampleClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("resRg", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsCheckNameAvailability_example.json -func ExampleClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - "WestUS2", - armdigitaltwins.CheckNameRequest{ - Name: to.Ptr("myadtinstance"), - Type: to.Ptr("Microsoft.DigitalTwins/digitalTwinsInstances"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwinsendpoint_client_test.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwinsendpoint_client_test.go deleted file mode 100644 index c1ebfbbea13d..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_digitaltwinsendpoint_client_test.go +++ /dev/null @@ -1,129 +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 armdigitaltwins_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/digitaltwins/armdigitaltwins" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsEndpointsGet_example.json -func ExampleEndpointClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewEndpointClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("resRg", - "myDigitalTwinsService", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsEndpointGet_example.json -func ExampleEndpointClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewEndpointClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "resRg", - "myDigitalTwinsService", - "myServiceBus", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsEndpointPut_example.json -func ExampleEndpointClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewEndpointClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "resRg", - "myDigitalTwinsService", - "myServiceBus", - armdigitaltwins.EndpointResource{ - Properties: &armdigitaltwins.ServiceBus{ - AuthenticationType: to.Ptr(armdigitaltwins.AuthenticationTypeKeyBased), - EndpointType: to.Ptr(armdigitaltwins.EndpointTypeServiceBus), - PrimaryConnectionString: to.Ptr("Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc"), - SecondaryConnectionString: to.Ptr("Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc"), - }, - }, - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsEndpointDelete_example.json -func ExampleEndpointClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewEndpointClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "resRg", - "myDigitalTwinsService", - "myendpoint", - 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/digitaltwins/armdigitaltwins/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_operations_client_test.go deleted file mode 100644 index dc8170e0050c..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/digitaltwins/armdigitaltwins" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/DigitalTwinsOperationsList_example.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 := armdigitaltwins.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/digitaltwins/armdigitaltwins/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 29fda100d9f8..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,123 +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 armdigitaltwins_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/digitaltwins/armdigitaltwins" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/PrivateEndpointConnectionsList_example.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 := armdigitaltwins.NewPrivateEndpointConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "resRg", - "myDigitalTwinsService", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/PrivateEndpointConnectionByConnectionName_example.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 := armdigitaltwins.NewPrivateEndpointConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "resRg", - "myDigitalTwinsService", - "myPrivateConnection", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/PrivateEndpointConnectionDelete_example.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 := armdigitaltwins.NewPrivateEndpointConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "resRg", - "myDigitalTwinsService", - "myPrivateConnection", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/PrivateEndpointConnectionPut_example.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewPrivateEndpointConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "resRg", - "myDigitalTwinsService", - "myPrivateConnection", - armdigitaltwins.PrivateEndpointConnection{ - Properties: &armdigitaltwins.ConnectionProperties{ - PrivateLinkServiceConnectionState: &armdigitaltwins.ConnectionPropertiesPrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@company.com."), - Status: to.Ptr(armdigitaltwins.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 -} diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 08031e0fe8b6..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/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 armdigitaltwins_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/digitaltwins/armdigitaltwins" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/PrivateLinkResourcesList_example.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 := armdigitaltwins.NewPrivateLinkResourcesClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "resRg", - "myDigitalTwinsService", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/PrivateLinkResourcesByGroupId_example.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 := armdigitaltwins.NewPrivateLinkResourcesClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "resRg", - "myDigitalTwinsService", - "subResource", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_timeseriesdatabaseconnections_client_test.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_timeseriesdatabaseconnections_client_test.go deleted file mode 100644 index eaac62de5f6f..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/ze_generated_example_timeseriesdatabaseconnections_client_test.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdigitaltwins_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/digitaltwins/armdigitaltwins" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/TimeSeriesDatabaseConnectionsList_example.json -func ExampleTimeSeriesDatabaseConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewTimeSeriesDatabaseConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("resRg", - "myDigitalTwinsService", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/TimeSeriesDatabaseConnectionsGet_example.json -func ExampleTimeSeriesDatabaseConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewTimeSeriesDatabaseConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "resRg", - "myDigitalTwinsService", - "myConnection", - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/TimeSeriesDatabaseConnectionsPut_example.json -func ExampleTimeSeriesDatabaseConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewTimeSeriesDatabaseConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "resRg", - "myDigitalTwinsService", - "myConnection", - armdigitaltwins.TimeSeriesDatabaseConnection{ - Properties: &armdigitaltwins.AzureDataExplorerConnectionProperties{ - ConnectionType: to.Ptr(armdigitaltwins.ConnectionTypeAzureDataExplorer), - AdxDatabaseName: to.Ptr("myDatabase"), - AdxEndpointURI: to.Ptr("https://mycluster.kusto.windows.net"), - AdxResourceID: to.Ptr("/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.Kusto/clusters/mycluster"), - AdxTableName: to.Ptr("myTable"), - EventHubEndpointURI: to.Ptr("sb://myeh.servicebus.windows.net/"), - EventHubEntityPath: to.Ptr("myeh"), - EventHubNamespaceResourceID: to.Ptr("/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.EventHub/namespaces/myeh"), - }, - }, - 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/digitaltwins/resource-manager/Microsoft.DigitalTwins/stable/2022-05-31/examples/TimeSeriesDatabaseConnectionsDelete_example.json -func ExampleTimeSeriesDatabaseConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdigitaltwins.NewTimeSeriesDatabaseConnectionsClient("50016170-c839-41ba-a724-51e9df440b9e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "resRg", - "myDigitalTwinsService", - "myConnection", - 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/digitaltwins/armdigitaltwins/zz_generated_models_serde.go b/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_models_serde.go deleted file mode 100644 index 95bfc3e95e01..000000000000 --- a/sdk/resourcemanager/digitaltwins/armdigitaltwins/zz_generated_models_serde.go +++ /dev/null @@ -1,557 +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 armdigitaltwins - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AzureDataExplorerConnectionProperties. -func (a AzureDataExplorerConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "adxDatabaseName", a.AdxDatabaseName) - populate(objectMap, "adxEndpointUri", a.AdxEndpointURI) - populate(objectMap, "adxResourceId", a.AdxResourceID) - populate(objectMap, "adxTableName", a.AdxTableName) - objectMap["connectionType"] = ConnectionTypeAzureDataExplorer - populate(objectMap, "eventHubConsumerGroup", a.EventHubConsumerGroup) - populate(objectMap, "eventHubEndpointUri", a.EventHubEndpointURI) - populate(objectMap, "eventHubEntityPath", a.EventHubEntityPath) - populate(objectMap, "eventHubNamespaceResourceId", a.EventHubNamespaceResourceID) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDataExplorerConnectionProperties. -func (a *AzureDataExplorerConnectionProperties) UnmarshalJSON(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 "adxDatabaseName": - err = unpopulate(val, "AdxDatabaseName", &a.AdxDatabaseName) - delete(rawMsg, key) - case "adxEndpointUri": - err = unpopulate(val, "AdxEndpointURI", &a.AdxEndpointURI) - delete(rawMsg, key) - case "adxResourceId": - err = unpopulate(val, "AdxResourceID", &a.AdxResourceID) - delete(rawMsg, key) - case "adxTableName": - err = unpopulate(val, "AdxTableName", &a.AdxTableName) - delete(rawMsg, key) - case "connectionType": - err = unpopulate(val, "ConnectionType", &a.ConnectionType) - delete(rawMsg, key) - case "eventHubConsumerGroup": - err = unpopulate(val, "EventHubConsumerGroup", &a.EventHubConsumerGroup) - delete(rawMsg, key) - case "eventHubEndpointUri": - err = unpopulate(val, "EventHubEndpointURI", &a.EventHubEndpointURI) - delete(rawMsg, key) - case "eventHubEntityPath": - err = unpopulate(val, "EventHubEntityPath", &a.EventHubEntityPath) - delete(rawMsg, key) - case "eventHubNamespaceResourceId": - err = unpopulate(val, "EventHubNamespaceResourceID", &a.EventHubNamespaceResourceID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - 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 ConnectionProperties. -func (c ConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupIds", c.GroupIDs) - populate(objectMap, "privateEndpoint", c.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", c.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", c.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Description. -func (d Description) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EndpointResource. -func (e EndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResource. -func (e *EndpointResource) UnmarshalJSON(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 "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - e.Properties, err = unmarshalEndpointResourcePropertiesClassification(val) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - 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 EndpointResourceProperties. -func (e EndpointResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authenticationType", e.AuthenticationType) - populateTimeRFC3339(objectMap, "createdTime", e.CreatedTime) - populate(objectMap, "deadLetterSecret", e.DeadLetterSecret) - populate(objectMap, "deadLetterUri", e.DeadLetterURI) - objectMap["endpointType"] = e.EndpointType - populate(objectMap, "provisioningState", e.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResourceProperties. -func (e *EndpointResourceProperties) UnmarshalJSON(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 "createdTime": - err = unpopulateTimeRFC3339(val, "CreatedTime", &e.CreatedTime) - delete(rawMsg, key) - case "deadLetterSecret": - err = unpopulate(val, "DeadLetterSecret", &e.DeadLetterSecret) - delete(rawMsg, key) - case "deadLetterUri": - err = unpopulate(val, "DeadLetterURI", &e.DeadLetterURI) - delete(rawMsg, key) - case "endpointType": - err = unpopulate(val, "EndpointType", &e.EndpointType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - 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 EventGrid. -func (e EventGrid) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accessKey1", e.AccessKey1) - populate(objectMap, "accessKey2", e.AccessKey2) - populate(objectMap, "authenticationType", e.AuthenticationType) - populateTimeRFC3339(objectMap, "createdTime", e.CreatedTime) - populate(objectMap, "deadLetterSecret", e.DeadLetterSecret) - populate(objectMap, "deadLetterUri", e.DeadLetterURI) - objectMap["endpointType"] = EndpointTypeEventGrid - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "TopicEndpoint", e.TopicEndpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventGrid. -func (e *EventGrid) UnmarshalJSON(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 "accessKey1": - err = unpopulate(val, "AccessKey1", &e.AccessKey1) - delete(rawMsg, key) - case "accessKey2": - err = unpopulate(val, "AccessKey2", &e.AccessKey2) - delete(rawMsg, key) - case "authenticationType": - err = unpopulate(val, "AuthenticationType", &e.AuthenticationType) - delete(rawMsg, key) - case "createdTime": - err = unpopulateTimeRFC3339(val, "CreatedTime", &e.CreatedTime) - delete(rawMsg, key) - case "deadLetterSecret": - err = unpopulate(val, "DeadLetterSecret", &e.DeadLetterSecret) - delete(rawMsg, key) - case "deadLetterUri": - err = unpopulate(val, "DeadLetterURI", &e.DeadLetterURI) - delete(rawMsg, key) - case "endpointType": - err = unpopulate(val, "EndpointType", &e.EndpointType) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - delete(rawMsg, key) - case "TopicEndpoint": - err = unpopulate(val, "TopicEndpoint", &e.TopicEndpoint) - 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 EventHub. -func (e EventHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authenticationType", e.AuthenticationType) - populate(objectMap, "connectionStringPrimaryKey", e.ConnectionStringPrimaryKey) - populate(objectMap, "connectionStringSecondaryKey", e.ConnectionStringSecondaryKey) - populateTimeRFC3339(objectMap, "createdTime", e.CreatedTime) - populate(objectMap, "deadLetterSecret", e.DeadLetterSecret) - populate(objectMap, "deadLetterUri", e.DeadLetterURI) - objectMap["endpointType"] = EndpointTypeEventHub - populate(objectMap, "endpointUri", e.EndpointURI) - populate(objectMap, "entityPath", e.EntityPath) - populate(objectMap, "provisioningState", e.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHub. -func (e *EventHub) UnmarshalJSON(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 "connectionStringPrimaryKey": - err = unpopulate(val, "ConnectionStringPrimaryKey", &e.ConnectionStringPrimaryKey) - delete(rawMsg, key) - case "connectionStringSecondaryKey": - err = unpopulate(val, "ConnectionStringSecondaryKey", &e.ConnectionStringSecondaryKey) - delete(rawMsg, key) - case "createdTime": - err = unpopulateTimeRFC3339(val, "CreatedTime", &e.CreatedTime) - delete(rawMsg, key) - case "deadLetterSecret": - err = unpopulate(val, "DeadLetterSecret", &e.DeadLetterSecret) - delete(rawMsg, key) - case "deadLetterUri": - err = unpopulate(val, "DeadLetterURI", &e.DeadLetterURI) - delete(rawMsg, key) - case "endpointType": - err = unpopulate(val, "EndpointType", &e.EndpointType) - delete(rawMsg, key) - case "endpointUri": - err = unpopulate(val, "EndpointURI", &e.EndpointURI) - delete(rawMsg, key) - case "entityPath": - err = unpopulate(val, "EntityPath", &e.EntityPath) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - 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 PatchDescription. -func (p PatchDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdTime", p.CreatedTime) - populate(objectMap, "hostName", p.HostName) - populateTimeRFC3339(objectMap, "lastUpdatedTime", p.LastUpdatedTime) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - 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 "createdTime": - err = unpopulateTimeRFC3339(val, "CreatedTime", &p.CreatedTime) - delete(rawMsg, key) - case "hostName": - err = unpopulate(val, "HostName", &p.HostName) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &p.LastUpdatedTime) - 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) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceBus. -func (s ServiceBus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authenticationType", s.AuthenticationType) - populateTimeRFC3339(objectMap, "createdTime", s.CreatedTime) - populate(objectMap, "deadLetterSecret", s.DeadLetterSecret) - populate(objectMap, "deadLetterUri", s.DeadLetterURI) - objectMap["endpointType"] = EndpointTypeServiceBus - populate(objectMap, "endpointUri", s.EndpointURI) - populate(objectMap, "entityPath", s.EntityPath) - populate(objectMap, "primaryConnectionString", s.PrimaryConnectionString) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "secondaryConnectionString", s.SecondaryConnectionString) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBus. -func (s *ServiceBus) UnmarshalJSON(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 "createdTime": - err = unpopulateTimeRFC3339(val, "CreatedTime", &s.CreatedTime) - delete(rawMsg, key) - case "deadLetterSecret": - err = unpopulate(val, "DeadLetterSecret", &s.DeadLetterSecret) - delete(rawMsg, key) - case "deadLetterUri": - err = unpopulate(val, "DeadLetterURI", &s.DeadLetterURI) - delete(rawMsg, key) - case "endpointType": - err = unpopulate(val, "EndpointType", &s.EndpointType) - delete(rawMsg, key) - case "endpointUri": - err = unpopulate(val, "EndpointURI", &s.EndpointURI) - delete(rawMsg, key) - case "entityPath": - err = unpopulate(val, "EntityPath", &s.EntityPath) - delete(rawMsg, key) - case "primaryConnectionString": - err = unpopulate(val, "PrimaryConnectionString", &s.PrimaryConnectionString) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "secondaryConnectionString": - err = unpopulate(val, "SecondaryConnectionString", &s.SecondaryConnectionString) - 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 TimeSeriesDatabaseConnection. -func (t TimeSeriesDatabaseConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesDatabaseConnection. -func (t *TimeSeriesDatabaseConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - t.Properties, err = unmarshalTimeSeriesDatabaseConnectionPropertiesClassification(val) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -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 -}