From 7e8b65504daa35fe008cd7d6a5991307e6da0238 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 25 Jul 2022 16:13:03 +0000 Subject: [PATCH] CodeGen from PR 19929 in Azure/azure-rest-api-specs Merge 7cdb4adf78bbf7c0c3a1c4c255f12df4c6e0d6c8 into 8c2258114e565bb041dcb25a761acb965a4870e7 --- .../armguestconfiguration/CHANGELOG.md | 4 + ..._client.go => assignmentreports_client.go} | 1 + ...ent.go => assignmentreportsvmss_client.go} | 1 + ...nments_client.go => assignments_client.go} | 1 + ...ss_client.go => assignmentsvmss_client.go} | 1 + .../armguestconfiguration/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 3 +- .../armguestconfiguration/go.mod | 14 +- .../armguestconfiguration/go.sum | 24 +- ...ent.go => hcrpassignmentreports_client.go} | 1 + ...ts_client.go => hcrpassignments_client.go} | 1 + .../{zz_generated_models.go => models.go} | 1 + .../armguestconfiguration/models_serde.go | 1067 +++++++++++++++++ ...rations_client.go => operations_client.go} | 1 + ...ed_response_types.go => response_types.go} | 1 + ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...figurationassignmentreports_client_test.go | 64 - ...rationassignmentreportsvmss_client_test.go | 68 -- ...estconfigurationassignments_client_test.go | 179 --- ...onfigurationassignmentsvmss_client_test.go | 89 -- ...rationhcrpassignmentreports_client_test.go | 64 - ...onfigurationhcrpassignments_client_test.go | 130 -- ...enerated_example_operations_client_test.go | 41 - .../zz_generated_models_serde.go | 359 ------ 24 files changed, 1092 insertions(+), 1030 deletions(-) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_assignmentreports_client.go => assignmentreports_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_assignmentreportsvmss_client.go => assignmentreportsvmss_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_assignments_client.go => assignments_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_assignmentsvmss_client.go => assignmentsvmss_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_hcrpassignmentreports_client.go => hcrpassignmentreports_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_hcrpassignments_client.go => hcrpassignments_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_models.go => models.go} (99%) create mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/models_serde.go rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_operations_client.go => operations_client.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_response_types.go => response_types.go} (99%) rename sdk/resourcemanager/guestconfiguration/armguestconfiguration/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreports_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreportsvmss_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignments_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentsvmss_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignmentreports_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignments_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/CHANGELOG.md b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/CHANGELOG.md index 63f0592f3751..f8e76505b07f 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/CHANGELOG.md +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2022-07-25) +### Other Changes + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration` 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/guestconfiguration/armguestconfiguration/zz_generated_assignmentreports_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentreports_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentreports_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentreports_client.go index 6ef0aed788a6..c0f1a73501e0 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentreports_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentreports_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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentreportsvmss_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentreportsvmss_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentreportsvmss_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentreportsvmss_client.go index 8b5f5360f87b..936eaf88c17d 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentreportsvmss_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentreportsvmss_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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignments_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignments_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignments_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignments_client.go index 46042c0addf6..3b59214cda2b 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignments_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignments_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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentsvmss_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentsvmss_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentsvmss_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentsvmss_client.go index 108c1b190041..c6664692a580 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_assignmentsvmss_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/assignmentsvmss_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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/autorest.md b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/autorest.md index 058f994cf6dc..05cc6d4aeeb6 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/autorest.md +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/guestconfiguration/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/guestconfiguration/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_constants.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/constants.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_constants.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/constants.go index b331a2497500..4b60a55cee39 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_constants.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armguestconfiguration const ( moduleName = "armguestconfiguration" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionAfterReboot - Specifies what happens after a reboot during the application of a configuration. The possible values diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/go.mod b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/go.mod index fb7574c3f37f..a5ca99a81d83 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/go.mod +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/ 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/guestconfiguration/armguestconfiguration/go.sum b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/go.sum +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/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/guestconfiguration/armguestconfiguration/zz_generated_hcrpassignmentreports_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/hcrpassignmentreports_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_hcrpassignmentreports_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/hcrpassignmentreports_client.go index 60e09c5a964d..26a82e6fa249 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_hcrpassignmentreports_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/hcrpassignmentreports_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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_hcrpassignments_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/hcrpassignments_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_hcrpassignments_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/hcrpassignments_client.go index f39f4e853b90..0e269a8e0243 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_hcrpassignments_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/hcrpassignments_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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_models.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/models.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_models.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/models.go index 105482fed828..c87754a0bca9 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_models.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/models_serde.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/models_serde.go new file mode 100644 index 000000000000..a3ebd3201346 --- /dev/null +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/models_serde.go @@ -0,0 +1,1067 @@ +//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 armguestconfiguration + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Assignment. +func (a Assignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Assignment. +func (a *Assignment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssignmentInfo. +func (a AssignmentInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", a.Configuration) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentInfo. +func (a *AssignmentInfo) UnmarshalJSON(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 "configuration": + err = unpopulate(val, "Configuration", &a.Configuration) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + 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 AssignmentList. +func (a AssignmentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentList. +func (a *AssignmentList) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssignmentProperties. +func (a AssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignmentHash", a.AssignmentHash) + populate(objectMap, "complianceStatus", a.ComplianceStatus) + populate(objectMap, "context", a.Context) + populate(objectMap, "guestConfiguration", a.GuestConfiguration) + populateTimeRFC3339(objectMap, "lastComplianceStatusChecked", a.LastComplianceStatusChecked) + populate(objectMap, "latestAssignmentReport", a.LatestAssignmentReport) + populate(objectMap, "latestReportId", a.LatestReportID) + populate(objectMap, "parameterHash", a.ParameterHash) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceType", a.ResourceType) + populate(objectMap, "targetResourceId", a.TargetResourceID) + populate(objectMap, "vmssVMList", a.VmssVMList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentProperties. +func (a *AssignmentProperties) UnmarshalJSON(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 "assignmentHash": + err = unpopulate(val, "AssignmentHash", &a.AssignmentHash) + delete(rawMsg, key) + case "complianceStatus": + err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) + delete(rawMsg, key) + case "context": + err = unpopulate(val, "Context", &a.Context) + delete(rawMsg, key) + case "guestConfiguration": + err = unpopulate(val, "GuestConfiguration", &a.GuestConfiguration) + delete(rawMsg, key) + case "lastComplianceStatusChecked": + err = unpopulateTimeRFC3339(val, "LastComplianceStatusChecked", &a.LastComplianceStatusChecked) + delete(rawMsg, key) + case "latestAssignmentReport": + err = unpopulate(val, "LatestAssignmentReport", &a.LatestAssignmentReport) + delete(rawMsg, key) + case "latestReportId": + err = unpopulate(val, "LatestReportID", &a.LatestReportID) + delete(rawMsg, key) + case "parameterHash": + err = unpopulate(val, "ParameterHash", &a.ParameterHash) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &a.ResourceType) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &a.TargetResourceID) + delete(rawMsg, key) + case "vmssVMList": + err = unpopulate(val, "VmssVMList", &a.VmssVMList) + 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 AssignmentReport. +func (a AssignmentReport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReport. +func (a *AssignmentReport) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssignmentReportDetails. +func (a AssignmentReportDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "complianceStatus", a.ComplianceStatus) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "jobId", a.JobID) + populate(objectMap, "operationType", a.OperationType) + populate(objectMap, "resources", a.Resources) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportDetails. +func (a *AssignmentReportDetails) UnmarshalJSON(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 "complianceStatus": + err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &a.JobID) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &a.OperationType) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &a.Resources) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) + 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 AssignmentReportList. +func (a AssignmentReportList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportList. +func (a *AssignmentReportList) UnmarshalJSON(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 "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssignmentReportProperties. +func (a AssignmentReportProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignment", a.Assignment) + populate(objectMap, "complianceStatus", a.ComplianceStatus) + populate(objectMap, "details", a.Details) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "reportId", a.ReportID) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "vm", a.VM) + populate(objectMap, "vmssResourceId", a.VmssResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportProperties. +func (a *AssignmentReportProperties) UnmarshalJSON(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 "assignment": + err = unpopulate(val, "Assignment", &a.Assignment) + delete(rawMsg, key) + case "complianceStatus": + err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "reportId": + err = unpopulate(val, "ReportID", &a.ReportID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + case "vm": + err = unpopulate(val, "VM", &a.VM) + delete(rawMsg, key) + case "vmssResourceId": + err = unpopulate(val, "VmssResourceID", &a.VmssResourceID) + 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 AssignmentReportResource. +func (a AssignmentReportResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "complianceStatus", a.ComplianceStatus) + populate(objectMap, "properties", &a.Properties) + populate(objectMap, "reasons", a.Reasons) + populate(objectMap, "resourceId", a.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportResource. +func (a *AssignmentReportResource) UnmarshalJSON(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 "complianceStatus": + err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "reasons": + err = unpopulate(val, "Reasons", &a.Reasons) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + 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 AssignmentReportResourceComplianceReason. +func (a AssignmentReportResourceComplianceReason) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", a.Code) + populate(objectMap, "phrase", a.Phrase) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportResourceComplianceReason. +func (a *AssignmentReportResourceComplianceReason) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "phrase": + err = unpopulate(val, "Phrase", &a.Phrase) + 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 CommonAssignmentReport. +func (c CommonAssignmentReport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignment", c.Assignment) + populate(objectMap, "complianceStatus", c.ComplianceStatus) + populateTimeRFC3339(objectMap, "endTime", c.EndTime) + populate(objectMap, "id", c.ID) + populate(objectMap, "operationType", c.OperationType) + populate(objectMap, "reportId", c.ReportID) + populate(objectMap, "resources", c.Resources) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) + populate(objectMap, "vm", c.VM) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonAssignmentReport. +func (c *CommonAssignmentReport) UnmarshalJSON(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 "assignment": + err = unpopulate(val, "Assignment", &c.Assignment) + delete(rawMsg, key) + case "complianceStatus": + err = unpopulate(val, "ComplianceStatus", &c.ComplianceStatus) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &c.EndTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &c.OperationType) + delete(rawMsg, key) + case "reportId": + err = unpopulate(val, "ReportID", &c.ReportID) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &c.Resources) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) + delete(rawMsg, key) + case "vm": + err = unpopulate(val, "VM", &c.VM) + 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 ConfigurationInfo. +func (c ConfigurationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationInfo. +func (c *ConfigurationInfo) UnmarshalJSON(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 "version": + err = unpopulate(val, "Version", &c.Version) + 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 ConfigurationParameter. +func (c ConfigurationParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationParameter. +func (c *ConfigurationParameter) UnmarshalJSON(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 "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 ConfigurationSetting. +func (c ConfigurationSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionAfterReboot", c.ActionAfterReboot) + populate(objectMap, "allowModuleOverwrite", c.AllowModuleOverwrite) + populate(objectMap, "configurationMode", c.ConfigurationMode) + populate(objectMap, "configurationModeFrequencyMins", c.ConfigurationModeFrequencyMins) + populate(objectMap, "rebootIfNeeded", c.RebootIfNeeded) + populate(objectMap, "refreshFrequencyMins", c.RefreshFrequencyMins) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationSetting. +func (c *ConfigurationSetting) UnmarshalJSON(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 "actionAfterReboot": + err = unpopulate(val, "ActionAfterReboot", &c.ActionAfterReboot) + delete(rawMsg, key) + case "allowModuleOverwrite": + err = unpopulate(val, "AllowModuleOverwrite", &c.AllowModuleOverwrite) + delete(rawMsg, key) + case "configurationMode": + err = unpopulate(val, "ConfigurationMode", &c.ConfigurationMode) + delete(rawMsg, key) + case "configurationModeFrequencyMins": + err = unpopulate(val, "ConfigurationModeFrequencyMins", &c.ConfigurationModeFrequencyMins) + delete(rawMsg, key) + case "rebootIfNeeded": + err = unpopulate(val, "RebootIfNeeded", &c.RebootIfNeeded) + delete(rawMsg, key) + case "refreshFrequencyMins": + err = unpopulate(val, "RefreshFrequencyMins", &c.RefreshFrequencyMins) + 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 ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseError. +func (e ErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseError. +func (e *ErrorResponseError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Navigation. +func (n Navigation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignmentSource", n.AssignmentSource) + populate(objectMap, "assignmentType", n.AssignmentType) + populate(objectMap, "configurationParameter", n.ConfigurationParameter) + populate(objectMap, "configurationProtectedParameter", n.ConfigurationProtectedParameter) + populate(objectMap, "configurationSetting", n.ConfigurationSetting) + populate(objectMap, "contentHash", n.ContentHash) + populate(objectMap, "contentType", n.ContentType) + populate(objectMap, "contentUri", n.ContentURI) + populate(objectMap, "kind", n.Kind) + populate(objectMap, "name", n.Name) + populate(objectMap, "version", n.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Navigation. +func (n *Navigation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignmentSource": + err = unpopulate(val, "AssignmentSource", &n.AssignmentSource) + delete(rawMsg, key) + case "assignmentType": + err = unpopulate(val, "AssignmentType", &n.AssignmentType) + delete(rawMsg, key) + case "configurationParameter": + err = unpopulate(val, "ConfigurationParameter", &n.ConfigurationParameter) + delete(rawMsg, key) + case "configurationProtectedParameter": + err = unpopulate(val, "ConfigurationProtectedParameter", &n.ConfigurationProtectedParameter) + delete(rawMsg, key) + case "configurationSetting": + err = unpopulate(val, "ConfigurationSetting", &n.ConfigurationSetting) + delete(rawMsg, key) + case "contentHash": + err = unpopulate(val, "ContentHash", &n.ContentHash) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, "ContentType", &n.ContentType) + delete(rawMsg, key) + case "contentUri": + err = unpopulate(val, "ContentURI", &n.ContentURI) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &n.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &n.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + 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 "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 OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. +func (o *OperationList) UnmarshalJSON(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 "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 OperationProperties. +func (o OperationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "statusCode", o.StatusCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationProperties. +func (o *OperationProperties) UnmarshalJSON(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 "statusCode": + err = unpopulate(val, "StatusCode", &o.StatusCode) + 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 ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMInfo. +func (v VMInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "uuid", v.UUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInfo. +func (v *VMInfo) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "uuid": + err = unpopulate(val, "UUID", &v.UUID) + 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 VMSSVMInfo. +func (v VMSSVMInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "complianceStatus", v.ComplianceStatus) + populateTimeRFC3339(objectMap, "lastComplianceChecked", v.LastComplianceChecked) + populate(objectMap, "latestReportId", v.LatestReportID) + populate(objectMap, "vmId", v.VMID) + populate(objectMap, "vmResourceId", v.VMResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMSSVMInfo. +func (v *VMSSVMInfo) UnmarshalJSON(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 "complianceStatus": + err = unpopulate(val, "ComplianceStatus", &v.ComplianceStatus) + delete(rawMsg, key) + case "lastComplianceChecked": + err = unpopulateTimeRFC3339(val, "LastComplianceChecked", &v.LastComplianceChecked) + delete(rawMsg, key) + case "latestReportId": + err = unpopulate(val, "LatestReportID", &v.LatestReportID) + delete(rawMsg, key) + case "vmId": + err = unpopulate(val, "VMID", &v.VMID) + delete(rawMsg, key) + case "vmResourceId": + err = unpopulate(val, "VMResourceID", &v.VMResourceID) + 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/guestconfiguration/armguestconfiguration/zz_generated_operations_client.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/operations_client.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_operations_client.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/operations_client.go index 23f31383674e..fd819367d7cd 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_operations_client.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_response_types.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/response_types.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_response_types.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/response_types.go index 79b444da5352..9251fc26afd0 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_response_types.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_time_rfc3339.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/guestconfiguration/armguestconfiguration/time_rfc3339.go index 448d935f9295..9e90df144412 100644 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/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 armguestconfiguration diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreports_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreports_client_test.go deleted file mode 100644 index aebdbd824d74..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreports_client_test.go +++ /dev/null @@ -1,64 +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 armguestconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json -func ExampleAssignmentReportsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentReportsClient("mySubscriptionid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "myResourceGroupName", - "AuditSecureProtocol", - "myVMName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json -func ExampleAssignmentReportsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentReportsClient("mySubscriptionid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroupName", - "AuditSecureProtocol", - "7367cbb8-ae99-47d0-a33b-a283564d2cb1", - "myvm", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreportsvmss_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreportsvmss_client_test.go deleted file mode 100644 index fb868506c157..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentreportsvmss_client_test.go +++ /dev/null @@ -1,68 +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 armguestconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json -func ExampleAssignmentReportsVMSSClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentReportsVMSSClient("mySubscriptionid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroupName", - "myVMSSName", - "AuditSecureProtocol", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json -func ExampleAssignmentReportsVMSSClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentReportsVMSSClient("mySubscriptionid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroupName", - "myvmss", - "AuditSecureProtocol", - "7367cbb8-ae99-47d0-a33b-a283564d2cb1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignments_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignments_client_test.go deleted file mode 100644 index af08163277d6..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignments_client_test.go +++ /dev/null @@ -1,179 +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 armguestconfiguration_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/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json -func ExampleAssignmentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "NotInstalledApplicationForWindows", - "myResourceGroupName", - "myVMName", - armguestconfiguration.Assignment{ - Name: to.Ptr("NotInstalledApplicationForWindows"), - Location: to.Ptr("westcentralus"), - Properties: &armguestconfiguration.AssignmentProperties{ - Context: to.Ptr("Azure policy"), - GuestConfiguration: &armguestconfiguration.Navigation{ - Name: to.Ptr("NotInstalledApplicationForWindows"), - AssignmentType: to.Ptr(armguestconfiguration.AssignmentTypeApplyAndAutoCorrect), - ConfigurationParameter: []*armguestconfiguration.ConfigurationParameter{ - { - Name: to.Ptr("[InstalledApplication]NotInstalledApplicationResource1;Name"), - Value: to.Ptr("NotePad,sql"), - }}, - ContentHash: to.Ptr("123contenthash"), - ContentURI: to.Ptr("https://thisisfake/pacakge"), - Version: to.Ptr("1.*"), - }, - }, - }, - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json -func ExampleAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroupName", - "SecureProtocol", - "myVMName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json -func ExampleAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myResourceGroupName", - "SecureProtocol", - "myVMName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listSubGuestConfigurationAssignments.json -func ExampleAssignmentsClient_NewSubscriptionListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewSubscriptionListPager(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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listRGGuestConfigurationAssignments.json -func ExampleAssignmentsClient_NewRGListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewRGListPager("myResourceGroupName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json -func ExampleAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroupName", - "myVMName", - 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/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentsvmss_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentsvmss_client_test.go deleted file mode 100644 index f1cfd280d866..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationassignmentsvmss_client_test.go +++ /dev/null @@ -1,89 +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 armguestconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json -func ExampleAssignmentsVMSSClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsVMSSClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroupName", - "myVMSSName", - "SecureProtocol", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json -func ExampleAssignmentsVMSSClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsVMSSClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, - "myResourceGroupName", - "myVMSSName", - "SecureProtocol", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json -func ExampleAssignmentsVMSSClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewAssignmentsVMSSClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroupName", - "myVMSSName", - 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/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignmentreports_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignmentreports_client_test.go deleted file mode 100644 index 9c894275ae7d..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignmentreports_client_test.go +++ /dev/null @@ -1,64 +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 armguestconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json -func ExampleHCRPAssignmentReportsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewHCRPAssignmentReportsClient("mySubscriptionid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "myResourceGroupName", - "AuditSecureProtocol", - "myMachineName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json -func ExampleHCRPAssignmentReportsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewHCRPAssignmentReportsClient("mySubscriptionid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroupName", - "AuditSecureProtocol", - "7367cbb8-ae99-47d0-a33b-a283564d2cb1", - "myMachineName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignments_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignments_client_test.go deleted file mode 100644 index bf5e4466efab..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_guestconfigurationhcrpassignments_client_test.go +++ /dev/null @@ -1,130 +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 armguestconfiguration_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/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json -func ExampleHCRPAssignmentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewHCRPAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "NotInstalledApplicationForWindows", - "myResourceGroupName", - "myMachineName", - armguestconfiguration.Assignment{ - Name: to.Ptr("NotInstalledApplicationForWindows"), - Location: to.Ptr("westcentralus"), - Properties: &armguestconfiguration.AssignmentProperties{ - Context: to.Ptr("Azure policy"), - GuestConfiguration: &armguestconfiguration.Navigation{ - Name: to.Ptr("NotInstalledApplicationForWindows"), - AssignmentType: to.Ptr(armguestconfiguration.AssignmentTypeApplyAndAutoCorrect), - ConfigurationParameter: []*armguestconfiguration.ConfigurationParameter{ - { - Name: to.Ptr("[InstalledApplication]NotInstalledApplicationResource1;Name"), - Value: to.Ptr("NotePad,sql"), - }}, - ContentHash: to.Ptr("123contenthash"), - ContentURI: to.Ptr("https://thisisfake/pacakge"), - Version: to.Ptr("1.*"), - }, - }, - }, - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json -func ExampleHCRPAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewHCRPAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroupName", - "SecureProtocol", - "myMachineName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json -func ExampleHCRPAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewHCRPAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myResourceGroupName", - "SecureProtocol", - "myMachineName", - 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/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json -func ExampleHCRPAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armguestconfiguration.NewHCRPAssignmentsClient("mySubscriptionId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroupName", - "myMachineName", - 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/guestconfiguration/armguestconfiguration/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/ze_generated_example_operations_client_test.go deleted file mode 100644 index 56bcbd5b59ad..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/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 armguestconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listOperations.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 := armguestconfiguration.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/guestconfiguration/armguestconfiguration/zz_generated_models_serde.go b/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_models_serde.go deleted file mode 100644 index afcc1690fc10..000000000000 --- a/sdk/resourcemanager/guestconfiguration/armguestconfiguration/zz_generated_models_serde.go +++ /dev/null @@ -1,359 +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 armguestconfiguration - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AssignmentProperties. -func (a AssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignmentHash", a.AssignmentHash) - populate(objectMap, "complianceStatus", a.ComplianceStatus) - populate(objectMap, "context", a.Context) - populate(objectMap, "guestConfiguration", a.GuestConfiguration) - populateTimeRFC3339(objectMap, "lastComplianceStatusChecked", a.LastComplianceStatusChecked) - populate(objectMap, "latestAssignmentReport", a.LatestAssignmentReport) - populate(objectMap, "latestReportId", a.LatestReportID) - populate(objectMap, "parameterHash", a.ParameterHash) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "resourceType", a.ResourceType) - populate(objectMap, "targetResourceId", a.TargetResourceID) - populate(objectMap, "vmssVMList", a.VmssVMList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentProperties. -func (a *AssignmentProperties) UnmarshalJSON(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 "assignmentHash": - err = unpopulate(val, "AssignmentHash", &a.AssignmentHash) - delete(rawMsg, key) - case "complianceStatus": - err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) - delete(rawMsg, key) - case "context": - err = unpopulate(val, "Context", &a.Context) - delete(rawMsg, key) - case "guestConfiguration": - err = unpopulate(val, "GuestConfiguration", &a.GuestConfiguration) - delete(rawMsg, key) - case "lastComplianceStatusChecked": - err = unpopulateTimeRFC3339(val, "LastComplianceStatusChecked", &a.LastComplianceStatusChecked) - delete(rawMsg, key) - case "latestAssignmentReport": - err = unpopulate(val, "LatestAssignmentReport", &a.LatestAssignmentReport) - delete(rawMsg, key) - case "latestReportId": - err = unpopulate(val, "LatestReportID", &a.LatestReportID) - delete(rawMsg, key) - case "parameterHash": - err = unpopulate(val, "ParameterHash", &a.ParameterHash) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &a.ResourceType) - delete(rawMsg, key) - case "targetResourceId": - err = unpopulate(val, "TargetResourceID", &a.TargetResourceID) - delete(rawMsg, key) - case "vmssVMList": - err = unpopulate(val, "VmssVMList", &a.VmssVMList) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportDetails. -func (a *AssignmentReportDetails) UnmarshalJSON(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 "complianceStatus": - err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) - delete(rawMsg, key) - case "jobId": - err = unpopulate(val, "JobID", &a.JobID) - delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &a.OperationType) - delete(rawMsg, key) - case "resources": - err = unpopulate(val, "Resources", &a.Resources) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentReportProperties. -func (a *AssignmentReportProperties) UnmarshalJSON(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 "assignment": - err = unpopulate(val, "Assignment", &a.Assignment) - delete(rawMsg, key) - case "complianceStatus": - err = unpopulate(val, "ComplianceStatus", &a.ComplianceStatus) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &a.Details) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) - delete(rawMsg, key) - case "reportId": - err = unpopulate(val, "ReportID", &a.ReportID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) - delete(rawMsg, key) - case "vm": - err = unpopulate(val, "VM", &a.VM) - delete(rawMsg, key) - case "vmssResourceId": - err = unpopulate(val, "VmssResourceID", &a.VmssResourceID) - 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 AssignmentReportResource. -func (a AssignmentReportResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "complianceStatus", a.ComplianceStatus) - populate(objectMap, "properties", &a.Properties) - populate(objectMap, "reasons", a.Reasons) - populate(objectMap, "resourceId", a.ResourceID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CommonAssignmentReport. -func (c CommonAssignmentReport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignment", c.Assignment) - populate(objectMap, "complianceStatus", c.ComplianceStatus) - populateTimeRFC3339(objectMap, "endTime", c.EndTime) - populate(objectMap, "id", c.ID) - populate(objectMap, "operationType", c.OperationType) - populate(objectMap, "reportId", c.ReportID) - populate(objectMap, "resources", c.Resources) - populateTimeRFC3339(objectMap, "startTime", c.StartTime) - populate(objectMap, "vm", c.VM) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CommonAssignmentReport. -func (c *CommonAssignmentReport) UnmarshalJSON(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 "assignment": - err = unpopulate(val, "Assignment", &c.Assignment) - delete(rawMsg, key) - case "complianceStatus": - err = unpopulate(val, "ComplianceStatus", &c.ComplianceStatus) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &c.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "operationType": - err = unpopulate(val, "OperationType", &c.OperationType) - delete(rawMsg, key) - case "reportId": - err = unpopulate(val, "ReportID", &c.ReportID) - delete(rawMsg, key) - case "resources": - err = unpopulate(val, "Resources", &c.Resources) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) - delete(rawMsg, key) - case "vm": - err = unpopulate(val, "VM", &c.VM) - 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 Navigation. -func (n Navigation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignmentSource", n.AssignmentSource) - populate(objectMap, "assignmentType", n.AssignmentType) - populate(objectMap, "configurationParameter", n.ConfigurationParameter) - populate(objectMap, "configurationProtectedParameter", n.ConfigurationProtectedParameter) - populate(objectMap, "configurationSetting", n.ConfigurationSetting) - populate(objectMap, "contentHash", n.ContentHash) - populate(objectMap, "contentType", n.ContentType) - populate(objectMap, "contentUri", n.ContentURI) - populate(objectMap, "kind", n.Kind) - populate(objectMap, "name", n.Name) - populate(objectMap, "version", n.Version) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VMSSVMInfo. -func (v VMSSVMInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "complianceStatus", v.ComplianceStatus) - populateTimeRFC3339(objectMap, "lastComplianceChecked", v.LastComplianceChecked) - populate(objectMap, "latestReportId", v.LatestReportID) - populate(objectMap, "vmId", v.VMID) - populate(objectMap, "vmResourceId", v.VMResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMSSVMInfo. -func (v *VMSSVMInfo) UnmarshalJSON(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 "complianceStatus": - err = unpopulate(val, "ComplianceStatus", &v.ComplianceStatus) - delete(rawMsg, key) - case "lastComplianceChecked": - err = unpopulateTimeRFC3339(val, "LastComplianceChecked", &v.LastComplianceChecked) - delete(rawMsg, key) - case "latestReportId": - err = unpopulate(val, "LatestReportID", &v.LatestReportID) - delete(rawMsg, key) - case "vmId": - err = unpopulate(val, "VMID", &v.VMID) - delete(rawMsg, key) - case "vmResourceId": - err = unpopulate(val, "VMResourceID", &v.VMResourceID) - 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 -}