From 391f7af02e32fc0f341620e4d11494f82958ccf6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 13 Oct 2022 08:54:22 +0000 Subject: [PATCH] CodeGen from PR 21099 in Azure/azure-rest-api-specs Merge a2df29c0b6d83761654cd80ee2c7068f9ca03120 into 3cc85e694a07ba8ea5d0f21cefef71205dc3846e --- .../billing/armbilling/CHANGELOG.md | 4 + ..._accounts_client.go => accounts_client.go} | 3 +- ...ed_address_client.go => address_client.go} | 1 + ...eements_client.go => agreements_client.go} | 2 +- .../billing/armbilling/autorest.md | 6 +- ..._client.go => availablebalances_client.go} | 1 + ...zz_generated_constants.go => constants.go} | 3 +- ...ustomers_client.go => customers_client.go} | 3 +- ...zz_generated_date_type.go => date_type.go} | 1 + ...client.go => enrollmentaccounts_client.go} | 2 +- sdk/resourcemanager/billing/armbilling/go.mod | 14 +- sdk/resourcemanager/billing/armbilling/go.sum | 24 +- ...tions_client.go => instructions_client.go} | 2 +- ..._invoices_client.go => invoices_client.go} | 4 +- ...ns_client.go => invoicesections_client.go} | 2 +- .../{zz_generated_models.go => models.go} | 1 + .../billing/armbilling/models_serde.go | 4257 +++++++++++++++++ ...rations_client.go => operations_client.go} | 2 +- ...ed_periods_client.go => periods_client.go} | 2 +- ...ssions_client.go => permissions_client.go} | 5 +- ..._policies_client.go => policies_client.go} | 1 + ..._products_client.go => products_client.go} | 5 +- ..._profiles_client.go => profiles_client.go} | 2 +- ..._property_client.go => property_client.go} | 1 + ...tions_client.go => reservations_client.go} | 3 +- ...ed_response_types.go => response_types.go} | 1 + ...ts_client.go => roleassignments_client.go} | 4 +- ...ns_client.go => roledefinitions_client.go} | 4 +- ...ions_client.go => subscriptions_client.go} | 5 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...tions_client.go => transactions_client.go} | 2 +- ...e_generated_example_address_client_test.go | 45 - ...enerated_example_agreements_client_test.go | 64 - ...d_example_availablebalances_client_test.go | 39 - ...ted_example_billingaccounts_client_test.go | 128 - ...ated_example_billingperiods_client_test.go | 65 - ..._example_billingpermissions_client_test.go | 121 - ...ted_example_billingprofiles_client_test.go | 114 - ...ted_example_billingproperty_client_test.go | 63 - ...mple_billingroleassignments_client_test.go | 233 - ...mple_billingroledefinitions_client_test.go | 164 - ...xample_billingsubscriptions_client_test.go | 221 - ...generated_example_customers_client_test.go | 94 - ..._example_enrollmentaccounts_client_test.go | 62 - ...erated_example_instructions_client_test.go | 99 - ..._generated_example_invoices_client_test.go | 231 - ...ted_example_invoicesections_client_test.go | 103 - ..._generated_example_policies_client_test.go | 118 - ..._generated_example_products_client_test.go | 221 - ...erated_example_reservations_client_test.go | 77 - ...erated_example_transactions_client_test.go | 43 - .../armbilling/zz_generated_models_serde.go | 984 ---- 52 files changed, 4297 insertions(+), 3360 deletions(-) rename sdk/resourcemanager/billing/armbilling/{zz_generated_accounts_client.go => accounts_client.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_address_client.go => address_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_agreements_client.go => agreements_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_availablebalances_client.go => availablebalances_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_constants.go => constants.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_customers_client.go => customers_client.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_date_type.go => date_type.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_enrollmentaccounts_client.go => enrollmentaccounts_client.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_instructions_client.go => instructions_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_invoices_client.go => invoices_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_invoicesections_client.go => invoicesections_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_models.go => models.go} (99%) create mode 100644 sdk/resourcemanager/billing/armbilling/models_serde.go rename sdk/resourcemanager/billing/armbilling/{zz_generated_operations_client.go => operations_client.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_periods_client.go => periods_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_permissions_client.go => permissions_client.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_policies_client.go => policies_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_products_client.go => products_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_profiles_client.go => profiles_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_property_client.go => property_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_reservations_client.go => reservations_client.go} (98%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_response_types.go => response_types.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_roleassignments_client.go => roleassignments_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_roledefinitions_client.go => roledefinitions_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_subscriptions_client.go => subscriptions_client.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) rename sdk/resourcemanager/billing/armbilling/{zz_generated_transactions_client.go => transactions_client.go} (98%) delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_address_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_agreements_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_availablebalances_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingaccounts_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingperiods_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingpermissions_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingprofiles_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingproperty_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroleassignments_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroledefinitions_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_billingsubscriptions_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_customers_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_enrollmentaccounts_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_instructions_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_invoices_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_invoicesections_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_policies_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_products_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_reservations_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/ze_generated_example_transactions_client_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/billing/armbilling/CHANGELOG.md b/sdk/resourcemanager/billing/armbilling/CHANGELOG.md index 2076d5780a2d..f41db57f1b08 100644 --- a/sdk/resourcemanager/billing/armbilling/CHANGELOG.md +++ b/sdk/resourcemanager/billing/armbilling/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.5.1 (2022-10-13) +### Other Changes + + ## 0.5.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_accounts_client.go b/sdk/resourcemanager/billing/armbilling/accounts_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_accounts_client.go rename to sdk/resourcemanager/billing/armbilling/accounts_client.go index d0aa1fced7ee..4bb26cc4814b 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/billing/armbilling/accounts_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 armbilling @@ -102,7 +103,6 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl } // NewListPager - Lists the billing accounts that a user has access to. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // options - AccountsClientListOptions contains the optional parameters for the AccountsClient.List method. func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { @@ -162,7 +162,6 @@ func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsC // NewListInvoiceSectionsByCreateSubscriptionPermissionPager - Lists the invoice sections for which the user has permission // to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer // Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - AccountsClientListInvoiceSectionsByCreateSubscriptionPermissionOptions contains the optional parameters for the diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_address_client.go b/sdk/resourcemanager/billing/armbilling/address_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_address_client.go rename to sdk/resourcemanager/billing/armbilling/address_client.go index 0b14edf34521..b2c5220e0ca7 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_address_client.go +++ b/sdk/resourcemanager/billing/armbilling/address_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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_agreements_client.go b/sdk/resourcemanager/billing/armbilling/agreements_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_agreements_client.go rename to sdk/resourcemanager/billing/armbilling/agreements_client.go index 474d292d62a8..71104a515cd2 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_agreements_client.go +++ b/sdk/resourcemanager/billing/armbilling/agreements_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 armbilling @@ -107,7 +108,6 @@ func (client *AgreementsClient) getHandleResponse(resp *http.Response) (Agreemen } // NewListByBillingAccountPager - Lists the agreements for a billing account. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - AgreementsClientListByBillingAccountOptions contains the optional parameters for the AgreementsClient.ListByBillingAccount diff --git a/sdk/resourcemanager/billing/armbilling/autorest.md b/sdk/resourcemanager/billing/armbilling/autorest.md index ec222875997d..21491b50d4ce 100644 --- a/sdk/resourcemanager/billing/armbilling/autorest.md +++ b/sdk/resourcemanager/billing/armbilling/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/billing/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/billing/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 0.5.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_availablebalances_client.go b/sdk/resourcemanager/billing/armbilling/availablebalances_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_availablebalances_client.go rename to sdk/resourcemanager/billing/armbilling/availablebalances_client.go index 9b1ea0a667da..314eb335daa8 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_availablebalances_client.go +++ b/sdk/resourcemanager/billing/armbilling/availablebalances_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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_constants.go b/sdk/resourcemanager/billing/armbilling/constants.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_constants.go rename to sdk/resourcemanager/billing/armbilling/constants.go index d84f3dc409e2..896bd7bdcfdd 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_constants.go +++ b/sdk/resourcemanager/billing/armbilling/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 armbilling const ( moduleName = "armbilling" - moduleVersion = "v0.5.0" + moduleVersion = "v0.5.1" ) // AcceptanceMode - The mode of acceptance for an agreement. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_customers_client.go b/sdk/resourcemanager/billing/armbilling/customers_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_customers_client.go rename to sdk/resourcemanager/billing/armbilling/customers_client.go index a95cc1526b60..af71df340b93 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_customers_client.go +++ b/sdk/resourcemanager/billing/armbilling/customers_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 armbilling @@ -109,7 +110,6 @@ func (client *CustomersClient) getHandleResponse(resp *http.Response) (Customers // NewListByBillingAccountPager - Lists the customers that are billed to a billing account. The operation is supported only // for billing accounts with agreement type Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - CustomersClientListByBillingAccountOptions contains the optional parameters for the CustomersClient.ListByBillingAccount @@ -177,7 +177,6 @@ func (client *CustomersClient) listByBillingAccountHandleResponse(resp *http.Res // NewListByBillingProfilePager - Lists the customers that are billed to a billing profile. The operation is supported only // for billing accounts with agreement type Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_date_type.go b/sdk/resourcemanager/billing/armbilling/date_type.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_date_type.go rename to sdk/resourcemanager/billing/armbilling/date_type.go index 3b98608f8a97..ac0950151604 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_date_type.go +++ b/sdk/resourcemanager/billing/armbilling/date_type.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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_enrollmentaccounts_client.go b/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_enrollmentaccounts_client.go rename to sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go index 7ce555a36472..9c383d1e7423 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_enrollmentaccounts_client.go +++ b/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_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 armbilling @@ -99,7 +100,6 @@ func (client *EnrollmentAccountsClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Lists the enrollment accounts the caller has access to. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2018-03-01-preview // options - EnrollmentAccountsClientListOptions contains the optional parameters for the EnrollmentAccountsClient.List method. func (client *EnrollmentAccountsClient) NewListPager(options *EnrollmentAccountsClientListOptions) *runtime.Pager[EnrollmentAccountsClientListResponse] { diff --git a/sdk/resourcemanager/billing/armbilling/go.mod b/sdk/resourcemanager/billing/armbilling/go.mod index 45e70e2dbdde..1d72d29d6277 100644 --- a/sdk/resourcemanager/billing/armbilling/go.mod +++ b/sdk/resourcemanager/billing/armbilling/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling 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/billing/armbilling/go.sum b/sdk/resourcemanager/billing/armbilling/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/billing/armbilling/go.sum +++ b/sdk/resourcemanager/billing/armbilling/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/billing/armbilling/zz_generated_instructions_client.go b/sdk/resourcemanager/billing/armbilling/instructions_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_instructions_client.go rename to sdk/resourcemanager/billing/armbilling/instructions_client.go index 5971dfbd4a27..abfa8ed38832 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_instructions_client.go +++ b/sdk/resourcemanager/billing/armbilling/instructions_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 armbilling @@ -109,7 +110,6 @@ func (client *InstructionsClient) getHandleResponse(resp *http.Response) (Instru } // NewListByBillingProfilePager - Lists the instructions by billing profile id. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_invoices_client.go b/sdk/resourcemanager/billing/armbilling/invoices_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_invoices_client.go rename to sdk/resourcemanager/billing/armbilling/invoices_client.go index 05c67c06a770..d63fac67716f 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_invoices_client.go +++ b/sdk/resourcemanager/billing/armbilling/invoices_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 armbilling @@ -456,7 +457,6 @@ func (client *InvoicesClient) getBySubscriptionAndInvoiceIDHandleResponse(resp * // NewListByBillingAccountPager - Lists the invoices for a billing account for a given start date and end date. The operation // is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer // Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // periodStartDate - The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. @@ -523,7 +523,6 @@ func (client *InvoicesClient) listByBillingAccountHandleResponse(resp *http.Resp // NewListByBillingProfilePager - Lists the invoices for a billing profile for a given start date and end date. The operation // is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer // Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. @@ -593,7 +592,6 @@ func (client *InvoicesClient) listByBillingProfileHandleResponse(resp *http.Resp } // NewListByBillingSubscriptionPager - Lists the invoices for a subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // periodStartDate - Invoice period start date. // periodEndDate - Invoice period end date. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_invoicesections_client.go b/sdk/resourcemanager/billing/armbilling/invoicesections_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_invoicesections_client.go rename to sdk/resourcemanager/billing/armbilling/invoicesections_client.go index 23bb5c38842d..635caaa00bb9 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_invoicesections_client.go +++ b/sdk/resourcemanager/billing/armbilling/invoicesections_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 armbilling @@ -178,7 +179,6 @@ func (client *InvoiceSectionsClient) getHandleResponse(resp *http.Response) (Inv // NewListByBillingProfilePager - Lists the invoice sections that a user has access to. The operation is supported only for // billing accounts with agreement type Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_models.go b/sdk/resourcemanager/billing/armbilling/models.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_models.go rename to sdk/resourcemanager/billing/armbilling/models.go index ebe22b2d42e1..2681960cdf02 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_models.go +++ b/sdk/resourcemanager/billing/armbilling/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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/models_serde.go b/sdk/resourcemanager/billing/armbilling/models_serde.go new file mode 100644 index 000000000000..b61caa06541c --- /dev/null +++ b/sdk/resourcemanager/billing/armbilling/models_serde.go @@ -0,0 +1,4257 @@ +//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 armbilling + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Account. +func (a *Account) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "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 AccountListResult. +func (a AccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountListResult. +func (a *AccountListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountProperties. +func (a AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountStatus", a.AccountStatus) + populate(objectMap, "accountType", a.AccountType) + populate(objectMap, "agreementType", a.AgreementType) + populate(objectMap, "billingProfiles", a.BillingProfiles) + populate(objectMap, "departments", a.Departments) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "enrollmentAccounts", a.EnrollmentAccounts) + populate(objectMap, "enrollmentDetails", a.EnrollmentDetails) + populate(objectMap, "hasReadAccess", a.HasReadAccess) + populate(objectMap, "notificationEmailAddress", a.NotificationEmailAddress) + populate(objectMap, "soldTo", a.SoldTo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountProperties. +func (a *AccountProperties) UnmarshalJSON(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 "accountStatus": + err = unpopulate(val, "AccountStatus", &a.AccountStatus) + delete(rawMsg, key) + case "accountType": + err = unpopulate(val, "AccountType", &a.AccountType) + delete(rawMsg, key) + case "agreementType": + err = unpopulate(val, "AgreementType", &a.AgreementType) + delete(rawMsg, key) + case "billingProfiles": + err = unpopulate(val, "BillingProfiles", &a.BillingProfiles) + delete(rawMsg, key) + case "departments": + err = unpopulate(val, "Departments", &a.Departments) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "enrollmentAccounts": + err = unpopulate(val, "EnrollmentAccounts", &a.EnrollmentAccounts) + delete(rawMsg, key) + case "enrollmentDetails": + err = unpopulate(val, "EnrollmentDetails", &a.EnrollmentDetails) + delete(rawMsg, key) + case "hasReadAccess": + err = unpopulate(val, "HasReadAccess", &a.HasReadAccess) + delete(rawMsg, key) + case "notificationEmailAddress": + err = unpopulate(val, "NotificationEmailAddress", &a.NotificationEmailAddress) + delete(rawMsg, key) + case "soldTo": + err = unpopulate(val, "SoldTo", &a.SoldTo) + 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 AccountUpdateRequest. +func (a AccountUpdateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountUpdateRequest. +func (a *AccountUpdateRequest) UnmarshalJSON(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 "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 AddressDetails. +func (a AddressDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addressLine1", a.AddressLine1) + populate(objectMap, "addressLine2", a.AddressLine2) + populate(objectMap, "addressLine3", a.AddressLine3) + populate(objectMap, "city", a.City) + populate(objectMap, "companyName", a.CompanyName) + populate(objectMap, "country", a.Country) + populate(objectMap, "district", a.District) + populate(objectMap, "email", a.Email) + populate(objectMap, "firstName", a.FirstName) + populate(objectMap, "lastName", a.LastName) + populate(objectMap, "middleName", a.MiddleName) + populate(objectMap, "phoneNumber", a.PhoneNumber) + populate(objectMap, "postalCode", a.PostalCode) + populate(objectMap, "region", a.Region) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AddressDetails. +func (a *AddressDetails) UnmarshalJSON(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 "addressLine1": + err = unpopulate(val, "AddressLine1", &a.AddressLine1) + delete(rawMsg, key) + case "addressLine2": + err = unpopulate(val, "AddressLine2", &a.AddressLine2) + delete(rawMsg, key) + case "addressLine3": + err = unpopulate(val, "AddressLine3", &a.AddressLine3) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &a.City) + delete(rawMsg, key) + case "companyName": + err = unpopulate(val, "CompanyName", &a.CompanyName) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &a.Country) + delete(rawMsg, key) + case "district": + err = unpopulate(val, "District", &a.District) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &a.Email) + delete(rawMsg, key) + case "firstName": + err = unpopulate(val, "FirstName", &a.FirstName) + delete(rawMsg, key) + case "lastName": + err = unpopulate(val, "LastName", &a.LastName) + delete(rawMsg, key) + case "middleName": + err = unpopulate(val, "MiddleName", &a.MiddleName) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &a.PhoneNumber) + delete(rawMsg, key) + case "postalCode": + err = unpopulate(val, "PostalCode", &a.PostalCode) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &a.Region) + 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 Agreement. +func (a Agreement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Agreement. +func (a *Agreement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "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 AgreementListResult. +func (a AgreementListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgreementListResult. +func (a *AgreementListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AgreementProperties. +func (a AgreementProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "acceptanceMode", a.AcceptanceMode) + populate(objectMap, "agreementLink", a.AgreementLink) + populate(objectMap, "billingProfileInfo", a.BillingProfileInfo) + populate(objectMap, "category", a.Category) + populateTimeRFC3339(objectMap, "effectiveDate", a.EffectiveDate) + populateTimeRFC3339(objectMap, "expirationDate", a.ExpirationDate) + populate(objectMap, "participants", a.Participants) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgreementProperties. +func (a *AgreementProperties) UnmarshalJSON(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 "acceptanceMode": + err = unpopulate(val, "AcceptanceMode", &a.AcceptanceMode) + delete(rawMsg, key) + case "agreementLink": + err = unpopulate(val, "AgreementLink", &a.AgreementLink) + delete(rawMsg, key) + case "billingProfileInfo": + err = unpopulate(val, "BillingProfileInfo", &a.BillingProfileInfo) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "effectiveDate": + err = unpopulateTimeRFC3339(val, "EffectiveDate", &a.EffectiveDate) + delete(rawMsg, key) + case "expirationDate": + err = unpopulateTimeRFC3339(val, "ExpirationDate", &a.ExpirationDate) + delete(rawMsg, key) + case "participants": + err = unpopulate(val, "Participants", &a.Participants) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Amount. +func (a Amount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currency", a.Currency) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Amount. +func (a *Amount) UnmarshalJSON(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 "currency": + err = unpopulate(val, "Currency", &a.Currency) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableBalance. +func (a AvailableBalance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableBalance. +func (a *AvailableBalance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "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 AvailableBalanceProperties. +func (a AvailableBalanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", a.Amount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableBalanceProperties. +func (a *AvailableBalanceProperties) UnmarshalJSON(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 "amount": + err = unpopulate(val, "Amount", &a.Amount) + 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 AzurePlan. +func (a AzurePlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "skuDescription", a.SKUDescription) + populate(objectMap, "skuId", a.SKUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzurePlan. +func (a *AzurePlan) UnmarshalJSON(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 "skuDescription": + err = unpopulate(val, "SKUDescription", &a.SKUDescription) + delete(rawMsg, key) + case "skuId": + err = unpopulate(val, "SKUID", &a.SKUID) + 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 Customer. +func (c Customer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Customer. +func (c *Customer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerListResult. +func (c CustomerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "totalCount", c.TotalCount) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerListResult. +func (c *CustomerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &c.TotalCount) + 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 CustomerPolicy. +func (c CustomerPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerPolicy. +func (c *CustomerPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerPolicyProperties. +func (c CustomerPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "viewCharges", c.ViewCharges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerPolicyProperties. +func (c *CustomerPolicyProperties) UnmarshalJSON(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 "viewCharges": + err = unpopulate(val, "ViewCharges", &c.ViewCharges) + 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 CustomerProperties. +func (c CustomerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingProfileDisplayName", c.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", c.BillingProfileID) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "enabledAzurePlans", c.EnabledAzurePlans) + populate(objectMap, "resellers", c.Resellers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerProperties. +func (c *CustomerProperties) UnmarshalJSON(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 "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &c.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &c.BillingProfileID) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "enabledAzurePlans": + err = unpopulate(val, "EnabledAzurePlans", &c.EnabledAzurePlans) + delete(rawMsg, key) + case "resellers": + err = unpopulate(val, "Resellers", &c.Resellers) + 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 Department. +func (d Department) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Department. +func (d *Department) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DepartmentProperties. +func (d DepartmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "costCenter", d.CostCenter) + populate(objectMap, "departmentName", d.DepartmentName) + populate(objectMap, "enrollmentAccounts", d.EnrollmentAccounts) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DepartmentProperties. +func (d *DepartmentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "costCenter": + err = unpopulate(val, "CostCenter", &d.CostCenter) + delete(rawMsg, key) + case "departmentName": + err = unpopulate(val, "DepartmentName", &d.DepartmentName) + delete(rawMsg, key) + case "enrollmentAccounts": + err = unpopulate(val, "EnrollmentAccounts", &d.EnrollmentAccounts) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Document. +func (d Document) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "source", d.Source) + populate(objectMap, "url", d.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Document. +func (d *Document) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &d.Source) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &d.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DownloadURL. +func (d DownloadURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expiryTime", d.ExpiryTime) + populate(objectMap, "url", d.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. +func (d *DownloadURL) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &d.ExpiryTime) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &d.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Enrollment. +func (e Enrollment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingCycle", e.BillingCycle) + populate(objectMap, "channel", e.Channel) + populate(objectMap, "countryCode", e.CountryCode) + populate(objectMap, "currency", e.Currency) + populateTimeRFC3339(objectMap, "endDate", e.EndDate) + populate(objectMap, "language", e.Language) + populate(objectMap, "policies", e.Policies) + populateTimeRFC3339(objectMap, "startDate", e.StartDate) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Enrollment. +func (e *Enrollment) UnmarshalJSON(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 "billingCycle": + err = unpopulate(val, "BillingCycle", &e.BillingCycle) + delete(rawMsg, key) + case "channel": + err = unpopulate(val, "Channel", &e.Channel) + delete(rawMsg, key) + case "countryCode": + err = unpopulate(val, "CountryCode", &e.CountryCode) + delete(rawMsg, key) + case "currency": + err = unpopulate(val, "Currency", &e.Currency) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &e.EndDate) + delete(rawMsg, key) + case "language": + err = unpopulate(val, "Language", &e.Language) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &e.Policies) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &e.StartDate) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + 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 EnrollmentAccount. +func (e EnrollmentAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccount. +func (e *EnrollmentAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrollmentAccountContext. +func (e EnrollmentAccountContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "costCenter", e.CostCenter) + populateTimeRFC3339(objectMap, "endDate", e.EndDate) + populate(objectMap, "enrollmentAccountName", e.EnrollmentAccountName) + populateTimeRFC3339(objectMap, "startDate", e.StartDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountContext. +func (e *EnrollmentAccountContext) UnmarshalJSON(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 "costCenter": + err = unpopulate(val, "CostCenter", &e.CostCenter) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &e.EndDate) + delete(rawMsg, key) + case "enrollmentAccountName": + err = unpopulate(val, "EnrollmentAccountName", &e.EnrollmentAccountName) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &e.StartDate) + 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 EnrollmentAccountListResult. +func (e EnrollmentAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountListResult. +func (e *EnrollmentAccountListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrollmentAccountProperties. +func (e EnrollmentAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountName", e.AccountName) + populate(objectMap, "accountOwner", e.AccountOwner) + populate(objectMap, "accountOwnerEmail", e.AccountOwnerEmail) + populate(objectMap, "costCenter", e.CostCenter) + populate(objectMap, "department", e.Department) + populateTimeRFC3339(objectMap, "endDate", e.EndDate) + populateTimeRFC3339(objectMap, "startDate", e.StartDate) + populate(objectMap, "status", e.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountProperties. +func (e *EnrollmentAccountProperties) UnmarshalJSON(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 "accountName": + err = unpopulate(val, "AccountName", &e.AccountName) + delete(rawMsg, key) + case "accountOwner": + err = unpopulate(val, "AccountOwner", &e.AccountOwner) + delete(rawMsg, key) + case "accountOwnerEmail": + err = unpopulate(val, "AccountOwnerEmail", &e.AccountOwnerEmail) + delete(rawMsg, key) + case "costCenter": + err = unpopulate(val, "CostCenter", &e.CostCenter) + delete(rawMsg, key) + case "department": + err = unpopulate(val, "Department", &e.Department) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &e.EndDate) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &e.StartDate) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + 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 EnrollmentAccountSummary. +func (e EnrollmentAccountSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountSummary. +func (e *EnrollmentAccountSummary) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrollmentAccountSummaryProperties. +func (e EnrollmentAccountSummaryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalName", e.PrincipalName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountSummaryProperties. +func (e *EnrollmentAccountSummaryProperties) UnmarshalJSON(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 "principalName": + err = unpopulate(val, "PrincipalName", &e.PrincipalName) + 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 EnrollmentPolicies. +func (e EnrollmentPolicies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountOwnerViewCharges", e.AccountOwnerViewCharges) + populate(objectMap, "departmentAdminViewCharges", e.DepartmentAdminViewCharges) + populate(objectMap, "marketplaceEnabled", e.MarketplaceEnabled) + populate(objectMap, "reservedInstancesEnabled", e.ReservedInstancesEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentPolicies. +func (e *EnrollmentPolicies) UnmarshalJSON(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 "accountOwnerViewCharges": + err = unpopulate(val, "AccountOwnerViewCharges", &e.AccountOwnerViewCharges) + delete(rawMsg, key) + case "departmentAdminViewCharges": + err = unpopulate(val, "DepartmentAdminViewCharges", &e.DepartmentAdminViewCharges) + delete(rawMsg, key) + case "marketplaceEnabled": + err = unpopulate(val, "MarketplaceEnabled", &e.MarketplaceEnabled) + delete(rawMsg, key) + case "reservedInstancesEnabled": + err = unpopulate(val, "ReservedInstancesEnabled", &e.ReservedInstancesEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetails. +func (e ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetails. +func (e *ErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 ErrorSubDetailsItem. +func (e ErrorSubDetailsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorSubDetailsItem. +func (e *ErrorSubDetailsItem) UnmarshalJSON(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) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IndirectRelationshipInfo. +func (i IndirectRelationshipInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingAccountName", i.BillingAccountName) + populate(objectMap, "billingProfileName", i.BillingProfileName) + populate(objectMap, "displayName", i.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IndirectRelationshipInfo. +func (i *IndirectRelationshipInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingAccountName": + err = unpopulate(val, "BillingAccountName", &i.BillingAccountName) + delete(rawMsg, key) + case "billingProfileName": + err = unpopulate(val, "BillingProfileName", &i.BillingProfileName) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Instruction. +func (i Instruction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Instruction. +func (i *Instruction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstructionListResult. +func (i InstructionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstructionListResult. +func (i *InstructionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstructionProperties. +func (i InstructionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", i.Amount) + populateTimeRFC3339(objectMap, "creationDate", i.CreationDate) + populateTimeRFC3339(objectMap, "endDate", i.EndDate) + populateTimeRFC3339(objectMap, "startDate", i.StartDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstructionProperties. +func (i *InstructionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amount": + err = unpopulate(val, "Amount", &i.Amount) + delete(rawMsg, key) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &i.CreationDate) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &i.EndDate) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &i.StartDate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Invoice. +func (i Invoice) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Invoice. +func (i *Invoice) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceListResult. +func (i InvoiceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "totalCount", i.TotalCount) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceListResult. +func (i *InvoiceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &i.TotalCount) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceProperties. +func (i InvoiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amountDue", i.AmountDue) + populate(objectMap, "azurePrepaymentApplied", i.AzurePrepaymentApplied) + populate(objectMap, "billedAmount", i.BilledAmount) + populate(objectMap, "billedDocumentId", i.BilledDocumentID) + populate(objectMap, "billingProfileDisplayName", i.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", i.BillingProfileID) + populate(objectMap, "creditAmount", i.CreditAmount) + populate(objectMap, "creditForDocumentId", i.CreditForDocumentID) + populate(objectMap, "documentType", i.DocumentType) + populate(objectMap, "documents", i.Documents) + populateTimeRFC3339(objectMap, "dueDate", i.DueDate) + populate(objectMap, "freeAzureCreditApplied", i.FreeAzureCreditApplied) + populateTimeRFC3339(objectMap, "invoiceDate", i.InvoiceDate) + populateTimeRFC3339(objectMap, "invoicePeriodEndDate", i.InvoicePeriodEndDate) + populateTimeRFC3339(objectMap, "invoicePeriodStartDate", i.InvoicePeriodStartDate) + populate(objectMap, "invoiceType", i.InvoiceType) + populate(objectMap, "isMonthlyInvoice", i.IsMonthlyInvoice) + populate(objectMap, "payments", i.Payments) + populate(objectMap, "purchaseOrderNumber", i.PurchaseOrderNumber) + populate(objectMap, "rebillDetails", i.RebillDetails) + populate(objectMap, "status", i.Status) + populate(objectMap, "subTotal", i.SubTotal) + populate(objectMap, "subscriptionId", i.SubscriptionID) + populate(objectMap, "taxAmount", i.TaxAmount) + populate(objectMap, "totalAmount", i.TotalAmount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceProperties. +func (i *InvoiceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "amountDue": + err = unpopulate(val, "AmountDue", &i.AmountDue) + delete(rawMsg, key) + case "azurePrepaymentApplied": + err = unpopulate(val, "AzurePrepaymentApplied", &i.AzurePrepaymentApplied) + delete(rawMsg, key) + case "billedAmount": + err = unpopulate(val, "BilledAmount", &i.BilledAmount) + delete(rawMsg, key) + case "billedDocumentId": + err = unpopulate(val, "BilledDocumentID", &i.BilledDocumentID) + delete(rawMsg, key) + case "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &i.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &i.BillingProfileID) + delete(rawMsg, key) + case "creditAmount": + err = unpopulate(val, "CreditAmount", &i.CreditAmount) + delete(rawMsg, key) + case "creditForDocumentId": + err = unpopulate(val, "CreditForDocumentID", &i.CreditForDocumentID) + delete(rawMsg, key) + case "documentType": + err = unpopulate(val, "DocumentType", &i.DocumentType) + delete(rawMsg, key) + case "documents": + err = unpopulate(val, "Documents", &i.Documents) + delete(rawMsg, key) + case "dueDate": + err = unpopulateTimeRFC3339(val, "DueDate", &i.DueDate) + delete(rawMsg, key) + case "freeAzureCreditApplied": + err = unpopulate(val, "FreeAzureCreditApplied", &i.FreeAzureCreditApplied) + delete(rawMsg, key) + case "invoiceDate": + err = unpopulateTimeRFC3339(val, "InvoiceDate", &i.InvoiceDate) + delete(rawMsg, key) + case "invoicePeriodEndDate": + err = unpopulateTimeRFC3339(val, "InvoicePeriodEndDate", &i.InvoicePeriodEndDate) + delete(rawMsg, key) + case "invoicePeriodStartDate": + err = unpopulateTimeRFC3339(val, "InvoicePeriodStartDate", &i.InvoicePeriodStartDate) + delete(rawMsg, key) + case "invoiceType": + err = unpopulate(val, "InvoiceType", &i.InvoiceType) + delete(rawMsg, key) + case "isMonthlyInvoice": + err = unpopulate(val, "IsMonthlyInvoice", &i.IsMonthlyInvoice) + delete(rawMsg, key) + case "payments": + err = unpopulate(val, "Payments", &i.Payments) + delete(rawMsg, key) + case "purchaseOrderNumber": + err = unpopulate(val, "PurchaseOrderNumber", &i.PurchaseOrderNumber) + delete(rawMsg, key) + case "rebillDetails": + err = unpopulate(val, "RebillDetails", &i.RebillDetails) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "subTotal": + err = unpopulate(val, "SubTotal", &i.SubTotal) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &i.SubscriptionID) + delete(rawMsg, key) + case "taxAmount": + err = unpopulate(val, "TaxAmount", &i.TaxAmount) + delete(rawMsg, key) + case "totalAmount": + err = unpopulate(val, "TotalAmount", &i.TotalAmount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSection. +func (i InvoiceSection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSection. +func (i *InvoiceSection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionCreationRequest. +func (i InvoiceSectionCreationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", i.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSectionCreationRequest. +func (i *InvoiceSectionCreationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionListResult. +func (i InvoiceSectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "totalCount", i.TotalCount) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSectionListResult. +func (i *InvoiceSectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &i.TotalCount) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionListWithCreateSubPermissionResult. +func (i InvoiceSectionListWithCreateSubPermissionResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSectionListWithCreateSubPermissionResult. +func (i *InvoiceSectionListWithCreateSubPermissionResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionProperties. +func (i InvoiceSectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "labels", i.Labels) + populate(objectMap, "state", i.State) + populate(objectMap, "systemId", i.SystemID) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "targetCloud", i.TargetCloud) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSectionProperties. +func (i *InvoiceSectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &i.Labels) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &i.State) + delete(rawMsg, key) + case "systemId": + err = unpopulate(val, "SystemID", &i.SystemID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "targetCloud": + err = unpopulate(val, "TargetCloud", &i.TargetCloud) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionWithCreateSubPermission. +func (i InvoiceSectionWithCreateSubPermission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingProfileDisplayName", i.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", i.BillingProfileID) + populate(objectMap, "billingProfileSpendingLimit", i.BillingProfileSpendingLimit) + populate(objectMap, "billingProfileStatus", i.BillingProfileStatus) + populate(objectMap, "billingProfileStatusReasonCode", i.BillingProfileStatusReasonCode) + populate(objectMap, "billingProfileSystemId", i.BillingProfileSystemID) + populate(objectMap, "enabledAzurePlans", i.EnabledAzurePlans) + populate(objectMap, "invoiceSectionDisplayName", i.InvoiceSectionDisplayName) + populate(objectMap, "invoiceSectionId", i.InvoiceSectionID) + populate(objectMap, "invoiceSectionSystemId", i.InvoiceSectionSystemID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSectionWithCreateSubPermission. +func (i *InvoiceSectionWithCreateSubPermission) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &i.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &i.BillingProfileID) + delete(rawMsg, key) + case "billingProfileSpendingLimit": + err = unpopulate(val, "BillingProfileSpendingLimit", &i.BillingProfileSpendingLimit) + delete(rawMsg, key) + case "billingProfileStatus": + err = unpopulate(val, "BillingProfileStatus", &i.BillingProfileStatus) + delete(rawMsg, key) + case "billingProfileStatusReasonCode": + err = unpopulate(val, "BillingProfileStatusReasonCode", &i.BillingProfileStatusReasonCode) + delete(rawMsg, key) + case "billingProfileSystemId": + err = unpopulate(val, "BillingProfileSystemID", &i.BillingProfileSystemID) + delete(rawMsg, key) + case "enabledAzurePlans": + err = unpopulate(val, "EnabledAzurePlans", &i.EnabledAzurePlans) + delete(rawMsg, key) + case "invoiceSectionDisplayName": + err = unpopulate(val, "InvoiceSectionDisplayName", &i.InvoiceSectionDisplayName) + delete(rawMsg, key) + case "invoiceSectionId": + err = unpopulate(val, "InvoiceSectionID", &i.InvoiceSectionID) + delete(rawMsg, key) + case "invoiceSectionSystemId": + err = unpopulate(val, "InvoiceSectionSystemID", &i.InvoiceSectionSystemID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionsOnExpand. +func (i InvoiceSectionsOnExpand) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hasMoreResults", i.HasMoreResults) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceSectionsOnExpand. +func (i *InvoiceSectionsOnExpand) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hasMoreResults": + err = unpopulate(val, "HasMoreResults", &i.HasMoreResults) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsErrorDetails. +func (o OperationsErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) + populate(objectMap, "target", o.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsErrorDetails. +func (o *OperationsErrorDetails) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &o.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &o.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &o.Target) + 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 OperationsErrorResponse. +func (o OperationsErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", o.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsErrorResponse. +func (o *OperationsErrorResponse) UnmarshalJSON(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 "error": + err = unpopulate(val, "Error", &o.Error) + 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 Participants. +func (p Participants) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "email", p.Email) + populate(objectMap, "status", p.Status) + populateTimeRFC3339(objectMap, "statusDate", p.StatusDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Participants. +func (p *Participants) UnmarshalJSON(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 "email": + err = unpopulate(val, "Email", &p.Email) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "statusDate": + err = unpopulateTimeRFC3339(val, "StatusDate", &p.StatusDate) + 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 PaymentProperties. +func (p PaymentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "amount", p.Amount) + populateTimeRFC3339(objectMap, "date", p.Date) + populate(objectMap, "paymentMethodFamily", p.PaymentMethodFamily) + populate(objectMap, "paymentMethodType", p.PaymentMethodType) + populate(objectMap, "paymentType", p.PaymentType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PaymentProperties. +func (p *PaymentProperties) UnmarshalJSON(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 "amount": + err = unpopulate(val, "Amount", &p.Amount) + delete(rawMsg, key) + case "date": + err = unpopulateTimeRFC3339(val, "Date", &p.Date) + delete(rawMsg, key) + case "paymentMethodFamily": + err = unpopulate(val, "PaymentMethodFamily", &p.PaymentMethodFamily) + delete(rawMsg, key) + case "paymentMethodType": + err = unpopulate(val, "PaymentMethodType", &p.PaymentMethodType) + delete(rawMsg, key) + case "paymentType": + err = unpopulate(val, "PaymentType", &p.PaymentType) + 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 Period. +func (p Period) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Period. +func (p *Period) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeriodProperties. +func (p PeriodProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateDateType(objectMap, "billingPeriodEndDate", p.BillingPeriodEndDate) + populateDateType(objectMap, "billingPeriodStartDate", p.BillingPeriodStartDate) + populate(objectMap, "invoiceIds", p.InvoiceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodProperties. +func (p *PeriodProperties) UnmarshalJSON(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 "billingPeriodEndDate": + err = unpopulateDateType(val, "BillingPeriodEndDate", &p.BillingPeriodEndDate) + delete(rawMsg, key) + case "billingPeriodStartDate": + err = unpopulateDateType(val, "BillingPeriodStartDate", &p.BillingPeriodStartDate) + delete(rawMsg, key) + case "invoiceIds": + err = unpopulate(val, "InvoiceIDs", &p.InvoiceIDs) + 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 PeriodsListResult. +func (p PeriodsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodsListResult. +func (p *PeriodsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PermissionsListResult. +func (p PermissionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionsListResult. +func (p *PermissionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PermissionsProperties. +func (p PermissionsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", p.Actions) + populate(objectMap, "notActions", p.NotActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionsProperties. +func (p *PermissionsProperties) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &p.Actions) + delete(rawMsg, key) + case "notActions": + err = unpopulate(val, "NotActions", &p.NotActions) + 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 Policy. +func (p Policy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Policy. +func (p *Policy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyProperties. +func (p PolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "marketplacePurchases", p.MarketplacePurchases) + populate(objectMap, "reservationPurchases", p.ReservationPurchases) + populate(objectMap, "viewCharges", p.ViewCharges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyProperties. +func (p *PolicyProperties) UnmarshalJSON(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 "marketplacePurchases": + err = unpopulate(val, "MarketplacePurchases", &p.MarketplacePurchases) + delete(rawMsg, key) + case "reservationPurchases": + err = unpopulate(val, "ReservationPurchases", &p.ReservationPurchases) + delete(rawMsg, key) + case "viewCharges": + err = unpopulate(val, "ViewCharges", &p.ViewCharges) + 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 Product. +func (p Product) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Product. +func (p *Product) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProductProperties. +func (p ProductProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoRenew", p.AutoRenew) + populate(objectMap, "availabilityId", p.AvailabilityID) + populate(objectMap, "billingFrequency", p.BillingFrequency) + populate(objectMap, "billingProfileDisplayName", p.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", p.BillingProfileID) + populate(objectMap, "customerDisplayName", p.CustomerDisplayName) + populate(objectMap, "customerId", p.CustomerID) + populate(objectMap, "displayName", p.DisplayName) + populateTimeRFC3339(objectMap, "endDate", p.EndDate) + populate(objectMap, "invoiceSectionDisplayName", p.InvoiceSectionDisplayName) + populate(objectMap, "invoiceSectionId", p.InvoiceSectionID) + populate(objectMap, "lastCharge", p.LastCharge) + populateTimeRFC3339(objectMap, "lastChargeDate", p.LastChargeDate) + populate(objectMap, "productType", p.ProductType) + populate(objectMap, "productTypeId", p.ProductTypeID) + populateTimeRFC3339(objectMap, "purchaseDate", p.PurchaseDate) + populate(objectMap, "quantity", p.Quantity) + populate(objectMap, "reseller", p.Reseller) + populate(objectMap, "skuDescription", p.SKUDescription) + populate(objectMap, "skuId", p.SKUID) + populate(objectMap, "status", p.Status) + populate(objectMap, "tenantId", p.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductProperties. +func (p *ProductProperties) UnmarshalJSON(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 "autoRenew": + err = unpopulate(val, "AutoRenew", &p.AutoRenew) + delete(rawMsg, key) + case "availabilityId": + err = unpopulate(val, "AvailabilityID", &p.AvailabilityID) + delete(rawMsg, key) + case "billingFrequency": + err = unpopulate(val, "BillingFrequency", &p.BillingFrequency) + delete(rawMsg, key) + case "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &p.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &p.BillingProfileID) + delete(rawMsg, key) + case "customerDisplayName": + err = unpopulate(val, "CustomerDisplayName", &p.CustomerDisplayName) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &p.CustomerID) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &p.EndDate) + delete(rawMsg, key) + case "invoiceSectionDisplayName": + err = unpopulate(val, "InvoiceSectionDisplayName", &p.InvoiceSectionDisplayName) + delete(rawMsg, key) + case "invoiceSectionId": + err = unpopulate(val, "InvoiceSectionID", &p.InvoiceSectionID) + delete(rawMsg, key) + case "lastCharge": + err = unpopulate(val, "LastCharge", &p.LastCharge) + delete(rawMsg, key) + case "lastChargeDate": + err = unpopulateTimeRFC3339(val, "LastChargeDate", &p.LastChargeDate) + delete(rawMsg, key) + case "productType": + err = unpopulate(val, "ProductType", &p.ProductType) + delete(rawMsg, key) + case "productTypeId": + err = unpopulate(val, "ProductTypeID", &p.ProductTypeID) + delete(rawMsg, key) + case "purchaseDate": + err = unpopulateTimeRFC3339(val, "PurchaseDate", &p.PurchaseDate) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &p.Quantity) + delete(rawMsg, key) + case "reseller": + err = unpopulate(val, "Reseller", &p.Reseller) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, "SKUDescription", &p.SKUDescription) + delete(rawMsg, key) + case "skuId": + err = unpopulate(val, "SKUID", &p.SKUID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &p.TenantID) + 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 ProductsListResult. +func (p ProductsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "totalCount", p.TotalCount) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductsListResult. +func (p *ProductsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &p.TotalCount) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Profile. +func (p *Profile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProfileCreationRequest. +func (p ProfileCreationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billTo", p.BillTo) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "enabledAzurePlans", p.EnabledAzurePlans) + populate(objectMap, "invoiceEmailOptIn", p.InvoiceEmailOptIn) + populate(objectMap, "poNumber", p.PoNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileCreationRequest. +func (p *ProfileCreationRequest) UnmarshalJSON(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 "billTo": + err = unpopulate(val, "BillTo", &p.BillTo) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "enabledAzurePlans": + err = unpopulate(val, "EnabledAzurePlans", &p.EnabledAzurePlans) + delete(rawMsg, key) + case "invoiceEmailOptIn": + err = unpopulate(val, "InvoiceEmailOptIn", &p.InvoiceEmailOptIn) + delete(rawMsg, key) + case "poNumber": + err = unpopulate(val, "PoNumber", &p.PoNumber) + 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 ProfileInfo. +func (p ProfileInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingProfileDisplayName", p.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", p.BillingProfileID) + populate(objectMap, "indirectRelationshipOrganizationName", p.IndirectRelationshipOrganizationName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileInfo. +func (p *ProfileInfo) UnmarshalJSON(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 "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &p.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &p.BillingProfileID) + delete(rawMsg, key) + case "indirectRelationshipOrganizationName": + err = unpopulate(val, "IndirectRelationshipOrganizationName", &p.IndirectRelationshipOrganizationName) + 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 ProfileListResult. +func (p ProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "totalCount", p.TotalCount) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileListResult. +func (p *ProfileListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &p.TotalCount) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProfileProperties. +func (p ProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billTo", p.BillTo) + populate(objectMap, "billingRelationshipType", p.BillingRelationshipType) + populate(objectMap, "currency", p.Currency) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "enabledAzurePlans", p.EnabledAzurePlans) + populate(objectMap, "hasReadAccess", p.HasReadAccess) + populate(objectMap, "indirectRelationshipInfo", p.IndirectRelationshipInfo) + populate(objectMap, "invoiceDay", p.InvoiceDay) + populate(objectMap, "invoiceEmailOptIn", p.InvoiceEmailOptIn) + populate(objectMap, "invoiceSections", p.InvoiceSections) + populate(objectMap, "poNumber", p.PoNumber) + populate(objectMap, "spendingLimit", p.SpendingLimit) + populate(objectMap, "status", p.Status) + populate(objectMap, "statusReasonCode", p.StatusReasonCode) + populate(objectMap, "systemId", p.SystemID) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "targetClouds", p.TargetClouds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfileProperties. +func (p *ProfileProperties) UnmarshalJSON(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 "billTo": + err = unpopulate(val, "BillTo", &p.BillTo) + delete(rawMsg, key) + case "billingRelationshipType": + err = unpopulate(val, "BillingRelationshipType", &p.BillingRelationshipType) + delete(rawMsg, key) + case "currency": + err = unpopulate(val, "Currency", &p.Currency) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "enabledAzurePlans": + err = unpopulate(val, "EnabledAzurePlans", &p.EnabledAzurePlans) + delete(rawMsg, key) + case "hasReadAccess": + err = unpopulate(val, "HasReadAccess", &p.HasReadAccess) + delete(rawMsg, key) + case "indirectRelationshipInfo": + err = unpopulate(val, "IndirectRelationshipInfo", &p.IndirectRelationshipInfo) + delete(rawMsg, key) + case "invoiceDay": + err = unpopulate(val, "InvoiceDay", &p.InvoiceDay) + delete(rawMsg, key) + case "invoiceEmailOptIn": + err = unpopulate(val, "InvoiceEmailOptIn", &p.InvoiceEmailOptIn) + delete(rawMsg, key) + case "invoiceSections": + err = unpopulate(val, "InvoiceSections", &p.InvoiceSections) + delete(rawMsg, key) + case "poNumber": + err = unpopulate(val, "PoNumber", &p.PoNumber) + delete(rawMsg, key) + case "spendingLimit": + err = unpopulate(val, "SpendingLimit", &p.SpendingLimit) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + case "statusReasonCode": + err = unpopulate(val, "StatusReasonCode", &p.StatusReasonCode) + delete(rawMsg, key) + case "systemId": + err = unpopulate(val, "SystemID", &p.SystemID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "targetClouds": + err = unpopulate(val, "TargetClouds", &p.TargetClouds) + 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 ProfilesOnExpand. +func (p ProfilesOnExpand) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hasMoreResults", p.HasMoreResults) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProfilesOnExpand. +func (p *ProfilesOnExpand) UnmarshalJSON(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 "hasMoreResults": + err = unpopulate(val, "HasMoreResults", &p.HasMoreResults) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Property. +func (p Property) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Property. +func (p *Property) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyProperties. +func (p PropertyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountAdminNotificationEmailAddress", p.AccountAdminNotificationEmailAddress) + populate(objectMap, "billingAccountDisplayName", p.BillingAccountDisplayName) + populate(objectMap, "billingAccountId", p.BillingAccountID) + populate(objectMap, "billingProfileDisplayName", p.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", p.BillingProfileID) + populate(objectMap, "billingProfileSpendingLimit", p.BillingProfileSpendingLimit) + populate(objectMap, "billingProfileStatus", p.BillingProfileStatus) + populate(objectMap, "billingProfileStatusReasonCode", p.BillingProfileStatusReasonCode) + populate(objectMap, "billingTenantId", p.BillingTenantID) + populate(objectMap, "costCenter", p.CostCenter) + populate(objectMap, "invoiceSectionDisplayName", p.InvoiceSectionDisplayName) + populate(objectMap, "invoiceSectionId", p.InvoiceSectionID) + populate(objectMap, "isAccountAdmin", p.IsAccountAdmin) + populate(objectMap, "productId", p.ProductID) + populate(objectMap, "productName", p.ProductName) + populate(objectMap, "skuDescription", p.SKUDescription) + populate(objectMap, "skuId", p.SKUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyProperties. +func (p *PropertyProperties) UnmarshalJSON(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 "accountAdminNotificationEmailAddress": + err = unpopulate(val, "AccountAdminNotificationEmailAddress", &p.AccountAdminNotificationEmailAddress) + delete(rawMsg, key) + case "billingAccountDisplayName": + err = unpopulate(val, "BillingAccountDisplayName", &p.BillingAccountDisplayName) + delete(rawMsg, key) + case "billingAccountId": + err = unpopulate(val, "BillingAccountID", &p.BillingAccountID) + delete(rawMsg, key) + case "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &p.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &p.BillingProfileID) + delete(rawMsg, key) + case "billingProfileSpendingLimit": + err = unpopulate(val, "BillingProfileSpendingLimit", &p.BillingProfileSpendingLimit) + delete(rawMsg, key) + case "billingProfileStatus": + err = unpopulate(val, "BillingProfileStatus", &p.BillingProfileStatus) + delete(rawMsg, key) + case "billingProfileStatusReasonCode": + err = unpopulate(val, "BillingProfileStatusReasonCode", &p.BillingProfileStatusReasonCode) + delete(rawMsg, key) + case "billingTenantId": + err = unpopulate(val, "BillingTenantID", &p.BillingTenantID) + delete(rawMsg, key) + case "costCenter": + err = unpopulate(val, "CostCenter", &p.CostCenter) + delete(rawMsg, key) + case "invoiceSectionDisplayName": + err = unpopulate(val, "InvoiceSectionDisplayName", &p.InvoiceSectionDisplayName) + delete(rawMsg, key) + case "invoiceSectionId": + err = unpopulate(val, "InvoiceSectionID", &p.InvoiceSectionID) + delete(rawMsg, key) + case "isAccountAdmin": + err = unpopulate(val, "IsAccountAdmin", &p.IsAccountAdmin) + delete(rawMsg, key) + case "productId": + err = unpopulate(val, "ProductID", &p.ProductID) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &p.ProductName) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, "SKUDescription", &p.SKUDescription) + delete(rawMsg, key) + case "skuId": + err = unpopulate(val, "SKUID", &p.SKUID) + 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 RebillDetails. +func (r RebillDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "creditNoteDocumentId", r.CreditNoteDocumentID) + populate(objectMap, "invoiceDocumentId", r.InvoiceDocumentID) + populate(objectMap, "rebillDetails", r.RebillDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RebillDetails. +func (r *RebillDetails) UnmarshalJSON(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 "creditNoteDocumentId": + err = unpopulate(val, "CreditNoteDocumentID", &r.CreditNoteDocumentID) + delete(rawMsg, key) + case "invoiceDocumentId": + err = unpopulate(val, "InvoiceDocumentID", &r.InvoiceDocumentID) + delete(rawMsg, key) + case "rebillDetails": + err = unpopulate(val, "RebillDetails", &r.RebillDetails) + 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 Reseller. +func (r Reseller) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", r.Description) + populate(objectMap, "resellerId", r.ResellerID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Reseller. +func (r *Reseller) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "resellerId": + err = unpopulate(val, "ResellerID", &r.ResellerID) + 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 Reservation. +func (r Reservation) 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, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Reservation. +func (r *Reservation) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) + 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 ReservationProperty. +func (r ReservationProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appliedScopeType", r.AppliedScopeType) + populate(objectMap, "appliedScopes", r.AppliedScopes) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "displayProvisioningState", r.DisplayProvisioningState) + populate(objectMap, "effectiveDateTime", r.EffectiveDateTime) + populate(objectMap, "expiryDate", r.ExpiryDate) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "provisioningSubState", r.ProvisioningSubState) + populate(objectMap, "quantity", r.Quantity) + populate(objectMap, "renew", r.Renew) + populate(objectMap, "renewSource", r.RenewSource) + populate(objectMap, "reservedResourceType", r.ReservedResourceType) + populate(objectMap, "skuDescription", r.SKUDescription) + populate(objectMap, "term", r.Term) + populate(objectMap, "userFriendlyAppliedScopeType", r.UserFriendlyAppliedScopeType) + populate(objectMap, "userFriendlyRenewState", r.UserFriendlyRenewState) + populate(objectMap, "utilization", r.Utilization) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationProperty. +func (r *ReservationProperty) UnmarshalJSON(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 "appliedScopeType": + err = unpopulate(val, "AppliedScopeType", &r.AppliedScopeType) + delete(rawMsg, key) + case "appliedScopes": + err = unpopulate(val, "AppliedScopes", &r.AppliedScopes) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "displayProvisioningState": + err = unpopulate(val, "DisplayProvisioningState", &r.DisplayProvisioningState) + delete(rawMsg, key) + case "effectiveDateTime": + err = unpopulate(val, "EffectiveDateTime", &r.EffectiveDateTime) + delete(rawMsg, key) + case "expiryDate": + err = unpopulate(val, "ExpiryDate", &r.ExpiryDate) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "provisioningSubState": + err = unpopulate(val, "ProvisioningSubState", &r.ProvisioningSubState) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &r.Quantity) + delete(rawMsg, key) + case "renew": + err = unpopulate(val, "Renew", &r.Renew) + delete(rawMsg, key) + case "renewSource": + err = unpopulate(val, "RenewSource", &r.RenewSource) + delete(rawMsg, key) + case "reservedResourceType": + err = unpopulate(val, "ReservedResourceType", &r.ReservedResourceType) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, "SKUDescription", &r.SKUDescription) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &r.Term) + delete(rawMsg, key) + case "userFriendlyAppliedScopeType": + err = unpopulate(val, "UserFriendlyAppliedScopeType", &r.UserFriendlyAppliedScopeType) + delete(rawMsg, key) + case "userFriendlyRenewState": + err = unpopulate(val, "UserFriendlyRenewState", &r.UserFriendlyRenewState) + delete(rawMsg, key) + case "utilization": + err = unpopulate(val, "Utilization", &r.Utilization) + 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 ReservationPropertyUtilization. +func (r ReservationPropertyUtilization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregates", r.Aggregates) + populate(objectMap, "trend", r.Trend) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationPropertyUtilization. +func (r *ReservationPropertyUtilization) UnmarshalJSON(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 "aggregates": + err = unpopulate(val, "Aggregates", &r.Aggregates) + delete(rawMsg, key) + case "trend": + err = unpopulate(val, "Trend", &r.Trend) + 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 ReservationSKUProperty. +func (r ReservationSKUProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSKUProperty. +func (r *ReservationSKUProperty) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &r.Name) + 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 ReservationSummary. +func (r ReservationSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cancelledCount", r.CancelledCount) + populate(objectMap, "expiredCount", r.ExpiredCount) + populate(objectMap, "expiringCount", r.ExpiringCount) + populate(objectMap, "failedCount", r.FailedCount) + populate(objectMap, "pendingCount", r.PendingCount) + populate(objectMap, "succeededCount", r.SucceededCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationSummary. +func (r *ReservationSummary) UnmarshalJSON(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 "cancelledCount": + err = unpopulate(val, "CancelledCount", &r.CancelledCount) + delete(rawMsg, key) + case "expiredCount": + err = unpopulate(val, "ExpiredCount", &r.ExpiredCount) + delete(rawMsg, key) + case "expiringCount": + err = unpopulate(val, "ExpiringCount", &r.ExpiringCount) + delete(rawMsg, key) + case "failedCount": + err = unpopulate(val, "FailedCount", &r.FailedCount) + delete(rawMsg, key) + case "pendingCount": + err = unpopulate(val, "PendingCount", &r.PendingCount) + delete(rawMsg, key) + case "succeededCount": + err = unpopulate(val, "SucceededCount", &r.SucceededCount) + 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 ReservationUtilizationAggregates. +func (r ReservationUtilizationAggregates) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "grain", r.Grain) + populate(objectMap, "grainUnit", r.GrainUnit) + populate(objectMap, "value", r.Value) + populate(objectMap, "valueUnit", r.ValueUnit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationUtilizationAggregates. +func (r *ReservationUtilizationAggregates) UnmarshalJSON(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 "grain": + err = unpopulate(val, "Grain", &r.Grain) + delete(rawMsg, key) + case "grainUnit": + err = unpopulate(val, "GrainUnit", &r.GrainUnit) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + case "valueUnit": + err = unpopulate(val, "ValueUnit", &r.ValueUnit) + 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 ReservationsListResult. +func (r ReservationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "summary", r.Summary) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReservationsListResult. +func (r *ReservationsListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "summary": + err = unpopulate(val, "Summary", &r.Summary) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "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 "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 RoleAssignment. +func (r RoleAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignment. +func (r *RoleAssignment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + 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 RoleAssignmentListResult. +func (r RoleAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentListResult. +func (r *RoleAssignmentListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 RoleAssignmentProperties. +func (r RoleAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdByPrincipalId", r.CreatedByPrincipalID) + populate(objectMap, "createdByPrincipalTenantId", r.CreatedByPrincipalTenantID) + populate(objectMap, "createdByUserEmailAddress", r.CreatedByUserEmailAddress) + populate(objectMap, "createdOn", r.CreatedOn) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalTenantId", r.PrincipalTenantID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "userAuthenticationType", r.UserAuthenticationType) + populate(objectMap, "userEmailAddress", r.UserEmailAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentProperties. +func (r *RoleAssignmentProperties) UnmarshalJSON(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 "createdByPrincipalId": + err = unpopulate(val, "CreatedByPrincipalID", &r.CreatedByPrincipalID) + delete(rawMsg, key) + case "createdByPrincipalTenantId": + err = unpopulate(val, "CreatedByPrincipalTenantID", &r.CreatedByPrincipalTenantID) + delete(rawMsg, key) + case "createdByUserEmailAddress": + err = unpopulate(val, "CreatedByUserEmailAddress", &r.CreatedByUserEmailAddress) + delete(rawMsg, key) + case "createdOn": + err = unpopulate(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalTenantId": + err = unpopulate(val, "PrincipalTenantID", &r.PrincipalTenantID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "userAuthenticationType": + err = unpopulate(val, "UserAuthenticationType", &r.UserAuthenticationType) + delete(rawMsg, key) + case "userEmailAddress": + err = unpopulate(val, "UserEmailAddress", &r.UserEmailAddress) + 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 RoleDefinition. +func (r RoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinition. +func (r *RoleDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + 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 RoleDefinitionListResult. +func (r RoleDefinitionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionListResult. +func (r *RoleDefinitionListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 RoleDefinitionProperties. +func (r RoleDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", r.Description) + populate(objectMap, "permissions", r.Permissions) + populate(objectMap, "roleName", r.RoleName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionProperties. +func (r *RoleDefinitionProperties) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &r.Permissions) + delete(rawMsg, key) + case "roleName": + err = unpopulate(val, "RoleName", &r.RoleName) + 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 Subscription. +func (s Subscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Subscription. +func (s *Subscription) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionProperties. +func (s SubscriptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingProfileDisplayName", s.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", s.BillingProfileID) + populate(objectMap, "costCenter", s.CostCenter) + populate(objectMap, "customerDisplayName", s.CustomerDisplayName) + populate(objectMap, "customerId", s.CustomerID) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "invoiceSectionDisplayName", s.InvoiceSectionDisplayName) + populate(objectMap, "invoiceSectionId", s.InvoiceSectionID) + populate(objectMap, "lastMonthCharges", s.LastMonthCharges) + populate(objectMap, "monthToDateCharges", s.MonthToDateCharges) + populate(objectMap, "reseller", s.Reseller) + populate(objectMap, "skuDescription", s.SKUDescription) + populate(objectMap, "skuId", s.SKUID) + populate(objectMap, "subscriptionBillingStatus", s.SubscriptionBillingStatus) + populate(objectMap, "subscriptionId", s.SubscriptionID) + populate(objectMap, "suspensionReasons", s.SuspensionReasons) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionProperties. +func (s *SubscriptionProperties) UnmarshalJSON(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 "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &s.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &s.BillingProfileID) + delete(rawMsg, key) + case "costCenter": + err = unpopulate(val, "CostCenter", &s.CostCenter) + delete(rawMsg, key) + case "customerDisplayName": + err = unpopulate(val, "CustomerDisplayName", &s.CustomerDisplayName) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &s.CustomerID) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "invoiceSectionDisplayName": + err = unpopulate(val, "InvoiceSectionDisplayName", &s.InvoiceSectionDisplayName) + delete(rawMsg, key) + case "invoiceSectionId": + err = unpopulate(val, "InvoiceSectionID", &s.InvoiceSectionID) + delete(rawMsg, key) + case "lastMonthCharges": + err = unpopulate(val, "LastMonthCharges", &s.LastMonthCharges) + delete(rawMsg, key) + case "monthToDateCharges": + err = unpopulate(val, "MonthToDateCharges", &s.MonthToDateCharges) + delete(rawMsg, key) + case "reseller": + err = unpopulate(val, "Reseller", &s.Reseller) + delete(rawMsg, key) + case "skuDescription": + err = unpopulate(val, "SKUDescription", &s.SKUDescription) + delete(rawMsg, key) + case "skuId": + err = unpopulate(val, "SKUID", &s.SKUID) + delete(rawMsg, key) + case "subscriptionBillingStatus": + err = unpopulate(val, "SubscriptionBillingStatus", &s.SubscriptionBillingStatus) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &s.SubscriptionID) + delete(rawMsg, key) + case "suspensionReasons": + err = unpopulate(val, "SuspensionReasons", &s.SuspensionReasons) + 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 SubscriptionsListResult. +func (s SubscriptionsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "totalCount", s.TotalCount) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionsListResult. +func (s *SubscriptionsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &s.TotalCount) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Transaction. +func (t Transaction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Transaction. +func (t *Transaction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TransactionListResult. +func (t TransactionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "totalCount", t.TotalCount) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransactionListResult. +func (t *TransactionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &t.TotalCount) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TransactionProperties. +func (t TransactionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureCreditApplied", t.AzureCreditApplied) + populate(objectMap, "azurePlan", t.AzurePlan) + populate(objectMap, "billingCurrency", t.BillingCurrency) + populate(objectMap, "billingProfileDisplayName", t.BillingProfileDisplayName) + populate(objectMap, "billingProfileId", t.BillingProfileID) + populate(objectMap, "customerDisplayName", t.CustomerDisplayName) + populate(objectMap, "customerId", t.CustomerID) + populateTimeRFC3339(objectMap, "date", t.Date) + populate(objectMap, "discount", t.Discount) + populate(objectMap, "effectivePrice", t.EffectivePrice) + populate(objectMap, "exchangeRate", t.ExchangeRate) + populate(objectMap, "invoice", t.Invoice) + populate(objectMap, "invoiceId", t.InvoiceID) + populate(objectMap, "invoiceSectionDisplayName", t.InvoiceSectionDisplayName) + populate(objectMap, "invoiceSectionId", t.InvoiceSectionID) + populate(objectMap, "kind", t.Kind) + populate(objectMap, "marketPrice", t.MarketPrice) + populate(objectMap, "orderId", t.OrderID) + populate(objectMap, "orderName", t.OrderName) + populate(objectMap, "pricingCurrency", t.PricingCurrency) + populate(objectMap, "productDescription", t.ProductDescription) + populate(objectMap, "productFamily", t.ProductFamily) + populate(objectMap, "productType", t.ProductType) + populate(objectMap, "productTypeId", t.ProductTypeID) + populate(objectMap, "quantity", t.Quantity) + populateTimeRFC3339(objectMap, "servicePeriodEndDate", t.ServicePeriodEndDate) + populateTimeRFC3339(objectMap, "servicePeriodStartDate", t.ServicePeriodStartDate) + populate(objectMap, "subTotal", t.SubTotal) + populate(objectMap, "subscriptionId", t.SubscriptionID) + populate(objectMap, "subscriptionName", t.SubscriptionName) + populate(objectMap, "tax", t.Tax) + populate(objectMap, "transactionAmount", t.TransactionAmount) + populate(objectMap, "transactionType", t.TransactionType) + populate(objectMap, "unitOfMeasure", t.UnitOfMeasure) + populate(objectMap, "unitType", t.UnitType) + populate(objectMap, "units", t.Units) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransactionProperties. +func (t *TransactionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureCreditApplied": + err = unpopulate(val, "AzureCreditApplied", &t.AzureCreditApplied) + delete(rawMsg, key) + case "azurePlan": + err = unpopulate(val, "AzurePlan", &t.AzurePlan) + delete(rawMsg, key) + case "billingCurrency": + err = unpopulate(val, "BillingCurrency", &t.BillingCurrency) + delete(rawMsg, key) + case "billingProfileDisplayName": + err = unpopulate(val, "BillingProfileDisplayName", &t.BillingProfileDisplayName) + delete(rawMsg, key) + case "billingProfileId": + err = unpopulate(val, "BillingProfileID", &t.BillingProfileID) + delete(rawMsg, key) + case "customerDisplayName": + err = unpopulate(val, "CustomerDisplayName", &t.CustomerDisplayName) + delete(rawMsg, key) + case "customerId": + err = unpopulate(val, "CustomerID", &t.CustomerID) + delete(rawMsg, key) + case "date": + err = unpopulateTimeRFC3339(val, "Date", &t.Date) + delete(rawMsg, key) + case "discount": + err = unpopulate(val, "Discount", &t.Discount) + delete(rawMsg, key) + case "effectivePrice": + err = unpopulate(val, "EffectivePrice", &t.EffectivePrice) + delete(rawMsg, key) + case "exchangeRate": + err = unpopulate(val, "ExchangeRate", &t.ExchangeRate) + delete(rawMsg, key) + case "invoice": + err = unpopulate(val, "Invoice", &t.Invoice) + delete(rawMsg, key) + case "invoiceId": + err = unpopulate(val, "InvoiceID", &t.InvoiceID) + delete(rawMsg, key) + case "invoiceSectionDisplayName": + err = unpopulate(val, "InvoiceSectionDisplayName", &t.InvoiceSectionDisplayName) + delete(rawMsg, key) + case "invoiceSectionId": + err = unpopulate(val, "InvoiceSectionID", &t.InvoiceSectionID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "marketPrice": + err = unpopulate(val, "MarketPrice", &t.MarketPrice) + delete(rawMsg, key) + case "orderId": + err = unpopulate(val, "OrderID", &t.OrderID) + delete(rawMsg, key) + case "orderName": + err = unpopulate(val, "OrderName", &t.OrderName) + delete(rawMsg, key) + case "pricingCurrency": + err = unpopulate(val, "PricingCurrency", &t.PricingCurrency) + delete(rawMsg, key) + case "productDescription": + err = unpopulate(val, "ProductDescription", &t.ProductDescription) + delete(rawMsg, key) + case "productFamily": + err = unpopulate(val, "ProductFamily", &t.ProductFamily) + delete(rawMsg, key) + case "productType": + err = unpopulate(val, "ProductType", &t.ProductType) + delete(rawMsg, key) + case "productTypeId": + err = unpopulate(val, "ProductTypeID", &t.ProductTypeID) + delete(rawMsg, key) + case "quantity": + err = unpopulate(val, "Quantity", &t.Quantity) + delete(rawMsg, key) + case "servicePeriodEndDate": + err = unpopulateTimeRFC3339(val, "ServicePeriodEndDate", &t.ServicePeriodEndDate) + delete(rawMsg, key) + case "servicePeriodStartDate": + err = unpopulateTimeRFC3339(val, "ServicePeriodStartDate", &t.ServicePeriodStartDate) + delete(rawMsg, key) + case "subTotal": + err = unpopulate(val, "SubTotal", &t.SubTotal) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &t.SubscriptionID) + delete(rawMsg, key) + case "subscriptionName": + err = unpopulate(val, "SubscriptionName", &t.SubscriptionName) + delete(rawMsg, key) + case "tax": + err = unpopulate(val, "Tax", &t.Tax) + delete(rawMsg, key) + case "transactionAmount": + err = unpopulate(val, "TransactionAmount", &t.TransactionAmount) + delete(rawMsg, key) + case "transactionType": + err = unpopulate(val, "TransactionType", &t.TransactionType) + delete(rawMsg, key) + case "unitOfMeasure": + err = unpopulate(val, "UnitOfMeasure", &t.UnitOfMeasure) + delete(rawMsg, key) + case "unitType": + err = unpopulate(val, "UnitType", &t.UnitType) + delete(rawMsg, key) + case "units": + err = unpopulate(val, "Units", &t.Units) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TransferBillingSubscriptionRequestProperties. +func (t TransferBillingSubscriptionRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationInvoiceSectionId", t.DestinationInvoiceSectionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransferBillingSubscriptionRequestProperties. +func (t *TransferBillingSubscriptionRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationInvoiceSectionId": + err = unpopulate(val, "DestinationInvoiceSectionID", &t.DestinationInvoiceSectionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TransferProductRequestProperties. +func (t TransferProductRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationInvoiceSectionId", t.DestinationInvoiceSectionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransferProductRequestProperties. +func (t *TransferProductRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationInvoiceSectionId": + err = unpopulate(val, "DestinationInvoiceSectionID", &t.DestinationInvoiceSectionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidateAddressResponse. +func (v ValidateAddressResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", v.Status) + populate(objectMap, "suggestedAddresses", v.SuggestedAddresses) + populate(objectMap, "validationMessage", v.ValidationMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateAddressResponse. +func (v *ValidateAddressResponse) UnmarshalJSON(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 "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + case "suggestedAddresses": + err = unpopulate(val, "SuggestedAddresses", &v.SuggestedAddresses) + delete(rawMsg, key) + case "validationMessage": + err = unpopulate(val, "ValidationMessage", &v.ValidationMessage) + 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 ValidateProductTransferEligibilityError. +func (v ValidateProductTransferEligibilityError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", v.Code) + populate(objectMap, "details", v.Details) + populate(objectMap, "message", v.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateProductTransferEligibilityError. +func (v *ValidateProductTransferEligibilityError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &v.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &v.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &v.Message) + 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 ValidateProductTransferEligibilityResult. +func (v ValidateProductTransferEligibilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorDetails", v.ErrorDetails) + populate(objectMap, "isMoveEligible", v.IsMoveEligible) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateProductTransferEligibilityResult. +func (v *ValidateProductTransferEligibilityResult) UnmarshalJSON(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 "errorDetails": + err = unpopulate(val, "ErrorDetails", &v.ErrorDetails) + delete(rawMsg, key) + case "isMoveEligible": + err = unpopulate(val, "IsMoveEligible", &v.IsMoveEligible) + 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 ValidateSubscriptionTransferEligibilityError. +func (v ValidateSubscriptionTransferEligibilityError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", v.Code) + populate(objectMap, "details", v.Details) + populate(objectMap, "message", v.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateSubscriptionTransferEligibilityError. +func (v *ValidateSubscriptionTransferEligibilityError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &v.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &v.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &v.Message) + 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 ValidateSubscriptionTransferEligibilityResult. +func (v ValidateSubscriptionTransferEligibilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorDetails", v.ErrorDetails) + populate(objectMap, "isMoveEligible", v.IsMoveEligible) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateSubscriptionTransferEligibilityResult. +func (v *ValidateSubscriptionTransferEligibilityResult) UnmarshalJSON(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 "errorDetails": + err = unpopulate(val, "ErrorDetails", &v.ErrorDetails) + delete(rawMsg, key) + case "isMoveEligible": + err = unpopulate(val, "IsMoveEligible", &v.IsMoveEligible) + 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/billing/armbilling/zz_generated_operations_client.go b/sdk/resourcemanager/billing/armbilling/operations_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_operations_client.go rename to sdk/resourcemanager/billing/armbilling/operations_client.go index d73bba008543..39ce06fde74e 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_operations_client.go +++ b/sdk/resourcemanager/billing/armbilling/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 armbilling @@ -49,7 +50,6 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists the available billing REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_periods_client.go b/sdk/resourcemanager/billing/armbilling/periods_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_periods_client.go rename to sdk/resourcemanager/billing/armbilling/periods_client.go index 9431aaa466f7..5e5d04062297 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_periods_client.go +++ b/sdk/resourcemanager/billing/armbilling/periods_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 armbilling @@ -111,7 +112,6 @@ func (client *PeriodsClient) getHandleResponse(resp *http.Response) (PeriodsClie // NewListPager - Lists the available billing periods for a subscription in reverse chronological order. This is only supported // for Azure Web-Direct subscriptions. Other subscription types which were not purchased // directly through the Azure web portal are not supported through this preview API. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2018-03-01-preview // options - PeriodsClientListOptions contains the optional parameters for the PeriodsClient.List method. func (client *PeriodsClient) NewListPager(options *PeriodsClientListOptions) *runtime.Pager[PeriodsClientListResponse] { diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_permissions_client.go b/sdk/resourcemanager/billing/armbilling/permissions_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_permissions_client.go rename to sdk/resourcemanager/billing/armbilling/permissions_client.go index f1d38d898512..7747132fef59 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_permissions_client.go +++ b/sdk/resourcemanager/billing/armbilling/permissions_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 armbilling @@ -52,7 +53,6 @@ func NewPermissionsClient(credential azcore.TokenCredential, options *arm.Client } // NewListByBillingAccountPager - Lists the billing permissions the caller has on a billing account. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - PermissionsClientListByBillingAccountOptions contains the optional parameters for the PermissionsClient.ListByBillingAccount @@ -113,7 +113,6 @@ func (client *PermissionsClient) listByBillingAccountHandleResponse(resp *http.R } // NewListByBillingProfilePager - Lists the billing permissions the caller has on a billing profile. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. @@ -179,7 +178,6 @@ func (client *PermissionsClient) listByBillingProfileHandleResponse(resp *http.R } // NewListByCustomerPager - Lists the billing permissions the caller has for a customer. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // customerName - The ID that uniquely identifies a customer. @@ -245,7 +243,6 @@ func (client *PermissionsClient) listByCustomerHandleResponse(resp *http.Respons } // NewListByInvoiceSectionsPager - Lists the billing permissions the caller has on an invoice section. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_policies_client.go b/sdk/resourcemanager/billing/armbilling/policies_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_policies_client.go rename to sdk/resourcemanager/billing/armbilling/policies_client.go index 2cdf16b5ea4a..5e9d25d1cdbe 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_policies_client.go +++ b/sdk/resourcemanager/billing/armbilling/policies_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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_products_client.go b/sdk/resourcemanager/billing/armbilling/products_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_products_client.go rename to sdk/resourcemanager/billing/armbilling/products_client.go index f7794628b8b9..37c37731052c 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_products_client.go +++ b/sdk/resourcemanager/billing/armbilling/products_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 armbilling @@ -108,7 +109,6 @@ func (client *ProductsClient) getHandleResponse(resp *http.Response) (ProductsCl // NewListByBillingAccountPager - Lists the products for a billing account. These don't include products billed based on usage. // The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or // Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - ProductsClientListByBillingAccountOptions contains the optional parameters for the ProductsClient.ListByBillingAccount @@ -174,7 +174,6 @@ func (client *ProductsClient) listByBillingAccountHandleResponse(resp *http.Resp // NewListByBillingProfilePager - Lists the products for a billing profile. These don't include products billed based on usage. // The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or // Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. @@ -244,7 +243,6 @@ func (client *ProductsClient) listByBillingProfileHandleResponse(resp *http.Resp // NewListByCustomerPager - Lists the products for a customer. These don't include products billed based on usage.The operation // is supported only for billing accounts with agreement type Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // customerName - The ID that uniquely identifies a customer. @@ -310,7 +308,6 @@ func (client *ProductsClient) listByCustomerHandleResponse(resp *http.Response) // NewListByInvoiceSectionPager - Lists the products for an invoice section. These don't include products billed based on // usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_profiles_client.go b/sdk/resourcemanager/billing/armbilling/profiles_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_profiles_client.go rename to sdk/resourcemanager/billing/armbilling/profiles_client.go index af5d8903423e..5ca171aee069 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_profiles_client.go +++ b/sdk/resourcemanager/billing/armbilling/profiles_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 armbilling @@ -171,7 +172,6 @@ func (client *ProfilesClient) getHandleResponse(resp *http.Response) (ProfilesCl // NewListByBillingAccountPager - Lists the billing profiles that a user has access to. The operation is supported for billing // accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - ProfilesClientListByBillingAccountOptions contains the optional parameters for the ProfilesClient.ListByBillingAccount diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_property_client.go b/sdk/resourcemanager/billing/armbilling/property_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_property_client.go rename to sdk/resourcemanager/billing/armbilling/property_client.go index 3d42594a20fa..43654e4415fb 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_property_client.go +++ b/sdk/resourcemanager/billing/armbilling/property_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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_reservations_client.go b/sdk/resourcemanager/billing/armbilling/reservations_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_reservations_client.go rename to sdk/resourcemanager/billing/armbilling/reservations_client.go index f145f288b471..b684ab6a0eab 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_reservations_client.go +++ b/sdk/resourcemanager/billing/armbilling/reservations_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 armbilling @@ -53,7 +54,6 @@ func NewReservationsClient(credential azcore.TokenCredential, options *arm.Clien // NewListByBillingAccountPager - Lists the reservations for a billing account and the roll up counts of reservations group // by provisioning states. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - ReservationsClientListByBillingAccountOptions contains the optional parameters for the ReservationsClient.ListByBillingAccount @@ -127,7 +127,6 @@ func (client *ReservationsClient) listByBillingAccountHandleResponse(resp *http. // NewListByBillingProfilePager - Lists the reservations for a billing profile and the roll up counts of reservations group // by provisioning state. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_response_types.go b/sdk/resourcemanager/billing/armbilling/response_types.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_response_types.go rename to sdk/resourcemanager/billing/armbilling/response_types.go index 3da3e9f419dd..0b1758454cf2 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_response_types.go +++ b/sdk/resourcemanager/billing/armbilling/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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_roleassignments_client.go b/sdk/resourcemanager/billing/armbilling/roleassignments_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_roleassignments_client.go rename to sdk/resourcemanager/billing/armbilling/roleassignments_client.go index ea681984f3e5..30046b553e99 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_roleassignments_client.go +++ b/sdk/resourcemanager/billing/armbilling/roleassignments_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 armbilling @@ -407,7 +408,6 @@ func (client *RoleAssignmentsClient) getByInvoiceSectionHandleResponse(resp *htt // NewListByBillingAccountPager - Lists the role assignments for the caller on a billing account. The operation is supported // for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - RoleAssignmentsClientListByBillingAccountOptions contains the optional parameters for the RoleAssignmentsClient.ListByBillingAccount @@ -469,7 +469,6 @@ func (client *RoleAssignmentsClient) listByBillingAccountHandleResponse(resp *ht // NewListByBillingProfilePager - Lists the role assignments for the caller on a billing profile. The operation is supported // for billing accounts with agreement type Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. @@ -536,7 +535,6 @@ func (client *RoleAssignmentsClient) listByBillingProfileHandleResponse(resp *ht // NewListByInvoiceSectionPager - Lists the role assignments for the caller on an invoice section. The operation is supported // for billing accounts with agreement type Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_roledefinitions_client.go b/sdk/resourcemanager/billing/armbilling/roledefinitions_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_roledefinitions_client.go rename to sdk/resourcemanager/billing/armbilling/roledefinitions_client.go index e3d7b8b5256e..5cef03aabcec 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_roledefinitions_client.go +++ b/sdk/resourcemanager/billing/armbilling/roledefinitions_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 armbilling @@ -230,7 +231,6 @@ func (client *RoleDefinitionsClient) getByInvoiceSectionHandleResponse(resp *htt // NewListByBillingAccountPager - Lists the role definitions for a billing account. The operation is supported for billing // accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - RoleDefinitionsClientListByBillingAccountOptions contains the optional parameters for the RoleDefinitionsClient.ListByBillingAccount @@ -292,7 +292,6 @@ func (client *RoleDefinitionsClient) listByBillingAccountHandleResponse(resp *ht // NewListByBillingProfilePager - Lists the role definitions for a billing profile. The operation is supported for billing // accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. @@ -359,7 +358,6 @@ func (client *RoleDefinitionsClient) listByBillingProfileHandleResponse(resp *ht // NewListByInvoiceSectionPager - Lists the role definitions for an invoice section. The operation is supported for billing // accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_subscriptions_client.go b/sdk/resourcemanager/billing/armbilling/subscriptions_client.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_subscriptions_client.go rename to sdk/resourcemanager/billing/armbilling/subscriptions_client.go index 728fe9c71aa0..de8600982885 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_subscriptions_client.go +++ b/sdk/resourcemanager/billing/armbilling/subscriptions_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 armbilling @@ -108,7 +109,6 @@ func (client *SubscriptionsClient) getHandleResponse(resp *http.Response) (Subsc // NewListByBillingAccountPager - Lists the subscriptions for a billing account. The operation is supported for billing accounts // with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // options - SubscriptionsClientListByBillingAccountOptions contains the optional parameters for the SubscriptionsClient.ListByBillingAccount @@ -170,7 +170,6 @@ func (client *SubscriptionsClient) listByBillingAccountHandleResponse(resp *http // NewListByBillingProfilePager - Lists the subscriptions that are billed to a billing profile. The operation is supported // for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. @@ -237,7 +236,6 @@ func (client *SubscriptionsClient) listByBillingProfileHandleResponse(resp *http // NewListByCustomerPager - Lists the subscriptions for a customer. The operation is supported only for billing accounts with // agreement type Microsoft Partner Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // customerName - The ID that uniquely identifies a customer. @@ -304,7 +302,6 @@ func (client *SubscriptionsClient) listByCustomerHandleResponse(resp *http.Respo // NewListByInvoiceSectionPager - Lists the subscriptions that are billed to an invoice section. The operation is supported // only for billing accounts with agreement type Microsoft Customer Agreement. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // billingProfileName - The ID that uniquely identifies a billing profile. diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_time_rfc3339.go b/sdk/resourcemanager/billing/armbilling/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/billing/armbilling/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/billing/armbilling/time_rfc3339.go index 4979625680a2..3de63c94308c 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/billing/armbilling/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 armbilling diff --git a/sdk/resourcemanager/billing/armbilling/zz_generated_transactions_client.go b/sdk/resourcemanager/billing/armbilling/transactions_client.go similarity index 98% rename from sdk/resourcemanager/billing/armbilling/zz_generated_transactions_client.go rename to sdk/resourcemanager/billing/armbilling/transactions_client.go index 3ba149653d64..bccb272299b6 100644 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_transactions_client.go +++ b/sdk/resourcemanager/billing/armbilling/transactions_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 armbilling @@ -53,7 +54,6 @@ func NewTransactionsClient(credential azcore.TokenCredential, options *arm.Clien // NewListByInvoicePager - Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage // charges. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-05-01 // billingAccountName - The ID that uniquely identifies a billing account. // invoiceName - The ID that uniquely identifies an invoice. diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_address_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_address_client_test.go deleted file mode 100644 index 10c60e7525e9..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_address_client_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressInvalid.json -func ExampleAddressClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAddressClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Validate(ctx, - armbilling.AddressDetails{ - AddressLine1: to.Ptr("1 Test"), - City: to.Ptr("bellevue"), - Country: to.Ptr("us"), - PostalCode: to.Ptr("12345"), - Region: to.Ptr("wa"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_agreements_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_agreements_client_test.go deleted file mode 100644 index e2251fca249a..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_agreements_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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AgreementsListByBillingAccount.json -func ExampleAgreementsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAgreementsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - &armbilling.AgreementsClientListByBillingAccountOptions{Expand: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AgreementByName.json -func ExampleAgreementsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAgreementsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{agreementName}", - &armbilling.AgreementsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_availablebalances_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_availablebalances_client_test.go deleted file mode 100644 index 46c440c199b2..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_availablebalances_client_test.go +++ /dev/null @@ -1,39 +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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AvailableBalanceByBillingProfile.json -func ExampleAvailableBalancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAvailableBalancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{billingProfileName}", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingaccounts_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingaccounts_client_test.go deleted file mode 100644 index 41448a0a8532..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingaccounts_client_test.go +++ /dev/null @@ -1,128 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountsList.json -func ExampleAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAccountsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armbilling.AccountsClientListOptions{Expand: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountWithExpand.json -func ExampleAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAccountsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - &armbilling.AccountsClientGetOptions{Expand: to.Ptr("soldTo,billingProfiles,billingProfiles/invoiceSections")}) - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateBillingAccount.json -func ExampleAccountsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAccountsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "{billingAccountName}", - armbilling.AccountUpdateRequest{ - Properties: &armbilling.AccountProperties{ - DisplayName: to.Ptr("Test Account"), - SoldTo: &armbilling.AddressDetails{ - AddressLine1: to.Ptr("Test Address 1"), - City: to.Ptr("Redmond"), - CompanyName: to.Ptr("Contoso"), - Country: to.Ptr("US"), - FirstName: to.Ptr("Test"), - LastName: to.Ptr("User"), - PostalCode: to.Ptr("12345"), - Region: to.Ptr("WA"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionsListWithCreateSubPermission.json -func ExampleAccountsClient_NewListInvoiceSectionsByCreateSubscriptionPermissionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewAccountsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListInvoiceSectionsByCreateSubscriptionPermissionPager("{billingAccountName}", - 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/billing/armbilling/ze_generated_example_billingperiods_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingperiods_client_test.go deleted file mode 100644 index 1427903246d2..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingperiods_client_test.go +++ /dev/null @@ -1,65 +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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/preview/2018-03-01-preview/examples/BillingPeriodsList.json -func ExamplePeriodsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPeriodsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armbilling.PeriodsClientListOptions{Filter: nil, - Skiptoken: nil, - Top: 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/billing/resource-manager/Microsoft.Billing/preview/2018-03-01-preview/examples/BillingPeriodsGet.json -func ExamplePeriodsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPeriodsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "201702-1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingpermissions_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingpermissions_client_test.go deleted file mode 100644 index 7f8a2b9ec54e..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingpermissions_client_test.go +++ /dev/null @@ -1,121 +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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomerPermissionsList.json -func ExamplePermissionsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPermissionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByCustomerPager("{billingAccountName}", - "{customerName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountPermissionsList.json -func ExamplePermissionsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPermissionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionPermissionsList.json -func ExamplePermissionsClient_NewListByInvoiceSectionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPermissionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByInvoiceSectionsPager("{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfilePermissionsList.json -func ExamplePermissionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPermissionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - 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/billing/armbilling/ze_generated_example_billingprofiles_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingprofiles_client_test.go deleted file mode 100644 index 5565edca9a42..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingprofiles_client_test.go +++ /dev/null @@ -1,114 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfilesListByBillingAccount.json -func ExampleProfilesClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProfilesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - &armbilling.ProfilesClientListByBillingAccountOptions{Expand: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfile.json -func ExampleProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProfilesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{billingProfileName}", - &armbilling.ProfilesClientGetOptions{Expand: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/PutBillingProfile.json -func ExampleProfilesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProfilesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "{billingAccountName}", - "{billingProfileName}", - armbilling.Profile{ - Properties: &armbilling.ProfileProperties{ - BillTo: &armbilling.AddressDetails{ - AddressLine1: to.Ptr("Test Address 1"), - City: to.Ptr("Redmond"), - Country: to.Ptr("US"), - FirstName: to.Ptr("Test"), - LastName: to.Ptr("User"), - PostalCode: to.Ptr("12345"), - Region: to.Ptr("WA"), - }, - DisplayName: to.Ptr("Finance"), - EnabledAzurePlans: []*armbilling.AzurePlan{ - { - SKUID: to.Ptr("0001"), - }, - { - SKUID: to.Ptr("0002"), - }}, - InvoiceEmailOptIn: to.Ptr(true), - PoNumber: to.Ptr("ABC12345"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingproperty_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingproperty_client_test.go deleted file mode 100644 index 1ac2bdfb5028..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingproperty_client_test.go +++ /dev/null @@ -1,63 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProperty.json -func ExamplePropertyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPropertyClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateBillingProperty.json -func ExamplePropertyClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPropertyClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - armbilling.Property{ - Properties: &armbilling.PropertyProperties{ - CostCenter: to.Ptr("1010"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroleassignments_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroleassignments_client_test.go deleted file mode 100644 index c2c33e18ef6d..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroleassignments_client_test.go +++ /dev/null @@ -1,233 +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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountRoleAssignment.json -func ExampleRoleAssignmentsClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByBillingAccount(ctx, - "{billingAccountName}", - "{billingRoleAssignmentId}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountRoleAssignmentDelete.json -func ExampleRoleAssignmentsClient_DeleteByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.DeleteByBillingAccount(ctx, - "{billingAccountName}", - "{billingRoleAssignmentName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleAssignment.json -func ExampleRoleAssignmentsClient_GetByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByInvoiceSection(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - "{billingRoleAssignmentName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleAssignmentDelete.json -func ExampleRoleAssignmentsClient_DeleteByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.DeleteByInvoiceSection(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - "{billingRoleAssignmentName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfileRoleAssignment.json -func ExampleRoleAssignmentsClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByBillingProfile(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{billingRoleAssignmentName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfileRoleAssignmentDelete.json -func ExampleRoleAssignmentsClient_DeleteByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.DeleteByBillingProfile(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{billingRoleAssignmentName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountRoleAssignmentList.json -func ExampleRoleAssignmentsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleAssignmentList.json -func ExampleRoleAssignmentsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByInvoiceSectionPager("{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfileRoleAssignmentList.json -func ExampleRoleAssignmentsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - 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/billing/armbilling/ze_generated_example_billingroledefinitions_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroledefinitions_client_test.go deleted file mode 100644 index fc28cc7c94ac..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingroledefinitions_client_test.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountRoleDefinition.json -func ExampleRoleDefinitionsClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByBillingAccount(ctx, - "{billingAccountName}", - "{billingRoleDefinitionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleDefinition.json -func ExampleRoleDefinitionsClient_GetByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByInvoiceSection(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - "{billingRoleDefinitionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfileRoleDefinition.json -func ExampleRoleDefinitionsClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByBillingProfile(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{billingRoleDefinitionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountRoleDefinitionsList.json -func ExampleRoleDefinitionsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionRoleDefinitionsList.json -func ExampleRoleDefinitionsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByInvoiceSectionPager("{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingProfileRoleDefinitionsList.json -func ExampleRoleDefinitionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - 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/billing/armbilling/ze_generated_example_billingsubscriptions_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingsubscriptions_client_test.go deleted file mode 100644 index 9f5e9e7752ee..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_billingsubscriptions_client_test.go +++ /dev/null @@ -1,221 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionsListByCustomer.json -func ExampleSubscriptionsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByCustomerPager("{billingAccountName}", - "{customerName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionsListByBillingAccount.json -func ExampleSubscriptionsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionsListByBillingProfile.json -func ExampleSubscriptionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionsListByInvoiceSection.json -func ExampleSubscriptionsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByInvoiceSectionPager("{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscription.json -func ExampleSubscriptionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateBillingSubscription.json -func ExampleSubscriptionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "{billingAccountName}", - armbilling.Subscription{ - Properties: &armbilling.SubscriptionProperties{ - CostCenter: to.Ptr("ABC1234"), - }, - }, - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/MoveBillingSubscription.json -func ExampleSubscriptionsClient_BeginMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginMove(ctx, - "{billingAccountName}", - armbilling.TransferBillingSubscriptionRequestProperties{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateSubscriptionMoveFailure.json -func ExampleSubscriptionsClient_ValidateMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewSubscriptionsClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ValidateMove(ctx, - "{billingAccountName}", - armbilling.TransferBillingSubscriptionRequestProperties{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_customers_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_customers_client_test.go deleted file mode 100644 index 9585490388f7..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_customers_client_test.go +++ /dev/null @@ -1,94 +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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomersListByBillingProfile.json -func ExampleCustomersClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewCustomersClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - &armbilling.CustomersClientListByBillingProfileOptions{Search: nil, - Filter: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomersListByBillingAccount.json -func ExampleCustomersClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewCustomersClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - &armbilling.CustomersClientListByBillingAccountOptions{Search: nil, - Filter: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Customer.json -func ExampleCustomersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewCustomersClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{customerName}", - &armbilling.CustomersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_enrollmentaccounts_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_enrollmentaccounts_client_test.go deleted file mode 100644 index 5de3ce506e73..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_enrollmentaccounts_client_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/preview/2018-03-01-preview/examples/EnrollmentAccountsList.json -func ExampleEnrollmentAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewEnrollmentAccountsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/preview/2018-03-01-preview/examples/EnrollmentAccountsGet.json -func ExampleEnrollmentAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewEnrollmentAccountsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "e1bf1c8c-5ac6-44a0-bdcd-aa7c1cf60556", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_instructions_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_instructions_client_test.go deleted file mode 100644 index feacaf2bd19e..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_instructions_client_test.go +++ /dev/null @@ -1,99 +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 armbilling_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InstructionsListByBillingProfile.json -func ExampleInstructionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInstructionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Instruction.json -func ExampleInstructionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInstructionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{instructionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/PutInstruction.json -func ExampleInstructionsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInstructionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{instructionName}", - armbilling.Instruction{ - Properties: &armbilling.InstructionProperties{ - Amount: to.Ptr[float32](5000), - EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-30T21:26:47.997Z"); return t }()), - StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-30T21:26:47.997Z"); return t }()), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_invoices_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_invoices_client_test.go deleted file mode 100644 index 4e19eeeae99c..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_invoices_client_test.go +++ /dev/null @@ -1,231 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingAccountInvoicesList.json -func ExampleInvoicesClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - "2018-01-01", - "2018-06-30", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoicesListByBillingProfile.json -func ExampleInvoicesClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - "2018-01-01", - "2018-06-30", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CreditNote.json -func ExampleInvoicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{invoiceName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ModernInvoiceDownload.json -func ExampleInvoicesClient_BeginDownloadInvoice() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDownloadInvoice(ctx, - "{billingAccountName}", - "{invoiceName}", - "DRS_12345", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/MultipleModernInvoiceDownload.json -func ExampleInvoicesClient_BeginDownloadMultipleBillingProfileInvoices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDownloadMultipleBillingProfileInvoices(ctx, - "{billingAccountName}", - []*string{ - to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01"), - to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01"), - to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01")}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionInvoicesList.json -func ExampleInvoicesClient_NewListByBillingSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingSubscriptionPager("2018-01-01", - "2018-06-30", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/BillingSubscriptionInvoiceDownload.json -func ExampleInvoicesClient_BeginDownloadBillingSubscriptionInvoice() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDownloadBillingSubscriptionInvoice(ctx, - "{invoiceName}", - "DRS_12345", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/MultipleBillingSubscriptionInvoiceDownload.json -func ExampleInvoicesClient_BeginDownloadMultipleBillingSubscriptionInvoices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoicesClient("{subscriptionId}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDownloadMultipleBillingSubscriptionInvoices(ctx, - []*string{ - to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01"), - to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01"), - to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download?downloadToken={downloadToken}&useCache=True&api-version=2020-05-01")}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_invoicesections_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_invoicesections_client_test.go deleted file mode 100644 index af6df34ca85c..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_invoicesections_client_test.go +++ /dev/null @@ -1,103 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSectionsListByBillingProfile.json -func ExampleInvoiceSectionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoiceSectionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/InvoiceSection.json -func ExampleInvoiceSectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoiceSectionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/PutInvoiceSection.json -func ExampleInvoiceSectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewInvoiceSectionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - armbilling.InvoiceSection{ - Properties: &armbilling.InvoiceSectionProperties{ - DisplayName: to.Ptr("invoiceSection1"), - Labels: map[string]*string{ - "costCategory": to.Ptr("Support"), - "pcCode": to.Ptr("A123456"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_policies_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_policies_client_test.go deleted file mode 100644 index 7de207753e56..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_policies_client_test.go +++ /dev/null @@ -1,118 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Policy.json -func ExamplePoliciesClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByBillingProfile(ctx, - "{billingAccountName}", - "{billingProfileName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdatePolicy.json -func ExamplePoliciesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "{billingAccountName}", - "{billingProfileName}", - armbilling.Policy{ - Properties: &armbilling.PolicyProperties{ - MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyOnlyFreeAllowed), - ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyNotAllowed), - ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - }, - }, - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/CustomerPolicy.json -func ExamplePoliciesClient_GetByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByCustomer(ctx, - "{billingAccountName}", - "{customerName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateCustomerPolicy.json -func ExamplePoliciesClient_UpdateCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.UpdateCustomer(ctx, - "{billingAccountName}", - "{customerName}", - armbilling.CustomerPolicy{ - Properties: &armbilling.CustomerPolicyProperties{ - ViewCharges: to.Ptr(armbilling.ViewChargesNotAllowed), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_products_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_products_client_test.go deleted file mode 100644 index 403ccd1c2491..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_products_client_test.go +++ /dev/null @@ -1,221 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByCustomer.json -func ExampleProductsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByCustomerPager("{billingAccountName}", - "{customerName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByBillingAccount.json -func ExampleProductsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - &armbilling.ProductsClientListByBillingAccountOptions{Filter: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByBillingProfile.json -func ExampleProductsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - &armbilling.ProductsClientListByBillingProfileOptions{Filter: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ProductsListByInvoiceSection.json -func ExampleProductsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByInvoiceSectionPager("{billingAccountName}", - "{billingProfileName}", - "{invoiceSectionName}", - &armbilling.ProductsClientListByInvoiceSectionOptions{Filter: 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/Product.json -func ExampleProductsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "{billingAccountName}", - "{productName}", - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/UpdateProduct.json -func ExampleProductsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "{billingAccountName}", - "{productName}", - armbilling.Product{ - Properties: &armbilling.ProductProperties{ - AutoRenew: to.Ptr(armbilling.AutoRenewOff), - }, - }, - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/MoveProduct.json -func ExampleProductsClient_Move() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Move(ctx, - "{billingAccountName}", - "{productName}", - armbilling.TransferProductRequestProperties{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"), - }, - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ValidateProductMoveFailure.json -func ExampleProductsClient_ValidateMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewProductsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ValidateMove(ctx, - "{billingAccountName}", - "{productName}", - armbilling.TransferProductRequestProperties{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{newInvoiceSectionName}"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/billing/armbilling/ze_generated_example_reservations_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_reservations_client_test.go deleted file mode 100644 index a668131350ca..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_reservations_client_test.go +++ /dev/null @@ -1,77 +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 armbilling_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/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ReservationsListByBillingAccount.json -func ExampleReservationsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewReservationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingAccountPager("{billingAccountName}", - &armbilling.ReservationsClientListByBillingAccountOptions{Filter: to.Ptr("properties/reservedResourceType eq 'VirtualMachines'"), - Orderby: to.Ptr("properties/userFriendlyAppliedScopeType asc"), - RefreshSummary: nil, - SelectedState: to.Ptr("Succeeded"), - }) - 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/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/ReservationsListByBillingProfile.json -func ExampleReservationsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewReservationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByBillingProfilePager("{billingAccountName}", - "{billingProfileName}", - &armbilling.ReservationsClientListByBillingProfileOptions{Filter: to.Ptr("properties/reservedResourceType eq 'VirtualMachines'"), - Orderby: to.Ptr("properties/userFriendlyAppliedScopeType asc"), - RefreshSummary: nil, - SelectedState: to.Ptr("Succeeded"), - }) - 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/billing/armbilling/ze_generated_example_transactions_client_test.go b/sdk/resourcemanager/billing/armbilling/ze_generated_example_transactions_client_test.go deleted file mode 100644 index c1b4bda39b32..000000000000 --- a/sdk/resourcemanager/billing/armbilling/ze_generated_example_transactions_client_test.go +++ /dev/null @@ -1,43 +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 armbilling_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/TransactionsListByInvoice.json -func ExampleTransactionsClient_NewListByInvoicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armbilling.NewTransactionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByInvoicePager("{billingAccountName}", - "{invoiceName}", - 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/billing/armbilling/zz_generated_models_serde.go b/sdk/resourcemanager/billing/armbilling/zz_generated_models_serde.go deleted file mode 100644 index a7c977b075d4..000000000000 --- a/sdk/resourcemanager/billing/armbilling/zz_generated_models_serde.go +++ /dev/null @@ -1,984 +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 armbilling - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AccountProperties. -func (a AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountStatus", a.AccountStatus) - populate(objectMap, "accountType", a.AccountType) - populate(objectMap, "agreementType", a.AgreementType) - populate(objectMap, "billingProfiles", a.BillingProfiles) - populate(objectMap, "departments", a.Departments) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "enrollmentAccounts", a.EnrollmentAccounts) - populate(objectMap, "enrollmentDetails", a.EnrollmentDetails) - populate(objectMap, "hasReadAccess", a.HasReadAccess) - populate(objectMap, "notificationEmailAddress", a.NotificationEmailAddress) - populate(objectMap, "soldTo", a.SoldTo) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AccountUpdateRequest. -func (a AccountUpdateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AgreementProperties. -func (a AgreementProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "acceptanceMode", a.AcceptanceMode) - populate(objectMap, "agreementLink", a.AgreementLink) - populate(objectMap, "billingProfileInfo", a.BillingProfileInfo) - populate(objectMap, "category", a.Category) - populateTimeRFC3339(objectMap, "effectiveDate", a.EffectiveDate) - populateTimeRFC3339(objectMap, "expirationDate", a.ExpirationDate) - populate(objectMap, "participants", a.Participants) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AgreementProperties. -func (a *AgreementProperties) UnmarshalJSON(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 "acceptanceMode": - err = unpopulate(val, "AcceptanceMode", &a.AcceptanceMode) - delete(rawMsg, key) - case "agreementLink": - err = unpopulate(val, "AgreementLink", &a.AgreementLink) - delete(rawMsg, key) - case "billingProfileInfo": - err = unpopulate(val, "BillingProfileInfo", &a.BillingProfileInfo) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &a.Category) - delete(rawMsg, key) - case "effectiveDate": - err = unpopulateTimeRFC3339(val, "EffectiveDate", &a.EffectiveDate) - delete(rawMsg, key) - case "expirationDate": - err = unpopulateTimeRFC3339(val, "ExpirationDate", &a.ExpirationDate) - delete(rawMsg, key) - case "participants": - err = unpopulate(val, "Participants", &a.Participants) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CustomerProperties. -func (c CustomerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billingProfileDisplayName", c.BillingProfileDisplayName) - populate(objectMap, "billingProfileId", c.BillingProfileID) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "enabledAzurePlans", c.EnabledAzurePlans) - populate(objectMap, "resellers", c.Resellers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DepartmentProperties. -func (d DepartmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "costCenter", d.CostCenter) - populate(objectMap, "departmentName", d.DepartmentName) - populate(objectMap, "enrollmentAccounts", d.EnrollmentAccounts) - populate(objectMap, "status", d.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. -func (d *DownloadURL) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expiryTime": - err = unpopulateTimeRFC3339(val, "ExpiryTime", &d.ExpiryTime) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &d.URL) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Enrollment. -func (e Enrollment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billingCycle", e.BillingCycle) - populate(objectMap, "channel", e.Channel) - populate(objectMap, "countryCode", e.CountryCode) - populate(objectMap, "currency", e.Currency) - populateTimeRFC3339(objectMap, "endDate", e.EndDate) - populate(objectMap, "language", e.Language) - populate(objectMap, "policies", e.Policies) - populateTimeRFC3339(objectMap, "startDate", e.StartDate) - populate(objectMap, "status", e.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Enrollment. -func (e *Enrollment) UnmarshalJSON(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 "billingCycle": - err = unpopulate(val, "BillingCycle", &e.BillingCycle) - delete(rawMsg, key) - case "channel": - err = unpopulate(val, "Channel", &e.Channel) - delete(rawMsg, key) - case "countryCode": - err = unpopulate(val, "CountryCode", &e.CountryCode) - delete(rawMsg, key) - case "currency": - err = unpopulate(val, "Currency", &e.Currency) - delete(rawMsg, key) - case "endDate": - err = unpopulateTimeRFC3339(val, "EndDate", &e.EndDate) - delete(rawMsg, key) - case "language": - err = unpopulate(val, "Language", &e.Language) - delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &e.Policies) - delete(rawMsg, key) - case "startDate": - err = unpopulateTimeRFC3339(val, "StartDate", &e.StartDate) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountContext. -func (e *EnrollmentAccountContext) UnmarshalJSON(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 "costCenter": - err = unpopulate(val, "CostCenter", &e.CostCenter) - delete(rawMsg, key) - case "endDate": - err = unpopulateTimeRFC3339(val, "EndDate", &e.EndDate) - delete(rawMsg, key) - case "enrollmentAccountName": - err = unpopulate(val, "EnrollmentAccountName", &e.EnrollmentAccountName) - delete(rawMsg, key) - case "startDate": - err = unpopulateTimeRFC3339(val, "StartDate", &e.StartDate) - 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 EnrollmentAccountProperties. -func (e EnrollmentAccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountName", e.AccountName) - populate(objectMap, "accountOwner", e.AccountOwner) - populate(objectMap, "accountOwnerEmail", e.AccountOwnerEmail) - populate(objectMap, "costCenter", e.CostCenter) - populate(objectMap, "department", e.Department) - populateTimeRFC3339(objectMap, "endDate", e.EndDate) - populateTimeRFC3339(objectMap, "startDate", e.StartDate) - populate(objectMap, "status", e.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnrollmentAccountProperties. -func (e *EnrollmentAccountProperties) UnmarshalJSON(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 "accountName": - err = unpopulate(val, "AccountName", &e.AccountName) - delete(rawMsg, key) - case "accountOwner": - err = unpopulate(val, "AccountOwner", &e.AccountOwner) - delete(rawMsg, key) - case "accountOwnerEmail": - err = unpopulate(val, "AccountOwnerEmail", &e.AccountOwnerEmail) - delete(rawMsg, key) - case "costCenter": - err = unpopulate(val, "CostCenter", &e.CostCenter) - delete(rawMsg, key) - case "department": - err = unpopulate(val, "Department", &e.Department) - delete(rawMsg, key) - case "endDate": - err = unpopulateTimeRFC3339(val, "EndDate", &e.EndDate) - delete(rawMsg, key) - case "startDate": - err = unpopulateTimeRFC3339(val, "StartDate", &e.StartDate) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - 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 InstructionProperties. -func (i InstructionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amount", i.Amount) - populateTimeRFC3339(objectMap, "creationDate", i.CreationDate) - populateTimeRFC3339(objectMap, "endDate", i.EndDate) - populateTimeRFC3339(objectMap, "startDate", i.StartDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InstructionProperties. -func (i *InstructionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "amount": - err = unpopulate(val, "Amount", &i.Amount) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &i.CreationDate) - delete(rawMsg, key) - case "endDate": - err = unpopulateTimeRFC3339(val, "EndDate", &i.EndDate) - delete(rawMsg, key) - case "startDate": - err = unpopulateTimeRFC3339(val, "StartDate", &i.StartDate) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InvoiceProperties. -func (i InvoiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amountDue", i.AmountDue) - populate(objectMap, "azurePrepaymentApplied", i.AzurePrepaymentApplied) - populate(objectMap, "billedAmount", i.BilledAmount) - populate(objectMap, "billedDocumentId", i.BilledDocumentID) - populate(objectMap, "billingProfileDisplayName", i.BillingProfileDisplayName) - populate(objectMap, "billingProfileId", i.BillingProfileID) - populate(objectMap, "creditAmount", i.CreditAmount) - populate(objectMap, "creditForDocumentId", i.CreditForDocumentID) - populate(objectMap, "documentType", i.DocumentType) - populate(objectMap, "documents", i.Documents) - populateTimeRFC3339(objectMap, "dueDate", i.DueDate) - populate(objectMap, "freeAzureCreditApplied", i.FreeAzureCreditApplied) - populateTimeRFC3339(objectMap, "invoiceDate", i.InvoiceDate) - populateTimeRFC3339(objectMap, "invoicePeriodEndDate", i.InvoicePeriodEndDate) - populateTimeRFC3339(objectMap, "invoicePeriodStartDate", i.InvoicePeriodStartDate) - populate(objectMap, "invoiceType", i.InvoiceType) - populate(objectMap, "isMonthlyInvoice", i.IsMonthlyInvoice) - populate(objectMap, "payments", i.Payments) - populate(objectMap, "purchaseOrderNumber", i.PurchaseOrderNumber) - populate(objectMap, "rebillDetails", i.RebillDetails) - populate(objectMap, "status", i.Status) - populate(objectMap, "subTotal", i.SubTotal) - populate(objectMap, "subscriptionId", i.SubscriptionID) - populate(objectMap, "taxAmount", i.TaxAmount) - populate(objectMap, "totalAmount", i.TotalAmount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InvoiceProperties. -func (i *InvoiceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "amountDue": - err = unpopulate(val, "AmountDue", &i.AmountDue) - delete(rawMsg, key) - case "azurePrepaymentApplied": - err = unpopulate(val, "AzurePrepaymentApplied", &i.AzurePrepaymentApplied) - delete(rawMsg, key) - case "billedAmount": - err = unpopulate(val, "BilledAmount", &i.BilledAmount) - delete(rawMsg, key) - case "billedDocumentId": - err = unpopulate(val, "BilledDocumentID", &i.BilledDocumentID) - delete(rawMsg, key) - case "billingProfileDisplayName": - err = unpopulate(val, "BillingProfileDisplayName", &i.BillingProfileDisplayName) - delete(rawMsg, key) - case "billingProfileId": - err = unpopulate(val, "BillingProfileID", &i.BillingProfileID) - delete(rawMsg, key) - case "creditAmount": - err = unpopulate(val, "CreditAmount", &i.CreditAmount) - delete(rawMsg, key) - case "creditForDocumentId": - err = unpopulate(val, "CreditForDocumentID", &i.CreditForDocumentID) - delete(rawMsg, key) - case "documentType": - err = unpopulate(val, "DocumentType", &i.DocumentType) - delete(rawMsg, key) - case "documents": - err = unpopulate(val, "Documents", &i.Documents) - delete(rawMsg, key) - case "dueDate": - err = unpopulateTimeRFC3339(val, "DueDate", &i.DueDate) - delete(rawMsg, key) - case "freeAzureCreditApplied": - err = unpopulate(val, "FreeAzureCreditApplied", &i.FreeAzureCreditApplied) - delete(rawMsg, key) - case "invoiceDate": - err = unpopulateTimeRFC3339(val, "InvoiceDate", &i.InvoiceDate) - delete(rawMsg, key) - case "invoicePeriodEndDate": - err = unpopulateTimeRFC3339(val, "InvoicePeriodEndDate", &i.InvoicePeriodEndDate) - delete(rawMsg, key) - case "invoicePeriodStartDate": - err = unpopulateTimeRFC3339(val, "InvoicePeriodStartDate", &i.InvoicePeriodStartDate) - delete(rawMsg, key) - case "invoiceType": - err = unpopulate(val, "InvoiceType", &i.InvoiceType) - delete(rawMsg, key) - case "isMonthlyInvoice": - err = unpopulate(val, "IsMonthlyInvoice", &i.IsMonthlyInvoice) - delete(rawMsg, key) - case "payments": - err = unpopulate(val, "Payments", &i.Payments) - delete(rawMsg, key) - case "purchaseOrderNumber": - err = unpopulate(val, "PurchaseOrderNumber", &i.PurchaseOrderNumber) - delete(rawMsg, key) - case "rebillDetails": - err = unpopulate(val, "RebillDetails", &i.RebillDetails) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &i.Status) - delete(rawMsg, key) - case "subTotal": - err = unpopulate(val, "SubTotal", &i.SubTotal) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &i.SubscriptionID) - delete(rawMsg, key) - case "taxAmount": - err = unpopulate(val, "TaxAmount", &i.TaxAmount) - delete(rawMsg, key) - case "totalAmount": - err = unpopulate(val, "TotalAmount", &i.TotalAmount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionProperties. -func (i InvoiceSectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", i.DisplayName) - populate(objectMap, "labels", i.Labels) - populate(objectMap, "state", i.State) - populate(objectMap, "systemId", i.SystemID) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "targetCloud", i.TargetCloud) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type InvoiceSectionsOnExpand. -func (i InvoiceSectionsOnExpand) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "hasMoreResults", i.HasMoreResults) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Participants. -func (p Participants) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "email", p.Email) - populate(objectMap, "status", p.Status) - populateTimeRFC3339(objectMap, "statusDate", p.StatusDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Participants. -func (p *Participants) UnmarshalJSON(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 "email": - err = unpopulate(val, "Email", &p.Email) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - case "statusDate": - err = unpopulateTimeRFC3339(val, "StatusDate", &p.StatusDate) - 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 PaymentProperties. -func (p PaymentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "amount", p.Amount) - populateTimeRFC3339(objectMap, "date", p.Date) - populate(objectMap, "paymentMethodFamily", p.PaymentMethodFamily) - populate(objectMap, "paymentMethodType", p.PaymentMethodType) - populate(objectMap, "paymentType", p.PaymentType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PaymentProperties. -func (p *PaymentProperties) UnmarshalJSON(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 "amount": - err = unpopulate(val, "Amount", &p.Amount) - delete(rawMsg, key) - case "date": - err = unpopulateTimeRFC3339(val, "Date", &p.Date) - delete(rawMsg, key) - case "paymentMethodFamily": - err = unpopulate(val, "PaymentMethodFamily", &p.PaymentMethodFamily) - delete(rawMsg, key) - case "paymentMethodType": - err = unpopulate(val, "PaymentMethodType", &p.PaymentMethodType) - delete(rawMsg, key) - case "paymentType": - err = unpopulate(val, "PaymentType", &p.PaymentType) - 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 PeriodProperties. -func (p PeriodProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateDateType(objectMap, "billingPeriodEndDate", p.BillingPeriodEndDate) - populateDateType(objectMap, "billingPeriodStartDate", p.BillingPeriodStartDate) - populate(objectMap, "invoiceIds", p.InvoiceIDs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodProperties. -func (p *PeriodProperties) UnmarshalJSON(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 "billingPeriodEndDate": - err = unpopulateDateType(val, "BillingPeriodEndDate", &p.BillingPeriodEndDate) - delete(rawMsg, key) - case "billingPeriodStartDate": - err = unpopulateDateType(val, "BillingPeriodStartDate", &p.BillingPeriodStartDate) - delete(rawMsg, key) - case "invoiceIds": - err = unpopulate(val, "InvoiceIDs", &p.InvoiceIDs) - 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 PermissionsProperties. -func (p PermissionsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", p.Actions) - populate(objectMap, "notActions", p.NotActions) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Product. -func (p Product) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProductProperties. -func (p ProductProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "autoRenew", p.AutoRenew) - populate(objectMap, "availabilityId", p.AvailabilityID) - populate(objectMap, "billingFrequency", p.BillingFrequency) - populate(objectMap, "billingProfileDisplayName", p.BillingProfileDisplayName) - populate(objectMap, "billingProfileId", p.BillingProfileID) - populate(objectMap, "customerDisplayName", p.CustomerDisplayName) - populate(objectMap, "customerId", p.CustomerID) - populate(objectMap, "displayName", p.DisplayName) - populateTimeRFC3339(objectMap, "endDate", p.EndDate) - populate(objectMap, "invoiceSectionDisplayName", p.InvoiceSectionDisplayName) - populate(objectMap, "invoiceSectionId", p.InvoiceSectionID) - populate(objectMap, "lastCharge", p.LastCharge) - populateTimeRFC3339(objectMap, "lastChargeDate", p.LastChargeDate) - populate(objectMap, "productType", p.ProductType) - populate(objectMap, "productTypeId", p.ProductTypeID) - populateTimeRFC3339(objectMap, "purchaseDate", p.PurchaseDate) - populate(objectMap, "quantity", p.Quantity) - populate(objectMap, "reseller", p.Reseller) - populate(objectMap, "skuDescription", p.SKUDescription) - populate(objectMap, "skuId", p.SKUID) - populate(objectMap, "status", p.Status) - populate(objectMap, "tenantId", p.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProductProperties. -func (p *ProductProperties) UnmarshalJSON(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 "autoRenew": - err = unpopulate(val, "AutoRenew", &p.AutoRenew) - delete(rawMsg, key) - case "availabilityId": - err = unpopulate(val, "AvailabilityID", &p.AvailabilityID) - delete(rawMsg, key) - case "billingFrequency": - err = unpopulate(val, "BillingFrequency", &p.BillingFrequency) - delete(rawMsg, key) - case "billingProfileDisplayName": - err = unpopulate(val, "BillingProfileDisplayName", &p.BillingProfileDisplayName) - delete(rawMsg, key) - case "billingProfileId": - err = unpopulate(val, "BillingProfileID", &p.BillingProfileID) - delete(rawMsg, key) - case "customerDisplayName": - err = unpopulate(val, "CustomerDisplayName", &p.CustomerDisplayName) - delete(rawMsg, key) - case "customerId": - err = unpopulate(val, "CustomerID", &p.CustomerID) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endDate": - err = unpopulateTimeRFC3339(val, "EndDate", &p.EndDate) - delete(rawMsg, key) - case "invoiceSectionDisplayName": - err = unpopulate(val, "InvoiceSectionDisplayName", &p.InvoiceSectionDisplayName) - delete(rawMsg, key) - case "invoiceSectionId": - err = unpopulate(val, "InvoiceSectionID", &p.InvoiceSectionID) - delete(rawMsg, key) - case "lastCharge": - err = unpopulate(val, "LastCharge", &p.LastCharge) - delete(rawMsg, key) - case "lastChargeDate": - err = unpopulateTimeRFC3339(val, "LastChargeDate", &p.LastChargeDate) - delete(rawMsg, key) - case "productType": - err = unpopulate(val, "ProductType", &p.ProductType) - delete(rawMsg, key) - case "productTypeId": - err = unpopulate(val, "ProductTypeID", &p.ProductTypeID) - delete(rawMsg, key) - case "purchaseDate": - err = unpopulateTimeRFC3339(val, "PurchaseDate", &p.PurchaseDate) - delete(rawMsg, key) - case "quantity": - err = unpopulate(val, "Quantity", &p.Quantity) - delete(rawMsg, key) - case "reseller": - err = unpopulate(val, "Reseller", &p.Reseller) - delete(rawMsg, key) - case "skuDescription": - err = unpopulate(val, "SKUDescription", &p.SKUDescription) - delete(rawMsg, key) - case "skuId": - err = unpopulate(val, "SKUID", &p.SKUID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &p.TenantID) - 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 ProfileProperties. -func (p ProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billTo", p.BillTo) - populate(objectMap, "billingRelationshipType", p.BillingRelationshipType) - populate(objectMap, "currency", p.Currency) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "enabledAzurePlans", p.EnabledAzurePlans) - populate(objectMap, "hasReadAccess", p.HasReadAccess) - populate(objectMap, "indirectRelationshipInfo", p.IndirectRelationshipInfo) - populate(objectMap, "invoiceDay", p.InvoiceDay) - populate(objectMap, "invoiceEmailOptIn", p.InvoiceEmailOptIn) - populate(objectMap, "invoiceSections", p.InvoiceSections) - populate(objectMap, "poNumber", p.PoNumber) - populate(objectMap, "spendingLimit", p.SpendingLimit) - populate(objectMap, "status", p.Status) - populate(objectMap, "statusReasonCode", p.StatusReasonCode) - populate(objectMap, "systemId", p.SystemID) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "targetClouds", p.TargetClouds) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProfilesOnExpand. -func (p ProfilesOnExpand) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "hasMoreResults", p.HasMoreResults) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Property. -func (p Property) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RebillDetails. -func (r RebillDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "creditNoteDocumentId", r.CreditNoteDocumentID) - populate(objectMap, "invoiceDocumentId", r.InvoiceDocumentID) - populate(objectMap, "rebillDetails", r.RebillDetails) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionProperties. -func (r RoleDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", r.Description) - populate(objectMap, "permissions", r.Permissions) - populate(objectMap, "roleName", r.RoleName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Subscription. -func (s Subscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionProperties. -func (s SubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "billingProfileDisplayName", s.BillingProfileDisplayName) - populate(objectMap, "billingProfileId", s.BillingProfileID) - populate(objectMap, "costCenter", s.CostCenter) - populate(objectMap, "customerDisplayName", s.CustomerDisplayName) - populate(objectMap, "customerId", s.CustomerID) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "invoiceSectionDisplayName", s.InvoiceSectionDisplayName) - populate(objectMap, "invoiceSectionId", s.InvoiceSectionID) - populate(objectMap, "lastMonthCharges", s.LastMonthCharges) - populate(objectMap, "monthToDateCharges", s.MonthToDateCharges) - populate(objectMap, "reseller", s.Reseller) - populate(objectMap, "skuDescription", s.SKUDescription) - populate(objectMap, "skuId", s.SKUID) - populate(objectMap, "subscriptionBillingStatus", s.SubscriptionBillingStatus) - populate(objectMap, "subscriptionId", s.SubscriptionID) - populate(objectMap, "suspensionReasons", s.SuspensionReasons) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TransactionProperties. -func (t TransactionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "azureCreditApplied", t.AzureCreditApplied) - populate(objectMap, "azurePlan", t.AzurePlan) - populate(objectMap, "billingCurrency", t.BillingCurrency) - populate(objectMap, "billingProfileDisplayName", t.BillingProfileDisplayName) - populate(objectMap, "billingProfileId", t.BillingProfileID) - populate(objectMap, "customerDisplayName", t.CustomerDisplayName) - populate(objectMap, "customerId", t.CustomerID) - populateTimeRFC3339(objectMap, "date", t.Date) - populate(objectMap, "discount", t.Discount) - populate(objectMap, "effectivePrice", t.EffectivePrice) - populate(objectMap, "exchangeRate", t.ExchangeRate) - populate(objectMap, "invoice", t.Invoice) - populate(objectMap, "invoiceId", t.InvoiceID) - populate(objectMap, "invoiceSectionDisplayName", t.InvoiceSectionDisplayName) - populate(objectMap, "invoiceSectionId", t.InvoiceSectionID) - populate(objectMap, "kind", t.Kind) - populate(objectMap, "marketPrice", t.MarketPrice) - populate(objectMap, "orderId", t.OrderID) - populate(objectMap, "orderName", t.OrderName) - populate(objectMap, "pricingCurrency", t.PricingCurrency) - populate(objectMap, "productDescription", t.ProductDescription) - populate(objectMap, "productFamily", t.ProductFamily) - populate(objectMap, "productType", t.ProductType) - populate(objectMap, "productTypeId", t.ProductTypeID) - populate(objectMap, "quantity", t.Quantity) - populateTimeRFC3339(objectMap, "servicePeriodEndDate", t.ServicePeriodEndDate) - populateTimeRFC3339(objectMap, "servicePeriodStartDate", t.ServicePeriodStartDate) - populate(objectMap, "subTotal", t.SubTotal) - populate(objectMap, "subscriptionId", t.SubscriptionID) - populate(objectMap, "subscriptionName", t.SubscriptionName) - populate(objectMap, "tax", t.Tax) - populate(objectMap, "transactionAmount", t.TransactionAmount) - populate(objectMap, "transactionType", t.TransactionType) - populate(objectMap, "unitOfMeasure", t.UnitOfMeasure) - populate(objectMap, "unitType", t.UnitType) - populate(objectMap, "units", t.Units) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TransactionProperties. -func (t *TransactionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureCreditApplied": - err = unpopulate(val, "AzureCreditApplied", &t.AzureCreditApplied) - delete(rawMsg, key) - case "azurePlan": - err = unpopulate(val, "AzurePlan", &t.AzurePlan) - delete(rawMsg, key) - case "billingCurrency": - err = unpopulate(val, "BillingCurrency", &t.BillingCurrency) - delete(rawMsg, key) - case "billingProfileDisplayName": - err = unpopulate(val, "BillingProfileDisplayName", &t.BillingProfileDisplayName) - delete(rawMsg, key) - case "billingProfileId": - err = unpopulate(val, "BillingProfileID", &t.BillingProfileID) - delete(rawMsg, key) - case "customerDisplayName": - err = unpopulate(val, "CustomerDisplayName", &t.CustomerDisplayName) - delete(rawMsg, key) - case "customerId": - err = unpopulate(val, "CustomerID", &t.CustomerID) - delete(rawMsg, key) - case "date": - err = unpopulateTimeRFC3339(val, "Date", &t.Date) - delete(rawMsg, key) - case "discount": - err = unpopulate(val, "Discount", &t.Discount) - delete(rawMsg, key) - case "effectivePrice": - err = unpopulate(val, "EffectivePrice", &t.EffectivePrice) - delete(rawMsg, key) - case "exchangeRate": - err = unpopulate(val, "ExchangeRate", &t.ExchangeRate) - delete(rawMsg, key) - case "invoice": - err = unpopulate(val, "Invoice", &t.Invoice) - delete(rawMsg, key) - case "invoiceId": - err = unpopulate(val, "InvoiceID", &t.InvoiceID) - delete(rawMsg, key) - case "invoiceSectionDisplayName": - err = unpopulate(val, "InvoiceSectionDisplayName", &t.InvoiceSectionDisplayName) - delete(rawMsg, key) - case "invoiceSectionId": - err = unpopulate(val, "InvoiceSectionID", &t.InvoiceSectionID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "marketPrice": - err = unpopulate(val, "MarketPrice", &t.MarketPrice) - delete(rawMsg, key) - case "orderId": - err = unpopulate(val, "OrderID", &t.OrderID) - delete(rawMsg, key) - case "orderName": - err = unpopulate(val, "OrderName", &t.OrderName) - delete(rawMsg, key) - case "pricingCurrency": - err = unpopulate(val, "PricingCurrency", &t.PricingCurrency) - delete(rawMsg, key) - case "productDescription": - err = unpopulate(val, "ProductDescription", &t.ProductDescription) - delete(rawMsg, key) - case "productFamily": - err = unpopulate(val, "ProductFamily", &t.ProductFamily) - delete(rawMsg, key) - case "productType": - err = unpopulate(val, "ProductType", &t.ProductType) - delete(rawMsg, key) - case "productTypeId": - err = unpopulate(val, "ProductTypeID", &t.ProductTypeID) - delete(rawMsg, key) - case "quantity": - err = unpopulate(val, "Quantity", &t.Quantity) - delete(rawMsg, key) - case "servicePeriodEndDate": - err = unpopulateTimeRFC3339(val, "ServicePeriodEndDate", &t.ServicePeriodEndDate) - delete(rawMsg, key) - case "servicePeriodStartDate": - err = unpopulateTimeRFC3339(val, "ServicePeriodStartDate", &t.ServicePeriodStartDate) - delete(rawMsg, key) - case "subTotal": - err = unpopulate(val, "SubTotal", &t.SubTotal) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &t.SubscriptionID) - delete(rawMsg, key) - case "subscriptionName": - err = unpopulate(val, "SubscriptionName", &t.SubscriptionName) - delete(rawMsg, key) - case "tax": - err = unpopulate(val, "Tax", &t.Tax) - delete(rawMsg, key) - case "transactionAmount": - err = unpopulate(val, "TransactionAmount", &t.TransactionAmount) - delete(rawMsg, key) - case "transactionType": - err = unpopulate(val, "TransactionType", &t.TransactionType) - delete(rawMsg, key) - case "unitOfMeasure": - err = unpopulate(val, "UnitOfMeasure", &t.UnitOfMeasure) - delete(rawMsg, key) - case "unitType": - err = unpopulate(val, "UnitType", &t.UnitType) - delete(rawMsg, key) - case "units": - err = unpopulate(val, "Units", &t.Units) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}