From 56f3253c6733827550c28382084ecaa2f5105667 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 11 Aug 2022 18:55:38 +0000 Subject: [PATCH] CodeGen from PR 20199 in Azure/azure-rest-api-specs Merge 8f9674a9aa842f71e5f90f0061d4a9586726c9d2 into 37c9b56303da9ec425b00575c0027b44d11a772f --- .../armcontainerinstance/CHANGELOG.md | 49 + .../armcontainerinstance/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 53 +- ...ps_client.go => containergroups_client.go} | 3 +- ...tainers_client.go => containers_client.go} | 1 + .../armcontainerinstance/go.mod | 16 +- .../armcontainerinstance/go.sum | 24 +- ..._location_client.go => location_client.go} | 1 + .../{zz_generated_models.go => models.go} | 83 +- .../armcontainerinstance/models_serde.go | 2105 +++++++++++++++++ ...rations_client.go => operations_client.go} | 1 + ...ed_response_types.go => response_types.go} | 6 + .../subnetserviceassociationlink_client.go | 127 + ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...ted_example_containergroups_client_test.go | 340 --- ...enerated_example_containers_client_test.go | 96 - ..._generated_example_location_client_test.go | 92 - ...enerated_example_operations_client_test.go | 41 - .../zz_generated_models_serde.go | 296 --- 19 files changed, 2388 insertions(+), 953 deletions(-) rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_constants.go => constants.go} (80%) rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_containergroups_client.go => containergroups_client.go} (99%) rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_containers_client.go => containers_client.go} (99%) rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_location_client.go => location_client.go} (99%) rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_models.go => models.go} (93%) create mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/models_serde.go rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_operations_client.go => operations_client.go} (99%) rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_response_types.go => response_types.go} (93%) create mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/subnetserviceassociationlink_client.go rename sdk/resourcemanager/containerinstance/armcontainerinstance/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) delete mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containergroups_client_test.go delete mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containers_client_test.go delete mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_location_client_test.go delete mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/CHANGELOG.md b/sdk/resourcemanager/containerinstance/armcontainerinstance/CHANGELOG.md index e9df5608becf..c37323f06669 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/CHANGELOG.md +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/CHANGELOG.md @@ -1,5 +1,54 @@ # Release History +## 2.0.0 (2022-08-11) +### Breaking Changes + +- Type of `ContainerGroup.Properties` has been changed from `*ContainerGroupProperties` to `*ContainerGroupPropertiesProperties` +- Type of `ContainerGroupIdentity.UserAssignedIdentities` has been changed from `map[string]*Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties` to `map[string]*UserAssignedIdentities` +- Const `AutoGeneratedDomainNameLabelScopeNoreuse` has been removed +- Const `AutoGeneratedDomainNameLabelScopeTenantReuse` has been removed +- Const `AutoGeneratedDomainNameLabelScopeUnsecure` has been removed +- Const `AutoGeneratedDomainNameLabelScopeResourceGroupReuse` has been removed +- Const `AutoGeneratedDomainNameLabelScopeSubscriptionReuse` has been removed +- Function `PossibleAutoGeneratedDomainNameLabelScopeValues` has been removed +- Struct `Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties` has been removed +- Field `Diagnostics` of struct `ContainerGroupProperties` has been removed +- Field `Containers` of struct `ContainerGroupProperties` has been removed +- Field `RestartPolicy` of struct `ContainerGroupProperties` has been removed +- Field `SKU` of struct `ContainerGroupProperties` has been removed +- Field `ImageRegistryCredentials` of struct `ContainerGroupProperties` has been removed +- Field `DNSConfig` of struct `ContainerGroupProperties` has been removed +- Field `Volumes` of struct `ContainerGroupProperties` has been removed +- Field `IPAddress` of struct `ContainerGroupProperties` has been removed +- Field `OSType` of struct `ContainerGroupProperties` has been removed +- Field `EncryptionProperties` of struct `ContainerGroupProperties` has been removed +- Field `InitContainers` of struct `ContainerGroupProperties` has been removed +- Field `ProvisioningState` of struct `ContainerGroupProperties` has been removed +- Field `SubnetIDs` of struct `ContainerGroupProperties` has been removed +- Field `InstanceView` of struct `ContainerGroupProperties` has been removed +- Field `DNSNameLabelReusePolicy` of struct `IPAddress` has been removed + +### Features Added + +- New const `DNSNameLabelReusePolicyResourceGroupReuse` +- New const `DNSNameLabelReusePolicyNoreuse` +- New const `DNSNameLabelReusePolicyTenantReuse` +- New const `DNSNameLabelReusePolicyUnsecure` +- New const `DNSNameLabelReusePolicySubscriptionReuse` +- New function `PossibleDNSNameLabelReusePolicyValues() []DNSNameLabelReusePolicy` +- New function `*SubnetServiceAssociationLinkClient.BeginDelete(context.Context, string, string, string, *SubnetServiceAssociationLinkClientBeginDeleteOptions) (*runtime.Poller[SubnetServiceAssociationLinkClientDeleteResponse], error)` +- New function `NewSubnetServiceAssociationLinkClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SubnetServiceAssociationLinkClient, error)` +- New struct `ContainerGroupPropertiesProperties` +- New struct `SubnetServiceAssociationLinkClient` +- New struct `SubnetServiceAssociationLinkClientBeginDeleteOptions` +- New struct `SubnetServiceAssociationLinkClientDeleteResponse` +- New struct `UserAssignedIdentities` +- New field `ID` in struct `Usage` +- New field `Properties` in struct `ContainerGroupProperties` +- New field `Identity` in struct `ContainerGroupProperties` +- New field `AutoGeneratedDomainNameLabelScope` in struct `IPAddress` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/autorest.md b/sdk/resourcemanager/containerinstance/armcontainerinstance/autorest.md index 0bfcfd906332..dd2388bd4bb6 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/autorest.md +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/containerinstance/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/containerinstance/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_constants.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/constants.go similarity index 80% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_constants.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/constants.go index c7c63aefca10..77084c24de3f 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_constants.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/constants.go @@ -5,36 +5,15 @@ // 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 armcontainerinstance const ( moduleName = "armcontainerinstance" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) -// AutoGeneratedDomainNameLabelScope - The value representing the security enum. -type AutoGeneratedDomainNameLabelScope string - -const ( - AutoGeneratedDomainNameLabelScopeNoreuse AutoGeneratedDomainNameLabelScope = "Noreuse" - AutoGeneratedDomainNameLabelScopeResourceGroupReuse AutoGeneratedDomainNameLabelScope = "ResourceGroupReuse" - AutoGeneratedDomainNameLabelScopeSubscriptionReuse AutoGeneratedDomainNameLabelScope = "SubscriptionReuse" - AutoGeneratedDomainNameLabelScopeTenantReuse AutoGeneratedDomainNameLabelScope = "TenantReuse" - AutoGeneratedDomainNameLabelScopeUnsecure AutoGeneratedDomainNameLabelScope = "Unsecure" -) - -// PossibleAutoGeneratedDomainNameLabelScopeValues returns the possible values for the AutoGeneratedDomainNameLabelScope const type. -func PossibleAutoGeneratedDomainNameLabelScopeValues() []AutoGeneratedDomainNameLabelScope { - return []AutoGeneratedDomainNameLabelScope{ - AutoGeneratedDomainNameLabelScopeNoreuse, - AutoGeneratedDomainNameLabelScopeResourceGroupReuse, - AutoGeneratedDomainNameLabelScopeSubscriptionReuse, - AutoGeneratedDomainNameLabelScopeTenantReuse, - AutoGeneratedDomainNameLabelScopeUnsecure, - } -} - // ContainerGroupIPAddressType - Specifies if the IP is exposed to the public internet or private VNET. type ContainerGroupIPAddressType string @@ -136,6 +115,34 @@ func PossibleContainerNetworkProtocolValues() []ContainerNetworkProtocol { } } +// DNSNameLabelReusePolicy - The value representing the security enum. The 'Unsecure' value is the default value if not selected +// and means the object's domain name label is not secured against subdomain takeover. The +// 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the +// same tenant. The 'SubscriptionReuse' value means the object's domain name label +// can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be +// reused within the same resource group. The 'NoReuse' value means the object's +// domain name label cannot be reused within the same resource group, subscription, or tenant. +type DNSNameLabelReusePolicy string + +const ( + DNSNameLabelReusePolicyNoreuse DNSNameLabelReusePolicy = "Noreuse" + DNSNameLabelReusePolicyResourceGroupReuse DNSNameLabelReusePolicy = "ResourceGroupReuse" + DNSNameLabelReusePolicySubscriptionReuse DNSNameLabelReusePolicy = "SubscriptionReuse" + DNSNameLabelReusePolicyTenantReuse DNSNameLabelReusePolicy = "TenantReuse" + DNSNameLabelReusePolicyUnsecure DNSNameLabelReusePolicy = "Unsecure" +) + +// PossibleDNSNameLabelReusePolicyValues returns the possible values for the DNSNameLabelReusePolicy const type. +func PossibleDNSNameLabelReusePolicyValues() []DNSNameLabelReusePolicy { + return []DNSNameLabelReusePolicy{ + DNSNameLabelReusePolicyNoreuse, + DNSNameLabelReusePolicyResourceGroupReuse, + DNSNameLabelReusePolicySubscriptionReuse, + DNSNameLabelReusePolicyTenantReuse, + DNSNameLabelReusePolicyUnsecure, + } +} + // GpuSKU - The SKU of the GPU resource. type GpuSKU string diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_containergroups_client.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/containergroups_client.go similarity index 99% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_containergroups_client.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/containergroups_client.go index 7dbec98fbcc5..5cc6dabb36e1 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_containergroups_client.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/containergroups_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 armcontainerinstance @@ -523,7 +524,7 @@ func (client *ContainerGroupsClient) start(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_containers_client.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/containers_client.go similarity index 99% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_containers_client.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/containers_client.go index 24827887bd2c..f15b5ccf32c1 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_containers_client.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/containers_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 armcontainerinstance diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/go.mod b/sdk/resourcemanager/containerinstance/armcontainerinstance/go.mod index 416659fcb34c..e17302dcf718 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/go.mod +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/go.sum b/sdk/resourcemanager/containerinstance/armcontainerinstance/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/go.sum +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_location_client.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/location_client.go similarity index 99% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_location_client.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/location_client.go index 9753f76b117f..6a01ae9cb444 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_location_client.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/location_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 armcontainerinstance diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_models.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/models.go similarity index 93% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_models.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/models.go index 8c6b7d819f09..f8df9f61e40c 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_models.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/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 armcontainerinstance @@ -106,14 +107,6 @@ type CloudErrorBody struct { Target *string `json:"target,omitempty"` } -type Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties struct { - // READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty" azure:"ro"` - - // READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` -} - // Container - A container instance. type Container struct { // REQUIRED; The user-provided name of the container instance. @@ -168,7 +161,7 @@ type ContainerExecResponse struct { // ContainerGroup - A container group. type ContainerGroup struct { // REQUIRED; The container group properties - Properties *ContainerGroupProperties `json:"properties,omitempty"` + Properties *ContainerGroupPropertiesProperties `json:"properties,omitempty"` // The identity of the container group, if configured. Identity *ContainerGroupIdentity `json:"identity,omitempty"` @@ -205,10 +198,8 @@ type ContainerGroupIdentity struct { // remove any identities from the container group. Type *ResourceIdentityType `json:"type,omitempty"` - // The list of user identities associated with the container group. The user identity dictionary key references will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties `json:"userAssignedIdentities,omitempty"` + // The list of user identities associated with the container group. + UserAssignedIdentities map[string]*UserAssignedIdentities `json:"userAssignedIdentities,omitempty"` // READ-ONLY; The principal id of the container group identity. This property will only be provided for a system assigned // identity. @@ -230,6 +221,24 @@ type ContainerGroupListResult struct { // ContainerGroupProperties - The container group properties type ContainerGroupProperties struct { + // REQUIRED; The container group properties + Properties *ContainerGroupPropertiesProperties `json:"properties,omitempty"` + + // The identity of the container group, if configured. + Identity *ContainerGroupIdentity `json:"identity,omitempty"` +} + +// ContainerGroupPropertiesInstanceView - The instance view of the container group. Only valid in response. +type ContainerGroupPropertiesInstanceView struct { + // READ-ONLY; The events of this container group. + Events []*Event `json:"events,omitempty" azure:"ro"` + + // READ-ONLY; The state of the container group. Only valid in response. + State *string `json:"state,omitempty" azure:"ro"` +} + +// ContainerGroupPropertiesProperties - The container group properties +type ContainerGroupPropertiesProperties struct { // REQUIRED; The containers within the container group. Containers []*Container `json:"containers,omitempty"` @@ -276,15 +285,6 @@ type ContainerGroupProperties struct { ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } -// ContainerGroupPropertiesInstanceView - The instance view of the container group. Only valid in response. -type ContainerGroupPropertiesInstanceView struct { - // READ-ONLY; The events of this container group. - Events []*Event `json:"events,omitempty" azure:"ro"` - - // READ-ONLY; The state of the container group. Only valid in response. - State *string `json:"state,omitempty" azure:"ro"` -} - // ContainerGroupSubnetID - Container group subnet information. type ContainerGroupSubnetID struct { // REQUIRED; Resource ID of virtual network and subnet. @@ -578,12 +578,18 @@ type IPAddress struct { // REQUIRED; Specifies if the IP is exposed to the public internet or private VNET. Type *ContainerGroupIPAddressType `json:"type,omitempty"` + // The value representing the security enum. The 'Unsecure' value is the default value if not selected and means the object's + // domain name label is not secured against subdomain takeover. The + // 'TenantReuse' value is the default value if selected and means the object's domain name label can be reused within the + // same tenant. The 'SubscriptionReuse' value means the object's domain name label + // can be reused within the same subscription. The 'ResourceGroupReuse' value means the object's domain name label can be + // reused within the same resource group. The 'NoReuse' value means the object's + // domain name label cannot be reused within the same resource group, subscription, or tenant. + AutoGeneratedDomainNameLabelScope *DNSNameLabelReusePolicy `json:"autoGeneratedDomainNameLabelScope,omitempty"` + // The Dns name label for the IP. DNSNameLabel *string `json:"dnsNameLabel,omitempty"` - // The value representing the security enum. - DNSNameLabelReusePolicy *AutoGeneratedDomainNameLabelScope `json:"dnsNameLabelReusePolicy,omitempty"` - // The IP exposed to the public internet. IP *string `json:"ip,omitempty"` @@ -596,9 +602,6 @@ type ImageRegistryCredential struct { // REQUIRED; The Docker image registry server without a protocol such as "http" and "https". Server *string `json:"server,omitempty"` - // REQUIRED; The username for the private registry. - Username *string `json:"username,omitempty"` - // The identity for the private registry. Identity *string `json:"identity,omitempty"` @@ -607,6 +610,9 @@ type ImageRegistryCredential struct { // The password for the private registry. Password *string `json:"password,omitempty"` + + // The username for the private registry. + Username *string `json:"username,omitempty"` } // InitContainerDefinition - The init container definition. @@ -797,11 +803,21 @@ type ResourceRequirements struct { Limits *ResourceLimits `json:"limits,omitempty"` } +// SubnetServiceAssociationLinkClientBeginDeleteOptions contains the optional parameters for the SubnetServiceAssociationLinkClient.BeginDelete +// method. +type SubnetServiceAssociationLinkClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // Usage - A single usage result type Usage struct { // READ-ONLY; The current usage of the resource CurrentValue *int32 `json:"currentValue,omitempty" azure:"ro"` + // READ-ONLY; Id of the usage result + ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; The maximum permitted usage of the resource. Limit *int32 `json:"limit,omitempty" azure:"ro"` @@ -827,6 +843,17 @@ type UsageName struct { Value *string `json:"value,omitempty" azure:"ro"` } +// UserAssignedIdentities - The list of user identities associated with the container group. The user identity dictionary +// key references will be ARM resource ids in the form: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. +type UserAssignedIdentities struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + // Volume - The properties of the volume. type Volume struct { // REQUIRED; The name of the volume. diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/models_serde.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/models_serde.go new file mode 100644 index 000000000000..0cf4cbdeabb4 --- /dev/null +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/models_serde.go @@ -0,0 +1,2105 @@ +//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 armcontainerinstance + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AzureFileVolume. +func (a AzureFileVolume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "readOnly", a.ReadOnly) + populate(objectMap, "shareName", a.ShareName) + populate(objectMap, "storageAccountKey", a.StorageAccountKey) + populate(objectMap, "storageAccountName", a.StorageAccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileVolume. +func (a *AzureFileVolume) UnmarshalJSON(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 "readOnly": + err = unpopulate(val, "ReadOnly", &a.ReadOnly) + delete(rawMsg, key) + case "shareName": + err = unpopulate(val, "ShareName", &a.ShareName) + delete(rawMsg, key) + case "storageAccountKey": + err = unpopulate(val, "StorageAccountKey", &a.StorageAccountKey) + delete(rawMsg, key) + case "storageAccountName": + err = unpopulate(val, "StorageAccountName", &a.StorageAccountName) + 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 CachedImages. +func (c CachedImages) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "image", c.Image) + populate(objectMap, "osType", c.OSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CachedImages. +func (c *CachedImages) UnmarshalJSON(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 "image": + err = unpopulate(val, "Image", &c.Image) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &c.OSType) + 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 CachedImagesListResult. +func (c CachedImagesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CachedImagesListResult. +func (c *CachedImagesListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Capabilities. +func (c Capabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capabilities", c.Capabilities) + populate(objectMap, "gpu", c.Gpu) + populate(objectMap, "ipAddressType", c.IPAddressType) + populate(objectMap, "location", c.Location) + populate(objectMap, "osType", c.OSType) + populate(objectMap, "resourceType", c.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Capabilities. +func (c *Capabilities) UnmarshalJSON(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 "capabilities": + err = unpopulate(val, "Capabilities", &c.Capabilities) + delete(rawMsg, key) + case "gpu": + err = unpopulate(val, "Gpu", &c.Gpu) + delete(rawMsg, key) + case "ipAddressType": + err = unpopulate(val, "IPAddressType", &c.IPAddressType) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &c.OSType) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &c.ResourceType) + 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 CapabilitiesCapabilities. +func (c CapabilitiesCapabilities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxCpu", c.MaxCPU) + populate(objectMap, "maxGpuCount", c.MaxGpuCount) + populate(objectMap, "maxMemoryInGB", c.MaxMemoryInGB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapabilitiesCapabilities. +func (c *CapabilitiesCapabilities) UnmarshalJSON(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 "maxCpu": + err = unpopulate(val, "MaxCPU", &c.MaxCPU) + delete(rawMsg, key) + case "maxGpuCount": + err = unpopulate(val, "MaxGpuCount", &c.MaxGpuCount) + delete(rawMsg, key) + case "maxMemoryInGB": + err = unpopulate(val, "MaxMemoryInGB", &c.MaxMemoryInGB) + 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 CapabilitiesListResult. +func (c CapabilitiesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapabilitiesListResult. +func (c *CapabilitiesListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudError. +func (c CloudError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", c.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. +func (c *CloudError) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &c.Error) + 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 CloudErrorBody. +func (c CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. +func (c *CloudErrorBody) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &c.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + 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 Container. +func (c Container) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Container. +func (c *Container) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &c.Properties) + 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 ContainerAttachResponse. +func (c ContainerAttachResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "password", c.Password) + populate(objectMap, "webSocketUri", c.WebSocketURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerAttachResponse. +func (c *ContainerAttachResponse) UnmarshalJSON(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 "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "webSocketUri": + err = unpopulate(val, "WebSocketURI", &c.WebSocketURI) + 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 ContainerExec. +func (c ContainerExec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "command", c.Command) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerExec. +func (c *ContainerExec) UnmarshalJSON(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 "command": + err = unpopulate(val, "Command", &c.Command) + 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 ContainerExecRequest. +func (c ContainerExecRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "command", c.Command) + populate(objectMap, "terminalSize", c.TerminalSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerExecRequest. +func (c *ContainerExecRequest) UnmarshalJSON(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 "command": + err = unpopulate(val, "Command", &c.Command) + delete(rawMsg, key) + case "terminalSize": + err = unpopulate(val, "TerminalSize", &c.TerminalSize) + 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 ContainerExecRequestTerminalSize. +func (c ContainerExecRequestTerminalSize) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cols", c.Cols) + populate(objectMap, "rows", c.Rows) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerExecRequestTerminalSize. +func (c *ContainerExecRequestTerminalSize) UnmarshalJSON(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 "cols": + err = unpopulate(val, "Cols", &c.Cols) + delete(rawMsg, key) + case "rows": + err = unpopulate(val, "Rows", &c.Rows) + 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 ContainerExecResponse. +func (c ContainerExecResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "password", c.Password) + populate(objectMap, "webSocketUri", c.WebSocketURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerExecResponse. +func (c *ContainerExecResponse) UnmarshalJSON(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 "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "webSocketUri": + err = unpopulate(val, "WebSocketURI", &c.WebSocketURI) + 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 ContainerGroup. +func (c ContainerGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroup. +func (c *ContainerGroup) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + 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 ContainerGroupDiagnostics. +func (c ContainerGroupDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logAnalytics", c.LogAnalytics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupDiagnostics. +func (c *ContainerGroupDiagnostics) UnmarshalJSON(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 "logAnalytics": + err = unpopulate(val, "LogAnalytics", &c.LogAnalytics) + 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 ContainerGroupIdentity. +func (c ContainerGroupIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", c.PrincipalID) + populate(objectMap, "tenantId", c.TenantID) + populate(objectMap, "type", c.Type) + populate(objectMap, "userAssignedIdentities", c.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupIdentity. +func (c *ContainerGroupIdentity) UnmarshalJSON(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 "principalId": + err = unpopulate(val, "PrincipalID", &c.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &c.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &c.UserAssignedIdentities) + 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 ContainerGroupListResult. +func (c ContainerGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupListResult. +func (c *ContainerGroupListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProperties. +func (c ContainerGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProperties. +func (c *ContainerGroupProperties) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + 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 ContainerGroupPropertiesInstanceView. +func (c ContainerGroupPropertiesInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "events", c.Events) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupPropertiesInstanceView. +func (c *ContainerGroupPropertiesInstanceView) UnmarshalJSON(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 "events": + err = unpopulate(val, "Events", &c.Events) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + 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 ContainerGroupPropertiesProperties. +func (c ContainerGroupPropertiesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containers", c.Containers) + populate(objectMap, "dnsConfig", c.DNSConfig) + populate(objectMap, "diagnostics", c.Diagnostics) + populate(objectMap, "encryptionProperties", c.EncryptionProperties) + populate(objectMap, "ipAddress", c.IPAddress) + populate(objectMap, "imageRegistryCredentials", c.ImageRegistryCredentials) + populate(objectMap, "initContainers", c.InitContainers) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "osType", c.OSType) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "restartPolicy", c.RestartPolicy) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "subnetIds", c.SubnetIDs) + populate(objectMap, "volumes", c.Volumes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupPropertiesProperties. +func (c *ContainerGroupPropertiesProperties) UnmarshalJSON(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 "containers": + err = unpopulate(val, "Containers", &c.Containers) + delete(rawMsg, key) + case "dnsConfig": + err = unpopulate(val, "DNSConfig", &c.DNSConfig) + delete(rawMsg, key) + case "diagnostics": + err = unpopulate(val, "Diagnostics", &c.Diagnostics) + delete(rawMsg, key) + case "encryptionProperties": + err = unpopulate(val, "EncryptionProperties", &c.EncryptionProperties) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &c.IPAddress) + delete(rawMsg, key) + case "imageRegistryCredentials": + err = unpopulate(val, "ImageRegistryCredentials", &c.ImageRegistryCredentials) + delete(rawMsg, key) + case "initContainers": + err = unpopulate(val, "InitContainers", &c.InitContainers) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &c.InstanceView) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &c.OSType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "restartPolicy": + err = unpopulate(val, "RestartPolicy", &c.RestartPolicy) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &c.SKU) + delete(rawMsg, key) + case "subnetIds": + err = unpopulate(val, "SubnetIDs", &c.SubnetIDs) + delete(rawMsg, key) + case "volumes": + err = unpopulate(val, "Volumes", &c.Volumes) + 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 ContainerGroupSubnetID. +func (c ContainerGroupSubnetID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupSubnetID. +func (c *ContainerGroupSubnetID) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + 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 ContainerHTTPGet. +func (c ContainerHTTPGet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "httpHeaders", c.HTTPHeaders) + populate(objectMap, "path", c.Path) + populate(objectMap, "port", c.Port) + populate(objectMap, "scheme", c.Scheme) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerHTTPGet. +func (c *ContainerHTTPGet) UnmarshalJSON(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 "httpHeaders": + err = unpopulate(val, "HTTPHeaders", &c.HTTPHeaders) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &c.Path) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "scheme": + err = unpopulate(val, "Scheme", &c.Scheme) + 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 ContainerPort. +func (c ContainerPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", c.Port) + populate(objectMap, "protocol", c.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerPort. +func (c *ContainerPort) UnmarshalJSON(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 "port": + err = unpopulate(val, "Port", &c.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &c.Protocol) + 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 ContainerProbe. +func (c ContainerProbe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exec", c.Exec) + populate(objectMap, "failureThreshold", c.FailureThreshold) + populate(objectMap, "httpGet", c.HTTPGet) + populate(objectMap, "initialDelaySeconds", c.InitialDelaySeconds) + populate(objectMap, "periodSeconds", c.PeriodSeconds) + populate(objectMap, "successThreshold", c.SuccessThreshold) + populate(objectMap, "timeoutSeconds", c.TimeoutSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerProbe. +func (c *ContainerProbe) UnmarshalJSON(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 "exec": + err = unpopulate(val, "Exec", &c.Exec) + delete(rawMsg, key) + case "failureThreshold": + err = unpopulate(val, "FailureThreshold", &c.FailureThreshold) + delete(rawMsg, key) + case "httpGet": + err = unpopulate(val, "HTTPGet", &c.HTTPGet) + delete(rawMsg, key) + case "initialDelaySeconds": + err = unpopulate(val, "InitialDelaySeconds", &c.InitialDelaySeconds) + delete(rawMsg, key) + case "periodSeconds": + err = unpopulate(val, "PeriodSeconds", &c.PeriodSeconds) + delete(rawMsg, key) + case "successThreshold": + err = unpopulate(val, "SuccessThreshold", &c.SuccessThreshold) + delete(rawMsg, key) + case "timeoutSeconds": + err = unpopulate(val, "TimeoutSeconds", &c.TimeoutSeconds) + 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 ContainerProperties. +func (c ContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "command", c.Command) + populate(objectMap, "environmentVariables", c.EnvironmentVariables) + populate(objectMap, "image", c.Image) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "livenessProbe", c.LivenessProbe) + populate(objectMap, "ports", c.Ports) + populate(objectMap, "readinessProbe", c.ReadinessProbe) + populate(objectMap, "resources", c.Resources) + populate(objectMap, "volumeMounts", c.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerProperties. +func (c *ContainerProperties) UnmarshalJSON(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 "command": + err = unpopulate(val, "Command", &c.Command) + delete(rawMsg, key) + case "environmentVariables": + err = unpopulate(val, "EnvironmentVariables", &c.EnvironmentVariables) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &c.Image) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &c.InstanceView) + delete(rawMsg, key) + case "livenessProbe": + err = unpopulate(val, "LivenessProbe", &c.LivenessProbe) + delete(rawMsg, key) + case "ports": + err = unpopulate(val, "Ports", &c.Ports) + delete(rawMsg, key) + case "readinessProbe": + err = unpopulate(val, "ReadinessProbe", &c.ReadinessProbe) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &c.Resources) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &c.VolumeMounts) + 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 ContainerPropertiesInstanceView. +func (c ContainerPropertiesInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentState", c.CurrentState) + populate(objectMap, "events", c.Events) + populate(objectMap, "previousState", c.PreviousState) + populate(objectMap, "restartCount", c.RestartCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerPropertiesInstanceView. +func (c *ContainerPropertiesInstanceView) UnmarshalJSON(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 "currentState": + err = unpopulate(val, "CurrentState", &c.CurrentState) + delete(rawMsg, key) + case "events": + err = unpopulate(val, "Events", &c.Events) + delete(rawMsg, key) + case "previousState": + err = unpopulate(val, "PreviousState", &c.PreviousState) + delete(rawMsg, key) + case "restartCount": + err = unpopulate(val, "RestartCount", &c.RestartCount) + 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 ContainerState. +func (c ContainerState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "detailStatus", c.DetailStatus) + populate(objectMap, "exitCode", c.ExitCode) + populateTimeRFC3339(objectMap, "finishTime", c.FinishTime) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerState. +func (c *ContainerState) UnmarshalJSON(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 "detailStatus": + err = unpopulate(val, "DetailStatus", &c.DetailStatus) + delete(rawMsg, key) + case "exitCode": + err = unpopulate(val, "ExitCode", &c.ExitCode) + delete(rawMsg, key) + case "finishTime": + err = unpopulateTimeRFC3339(val, "FinishTime", &c.FinishTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + 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 DNSConfiguration. +func (d DNSConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nameServers", d.NameServers) + populate(objectMap, "options", d.Options) + populate(objectMap, "searchDomains", d.SearchDomains) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSConfiguration. +func (d *DNSConfiguration) UnmarshalJSON(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 "nameServers": + err = unpopulate(val, "NameServers", &d.NameServers) + delete(rawMsg, key) + case "options": + err = unpopulate(val, "Options", &d.Options) + delete(rawMsg, key) + case "searchDomains": + err = unpopulate(val, "SearchDomains", &d.SearchDomains) + 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 EncryptionProperties. +func (e EncryptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "keyName", e.KeyName) + populate(objectMap, "keyVersion", e.KeyVersion) + populate(objectMap, "vaultBaseUrl", e.VaultBaseURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperties. +func (e *EncryptionProperties) UnmarshalJSON(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 "keyName": + err = unpopulate(val, "KeyName", &e.KeyName) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &e.KeyVersion) + delete(rawMsg, key) + case "vaultBaseUrl": + err = unpopulate(val, "VaultBaseURL", &e.VaultBaseURL) + 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 EnvironmentVariable. +func (e EnvironmentVariable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", e.Name) + populate(objectMap, "secureValue", e.SecureValue) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentVariable. +func (e *EnvironmentVariable) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "secureValue": + err = unpopulate(val, "SecureValue", &e.SecureValue) + 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 Event. +func (e Event) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", e.Count) + populateTimeRFC3339(objectMap, "firstTimestamp", e.FirstTimestamp) + populateTimeRFC3339(objectMap, "lastTimestamp", e.LastTimestamp) + populate(objectMap, "message", e.Message) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Event. +func (e *Event) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &e.Count) + delete(rawMsg, key) + case "firstTimestamp": + err = unpopulateTimeRFC3339(val, "FirstTimestamp", &e.FirstTimestamp) + delete(rawMsg, key) + case "lastTimestamp": + err = unpopulateTimeRFC3339(val, "LastTimestamp", &e.LastTimestamp) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GitRepoVolume. +func (g GitRepoVolume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "directory", g.Directory) + populate(objectMap, "repository", g.Repository) + populate(objectMap, "revision", g.Revision) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitRepoVolume. +func (g *GitRepoVolume) UnmarshalJSON(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 "directory": + err = unpopulate(val, "Directory", &g.Directory) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &g.Repository) + delete(rawMsg, key) + case "revision": + err = unpopulate(val, "Revision", &g.Revision) + 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 GpuResource. +func (g GpuResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", g.Count) + populate(objectMap, "sku", g.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GpuResource. +func (g *GpuResource) UnmarshalJSON(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 "count": + err = unpopulate(val, "Count", &g.Count) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &g.SKU) + 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 HTTPHeader. +func (h HTTPHeader) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", h.Name) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPHeader. +func (h *HTTPHeader) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPAddress. +func (i IPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoGeneratedDomainNameLabelScope", i.AutoGeneratedDomainNameLabelScope) + populate(objectMap, "dnsNameLabel", i.DNSNameLabel) + populate(objectMap, "fqdn", i.Fqdn) + populate(objectMap, "ip", i.IP) + populate(objectMap, "ports", i.Ports) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. +func (i *IPAddress) UnmarshalJSON(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 "autoGeneratedDomainNameLabelScope": + err = unpopulate(val, "AutoGeneratedDomainNameLabelScope", &i.AutoGeneratedDomainNameLabelScope) + delete(rawMsg, key) + case "dnsNameLabel": + err = unpopulate(val, "DNSNameLabel", &i.DNSNameLabel) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, "Fqdn", &i.Fqdn) + delete(rawMsg, key) + case "ip": + err = unpopulate(val, "IP", &i.IP) + delete(rawMsg, key) + case "ports": + err = unpopulate(val, "Ports", &i.Ports) + 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 ImageRegistryCredential. +func (i ImageRegistryCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", i.Identity) + populate(objectMap, "identityUrl", i.IdentityURL) + populate(objectMap, "password", i.Password) + populate(objectMap, "server", i.Server) + populate(objectMap, "username", i.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageRegistryCredential. +func (i *ImageRegistryCredential) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &i.Identity) + delete(rawMsg, key) + case "identityUrl": + err = unpopulate(val, "IdentityURL", &i.IdentityURL) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &i.Password) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &i.Server) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &i.Username) + 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 InitContainerDefinition. +func (i InitContainerDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InitContainerDefinition. +func (i *InitContainerDefinition) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + 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 InitContainerPropertiesDefinition. +func (i InitContainerPropertiesDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "command", i.Command) + populate(objectMap, "environmentVariables", i.EnvironmentVariables) + populate(objectMap, "image", i.Image) + populate(objectMap, "instanceView", i.InstanceView) + populate(objectMap, "volumeMounts", i.VolumeMounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InitContainerPropertiesDefinition. +func (i *InitContainerPropertiesDefinition) UnmarshalJSON(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 "command": + err = unpopulate(val, "Command", &i.Command) + delete(rawMsg, key) + case "environmentVariables": + err = unpopulate(val, "EnvironmentVariables", &i.EnvironmentVariables) + delete(rawMsg, key) + case "image": + err = unpopulate(val, "Image", &i.Image) + delete(rawMsg, key) + case "instanceView": + err = unpopulate(val, "InstanceView", &i.InstanceView) + delete(rawMsg, key) + case "volumeMounts": + err = unpopulate(val, "VolumeMounts", &i.VolumeMounts) + 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 InitContainerPropertiesDefinitionInstanceView. +func (i InitContainerPropertiesDefinitionInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentState", i.CurrentState) + populate(objectMap, "events", i.Events) + populate(objectMap, "previousState", i.PreviousState) + populate(objectMap, "restartCount", i.RestartCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InitContainerPropertiesDefinitionInstanceView. +func (i *InitContainerPropertiesDefinitionInstanceView) UnmarshalJSON(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 "currentState": + err = unpopulate(val, "CurrentState", &i.CurrentState) + delete(rawMsg, key) + case "events": + err = unpopulate(val, "Events", &i.Events) + delete(rawMsg, key) + case "previousState": + err = unpopulate(val, "PreviousState", &i.PreviousState) + delete(rawMsg, key) + case "restartCount": + err = unpopulate(val, "RestartCount", &i.RestartCount) + 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 LogAnalytics. +func (l LogAnalytics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logType", l.LogType) + populate(objectMap, "metadata", l.Metadata) + populate(objectMap, "workspaceId", l.WorkspaceID) + populate(objectMap, "workspaceKey", l.WorkspaceKey) + populate(objectMap, "workspaceResourceId", l.WorkspaceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalytics. +func (l *LogAnalytics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logType": + err = unpopulate(val, "LogType", &l.LogType) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &l.Metadata) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) + delete(rawMsg, key) + case "workspaceKey": + err = unpopulate(val, "WorkspaceKey", &l.WorkspaceKey) + delete(rawMsg, key) + case "workspaceResourceId": + err = unpopulate(val, "WorkspaceResourceID", &l.WorkspaceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Logs. +func (l Logs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", l.Content) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Logs. +func (l *Logs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &l.Content) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + 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 "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 Port. +func (p Port) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "port", p.Port) + populate(objectMap, "protocol", p.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Port. +func (p *Port) UnmarshalJSON(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 "port": + err = unpopulate(val, "Port", &p.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &p.Protocol) + 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, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + populate(objectMap, "zones", r.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &r.Zones) + 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 ResourceLimits. +func (r ResourceLimits) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cpu", r.CPU) + populate(objectMap, "gpu", r.Gpu) + populate(objectMap, "memoryInGB", r.MemoryInGB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceLimits. +func (r *ResourceLimits) UnmarshalJSON(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 "cpu": + err = unpopulate(val, "CPU", &r.CPU) + delete(rawMsg, key) + case "gpu": + err = unpopulate(val, "Gpu", &r.Gpu) + delete(rawMsg, key) + case "memoryInGB": + err = unpopulate(val, "MemoryInGB", &r.MemoryInGB) + 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 ResourceRequests. +func (r ResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cpu", r.CPU) + populate(objectMap, "gpu", r.Gpu) + populate(objectMap, "memoryInGB", r.MemoryInGB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceRequests. +func (r *ResourceRequests) UnmarshalJSON(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 "cpu": + err = unpopulate(val, "CPU", &r.CPU) + delete(rawMsg, key) + case "gpu": + err = unpopulate(val, "Gpu", &r.Gpu) + delete(rawMsg, key) + case "memoryInGB": + err = unpopulate(val, "MemoryInGB", &r.MemoryInGB) + 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 ResourceRequirements. +func (r ResourceRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "limits", r.Limits) + populate(objectMap, "requests", r.Requests) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceRequirements. +func (r *ResourceRequirements) UnmarshalJSON(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 "limits": + err = unpopulate(val, "Limits", &r.Limits) + delete(rawMsg, key) + case "requests": + err = unpopulate(val, "Requests", &r.Requests) + 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 Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentValue", u.CurrentValue) + populate(objectMap, "id", u.ID) + populate(objectMap, "limit", u.Limit) + populate(objectMap, "name", u.Name) + populate(objectMap, "unit", u.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. +func (u *Usage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &u.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &u.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &u.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsageListResult. +func (u UsageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageListResult. +func (u *UsageListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UsageName. +func (u UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", u.LocalizedValue) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsageName. +func (u *UsageName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &u.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &u.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentities. +func (u UserAssignedIdentities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentities. +func (u *UserAssignedIdentities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Volume. +func (v Volume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureFile", v.AzureFile) + populate(objectMap, "emptyDir", &v.EmptyDir) + populate(objectMap, "gitRepo", v.GitRepo) + populate(objectMap, "name", v.Name) + populate(objectMap, "secret", v.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Volume. +func (v *Volume) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureFile": + err = unpopulate(val, "AzureFile", &v.AzureFile) + delete(rawMsg, key) + case "emptyDir": + err = unpopulate(val, "EmptyDir", &v.EmptyDir) + delete(rawMsg, key) + case "gitRepo": + err = unpopulate(val, "GitRepo", &v.GitRepo) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &v.Secret) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VolumeMount. +func (v VolumeMount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "mountPath", v.MountPath) + populate(objectMap, "name", v.Name) + populate(objectMap, "readOnly", v.ReadOnly) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeMount. +func (v *VolumeMount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mountPath": + err = unpopulate(val, "MountPath", &v.MountPath) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "readOnly": + err = unpopulate(val, "ReadOnly", &v.ReadOnly) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, 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/containerinstance/armcontainerinstance/zz_generated_operations_client.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/operations_client.go similarity index 99% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_operations_client.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/operations_client.go index 5c45a80e1a83..9c712739bb09 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_operations_client.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/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 armcontainerinstance diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_response_types.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/response_types.go similarity index 93% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_response_types.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/response_types.go index 38eb2e712ef0..1ed54fe88126 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_response_types.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/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 armcontainerinstance @@ -93,3 +94,8 @@ type LocationClientListUsageResponse struct { type OperationsClientListResponse struct { OperationListResult } + +// SubnetServiceAssociationLinkClientDeleteResponse contains the response from method SubnetServiceAssociationLinkClient.Delete. +type SubnetServiceAssociationLinkClientDeleteResponse struct { + // placeholder for future response values +} diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/subnetserviceassociationlink_client.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/subnetserviceassociationlink_client.go new file mode 100644 index 000000000000..0c7e63ea9a41 --- /dev/null +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/subnetserviceassociationlink_client.go @@ -0,0 +1,127 @@ +//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 armcontainerinstance + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SubnetServiceAssociationLinkClient contains the methods for the SubnetServiceAssociationLink group. +// Don't use this type directly, use NewSubnetServiceAssociationLinkClient() instead. +type SubnetServiceAssociationLinkClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSubnetServiceAssociationLinkClient creates a new instance of SubnetServiceAssociationLinkClient with the specified values. +// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSubnetServiceAssociationLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubnetServiceAssociationLinkClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SubnetServiceAssociationLinkClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginDelete - Delete container group virtual network association links. The operation does not delete other resources provided +// by the user. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-10-01 +// resourceGroupName - The name of the resource group. +// virtualNetworkName - The name of the virtual network. +// subnetName - The name of the subnet. +// options - SubnetServiceAssociationLinkClientBeginDeleteOptions contains the optional parameters for the SubnetServiceAssociationLinkClient.BeginDelete +// method. +func (client *SubnetServiceAssociationLinkClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetServiceAssociationLinkClientBeginDeleteOptions) (*runtime.Poller[SubnetServiceAssociationLinkClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[SubnetServiceAssociationLinkClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[SubnetServiceAssociationLinkClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete container group virtual network association links. The operation does not delete other resources provided +// by the user. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2021-10-01 +func (client *SubnetServiceAssociationLinkClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetServiceAssociationLinkClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualNetworkName, subnetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SubnetServiceAssociationLinkClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetServiceAssociationLinkClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualNetworkName == "" { + return nil, errors.New("parameter virtualNetworkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualNetworkName}", url.PathEscape(virtualNetworkName)) + if subnetName == "" { + return nil, errors.New("parameter subnetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subnetName}", url.PathEscape(subnetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_time_rfc3339.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/containerinstance/armcontainerinstance/time_rfc3339.go index 1ab7ba306176..3b0797e9adc3 100644 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/containerinstance/armcontainerinstance/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 armcontainerinstance diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containergroups_client_test.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containergroups_client_test.go deleted file mode 100644 index 12298055285a..000000000000 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containergroups_client_test.go +++ /dev/null @@ -1,340 +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 armcontainerinstance_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/containerinstance/armcontainerinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsList.json -func ExampleContainerGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsListByResourceGroup.json -func ExampleContainerGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("demo", - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsGet_Failed.json -func ExampleContainerGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "demo", - "demo1", - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsCreateOrUpdate.json -func ExampleContainerGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "demo", - "demo1", - armcontainerinstance.ContainerGroup{ - Location: to.Ptr("west us"), - Identity: &armcontainerinstance.ContainerGroupIdentity{ - Type: to.Ptr(armcontainerinstance.ResourceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armcontainerinstance.Components10Wh5UdSchemasContainergroupidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}, - }, - }, - Properties: &armcontainerinstance.ContainerGroupProperties{ - Containers: []*armcontainerinstance.Container{ - { - Name: to.Ptr("demo1"), - Properties: &armcontainerinstance.ContainerProperties{ - Command: []*string{}, - EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{}, - Image: to.Ptr("nginx"), - Ports: []*armcontainerinstance.ContainerPort{ - { - Port: to.Ptr[int32](80), - }}, - Resources: &armcontainerinstance.ResourceRequirements{ - Requests: &armcontainerinstance.ResourceRequests{ - CPU: to.Ptr[float64](1), - Gpu: &armcontainerinstance.GpuResource{ - Count: to.Ptr[int32](1), - SKU: to.Ptr(armcontainerinstance.GpuSKUK80), - }, - MemoryInGB: to.Ptr[float64](1.5), - }, - }, - VolumeMounts: []*armcontainerinstance.VolumeMount{ - { - Name: to.Ptr("volume1"), - MountPath: to.Ptr("/mnt/volume1"), - ReadOnly: to.Ptr(false), - }, - { - Name: to.Ptr("volume2"), - MountPath: to.Ptr("/mnt/volume2"), - ReadOnly: to.Ptr(false), - }, - { - Name: to.Ptr("volume3"), - MountPath: to.Ptr("/mnt/volume3"), - ReadOnly: to.Ptr(true), - }}, - }, - }}, - Diagnostics: &armcontainerinstance.ContainerGroupDiagnostics{ - LogAnalytics: &armcontainerinstance.LogAnalytics{ - LogType: to.Ptr(armcontainerinstance.LogAnalyticsLogTypeContainerInsights), - Metadata: map[string]*string{ - "test-key": to.Ptr("test-metadata-value"), - }, - WorkspaceID: to.Ptr("workspaceid"), - WorkspaceKey: to.Ptr("workspaceKey"), - WorkspaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace"), - }, - }, - DNSConfig: &armcontainerinstance.DNSConfiguration{ - NameServers: []*string{ - to.Ptr("1.1.1.1")}, - Options: to.Ptr("ndots:2"), - SearchDomains: to.Ptr("cluster.local svc.cluster.local"), - }, - ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{}, - IPAddress: &armcontainerinstance.IPAddress{ - Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic), - DNSNameLabel: to.Ptr("dnsnamelabel1"), - DNSNameLabelReusePolicy: to.Ptr(armcontainerinstance.AutoGeneratedDomainNameLabelScopeUnsecure), - Ports: []*armcontainerinstance.Port{ - { - Port: to.Ptr[int32](80), - Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP), - }}, - }, - OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux), - SubnetIDs: []*armcontainerinstance.ContainerGroupSubnetID{ - { - ID: to.Ptr("[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"), - }}, - Volumes: []*armcontainerinstance.Volume{ - { - Name: to.Ptr("volume1"), - AzureFile: &armcontainerinstance.AzureFileVolume{ - ShareName: to.Ptr("shareName"), - StorageAccountKey: to.Ptr("accountKey"), - StorageAccountName: to.Ptr("accountName"), - }, - }, - { - Name: to.Ptr("volume2"), - EmptyDir: map[string]interface{}{}, - }, - { - Name: to.Ptr("volume3"), - Secret: map[string]*string{ - "secretKey1": to.Ptr("SecretValue1InBase64"), - "secretKey2": to.Ptr("SecretValue2InBase64"), - }, - }}, - }, - }, - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsUpdate.json -func ExampleContainerGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "demoResource", - "demo1", - armcontainerinstance.Resource{ - Tags: map[string]*string{ - "tag1key": to.Ptr("tag1Value"), - "tag2key": to.Ptr("tag2Value"), - }, - }, - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsDelete.json -func ExampleContainerGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "demo", - "demo1", - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsRestart.json -func ExampleContainerGroupsClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, - "demo", - "demo1", - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsStop.json -func ExampleContainerGroupsClient_Stop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Stop(ctx, - "demo", - "demo1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupsStart.json -func ExampleContainerGroupsClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainerGroupsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "demo", - "demo1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containers_client_test.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containers_client_test.go deleted file mode 100644 index 7c8b39624fab..000000000000 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_containers_client_test.go +++ /dev/null @@ -1,96 +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 armcontainerinstance_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/containerinstance/armcontainerinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerListLogs.json -func ExampleContainersClient_ListLogs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainersClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListLogs(ctx, - "demo", - "demo1", - "container1", - &armcontainerinstance.ContainersClientListLogsOptions{Tail: to.Ptr[int32](10), - Timestamps: 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerExec.json -func ExampleContainersClient_ExecuteCommand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainersClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ExecuteCommand(ctx, - "demo", - "demo1", - "container1", - armcontainerinstance.ContainerExecRequest{ - Command: to.Ptr("/bin/bash"), - TerminalSize: &armcontainerinstance.ContainerExecRequestTerminalSize{ - Cols: to.Ptr[int32](12), - Rows: to.Ptr[int32](12), - }, - }, - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerAttach.json -func ExampleContainersClient_Attach() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewContainersClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Attach(ctx, - "demo", - "demo1", - "container1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_location_client_test.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_location_client_test.go deleted file mode 100644 index f79698e00418..000000000000 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_location_client_test.go +++ /dev/null @@ -1,92 +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 armcontainerinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/ContainerGroupUsage.json -func ExampleLocationClient_NewListUsagePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewLocationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListUsagePager("westcentralus", - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/CachedImagesList.json -func ExampleLocationClient_NewListCachedImagesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewLocationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListCachedImagesPager("westcentralus", - 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/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/CapabilitiesList.json -func ExampleLocationClient_NewListCapabilitiesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armcontainerinstance.NewLocationClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListCapabilitiesPager("westus", - 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/containerinstance/armcontainerinstance/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/ze_generated_example_operations_client_test.go deleted file mode 100644 index aafec59b03ba..000000000000 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/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 armcontainerinstance_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-10-01/examples/OperationsList.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 := armcontainerinstance.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/containerinstance/armcontainerinstance/zz_generated_models_serde.go b/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_models_serde.go deleted file mode 100644 index 83e6ef10d29f..000000000000 --- a/sdk/resourcemanager/containerinstance/armcontainerinstance/zz_generated_models_serde.go +++ /dev/null @@ -1,296 +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 armcontainerinstance - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ContainerExec. -func (c ContainerExec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "command", c.Command) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerGroup. -func (c ContainerGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - populate(objectMap, "zones", c.Zones) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerGroupIdentity. -func (c ContainerGroupIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", c.PrincipalID) - populate(objectMap, "tenantId", c.TenantID) - populate(objectMap, "type", c.Type) - populate(objectMap, "userAssignedIdentities", c.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProperties. -func (c ContainerGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "containers", c.Containers) - populate(objectMap, "dnsConfig", c.DNSConfig) - populate(objectMap, "diagnostics", c.Diagnostics) - populate(objectMap, "encryptionProperties", c.EncryptionProperties) - populate(objectMap, "ipAddress", c.IPAddress) - populate(objectMap, "imageRegistryCredentials", c.ImageRegistryCredentials) - populate(objectMap, "initContainers", c.InitContainers) - populate(objectMap, "instanceView", c.InstanceView) - populate(objectMap, "osType", c.OSType) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "restartPolicy", c.RestartPolicy) - populate(objectMap, "sku", c.SKU) - populate(objectMap, "subnetIds", c.SubnetIDs) - populate(objectMap, "volumes", c.Volumes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerGroupPropertiesInstanceView. -func (c ContainerGroupPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "events", c.Events) - populate(objectMap, "state", c.State) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerHTTPGet. -func (c ContainerHTTPGet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "httpHeaders", c.HTTPHeaders) - populate(objectMap, "path", c.Path) - populate(objectMap, "port", c.Port) - populate(objectMap, "scheme", c.Scheme) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerProperties. -func (c ContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "command", c.Command) - populate(objectMap, "environmentVariables", c.EnvironmentVariables) - populate(objectMap, "image", c.Image) - populate(objectMap, "instanceView", c.InstanceView) - populate(objectMap, "livenessProbe", c.LivenessProbe) - populate(objectMap, "ports", c.Ports) - populate(objectMap, "readinessProbe", c.ReadinessProbe) - populate(objectMap, "resources", c.Resources) - populate(objectMap, "volumeMounts", c.VolumeMounts) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerPropertiesInstanceView. -func (c ContainerPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "currentState", c.CurrentState) - populate(objectMap, "events", c.Events) - populate(objectMap, "previousState", c.PreviousState) - populate(objectMap, "restartCount", c.RestartCount) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerState. -func (c ContainerState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "detailStatus", c.DetailStatus) - populate(objectMap, "exitCode", c.ExitCode) - populateTimeRFC3339(objectMap, "finishTime", c.FinishTime) - populateTimeRFC3339(objectMap, "startTime", c.StartTime) - populate(objectMap, "state", c.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerState. -func (c *ContainerState) UnmarshalJSON(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 "detailStatus": - err = unpopulate(val, "DetailStatus", &c.DetailStatus) - delete(rawMsg, key) - case "exitCode": - err = unpopulate(val, "ExitCode", &c.ExitCode) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &c.FinishTime) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &c.State) - 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 DNSConfiguration. -func (d DNSConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nameServers", d.NameServers) - populate(objectMap, "options", d.Options) - populate(objectMap, "searchDomains", d.SearchDomains) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Event. -func (e Event) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "count", e.Count) - populateTimeRFC3339(objectMap, "firstTimestamp", e.FirstTimestamp) - populateTimeRFC3339(objectMap, "lastTimestamp", e.LastTimestamp) - populate(objectMap, "message", e.Message) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Event. -func (e *Event) UnmarshalJSON(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 "count": - err = unpopulate(val, "Count", &e.Count) - delete(rawMsg, key) - case "firstTimestamp": - err = unpopulateTimeRFC3339(val, "FirstTimestamp", &e.FirstTimestamp) - delete(rawMsg, key) - case "lastTimestamp": - err = unpopulateTimeRFC3339(val, "LastTimestamp", &e.LastTimestamp) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IPAddress. -func (i IPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dnsNameLabel", i.DNSNameLabel) - populate(objectMap, "dnsNameLabelReusePolicy", i.DNSNameLabelReusePolicy) - populate(objectMap, "fqdn", i.Fqdn) - populate(objectMap, "ip", i.IP) - populate(objectMap, "ports", i.Ports) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type InitContainerPropertiesDefinition. -func (i InitContainerPropertiesDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "command", i.Command) - populate(objectMap, "environmentVariables", i.EnvironmentVariables) - populate(objectMap, "image", i.Image) - populate(objectMap, "instanceView", i.InstanceView) - populate(objectMap, "volumeMounts", i.VolumeMounts) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type InitContainerPropertiesDefinitionInstanceView. -func (i InitContainerPropertiesDefinitionInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "currentState", i.CurrentState) - populate(objectMap, "events", i.Events) - populate(objectMap, "previousState", i.PreviousState) - populate(objectMap, "restartCount", i.RestartCount) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogAnalytics. -func (l LogAnalytics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logType", l.LogType) - populate(objectMap, "metadata", l.Metadata) - populate(objectMap, "workspaceId", l.WorkspaceID) - populate(objectMap, "workspaceKey", l.WorkspaceKey) - populate(objectMap, "workspaceResourceId", l.WorkspaceResourceID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - populate(objectMap, "zones", r.Zones) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Volume. -func (v Volume) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "azureFile", v.AzureFile) - populate(objectMap, "emptyDir", &v.EmptyDir) - populate(objectMap, "gitRepo", v.GitRepo) - populate(objectMap, "name", v.Name) - populate(objectMap, "secret", v.Secret) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}