From a85c1a17227b583b82a348e6a2edda19fc415487 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 19 Sep 2024 18:14:14 +0000 Subject: [PATCH] CodeGen from PR 30650 in Azure/azure-rest-api-specs Merge eeb70668eaa11c34989dd99a1f97a0cd27bd0ce5 into ab848447cdbc154106aae2c9226093227814d337 --- .../billing/armbilling/CHANGELOG.md | 9 + .../billing/armbilling/README.md | 4 +- .../billing/armbilling/accounts_client.go | 9 +- .../accounts_client_example_test.go | 899 ------------ .../billing/armbilling/address_client.go | 3 +- .../armbilling/address_client_example_test.go | 93 -- .../billing/armbilling/agreements_client.go | 7 +- .../agreements_client_example_test.go | 126 -- .../armbilling/associatedtenants_client.go | 9 +- .../associatedtenants_client_example_test.go | 172 --- .../billing/armbilling/autorest.md | 7 +- .../armbilling/availablebalances_client.go | 7 +- .../availablebalances_client_example_test.go | 126 -- .../billing/armbilling/client_factory.go | 8 - .../billing/armbilling/constants.go | 2 +- .../billing/armbilling/customers_client.go | 9 +- .../customers_client_example_test.go | 310 ----- .../billing/armbilling/date_type.go | 3 +- .../billing/armbilling/departments_client.go | 9 +- .../departments_client_example_test.go | 101 -- .../armbilling/enrollmentaccounts_client.go | 9 +- .../enrollmentaccounts_client_example_test.go | 245 ---- .../armbilling/fake/accounts_server.go | 11 +- .../billing/armbilling/fake/address_server.go | 5 +- .../armbilling/fake/agreements_server.go | 9 +- .../fake/associatedtenants_server.go | 11 +- .../fake/availablebalances_server.go | 9 +- .../armbilling/fake/customers_server.go | 11 +- .../billing/armbilling/fake/date_type.go | 3 +- .../armbilling/fake/departments_server.go | 11 +- .../fake/enrollmentaccounts_server.go | 11 +- .../billing/armbilling/fake/internal.go | 3 +- .../armbilling/fake/invoices_server.go | 11 +- .../armbilling/fake/invoicesections_server.go | 11 +- .../armbilling/fake/operations_server.go | 5 +- .../fake/partnertransfers_server.go | 9 +- .../armbilling/fake/paymentmethods_server.go | 9 +- .../armbilling/fake/permissions_server.go | 9 +- .../armbilling/fake/policies_server.go | 9 +- .../armbilling/fake/products_server.go | 11 +- .../armbilling/fake/profiles_server.go | 11 +- .../armbilling/fake/property_server.go | 153 --- .../fake/recipienttransfers_server.go | 9 +- .../armbilling/fake/requests_server.go | 11 +- .../fake/reservationorders_server.go | 11 +- .../armbilling/fake/reservations_server.go | 11 +- .../armbilling/fake/roleassignments_server.go | 11 +- .../armbilling/fake/roledefinition_server.go | 9 +- .../fake/savingsplanorders_server.go | 11 +- .../armbilling/fake/savingsplans_server.go | 11 +- .../billing/armbilling/fake/server_factory.go | 8 +- .../armbilling/fake/subscriptions_server.go | 11 +- .../fake/subscriptionsaliases_server.go | 11 +- .../billing/armbilling/fake/time_rfc3339.go | 3 +- .../armbilling/fake/transactions_server.go | 11 +- .../armbilling/fake/transfers_server.go | 9 +- sdk/resourcemanager/billing/armbilling/go.mod | 14 +- sdk/resourcemanager/billing/armbilling/go.sum | 17 - .../billing/armbilling/invoices_client.go | 9 +- .../invoices_client_example_test.go | 898 ------------ .../armbilling/invoicesections_client.go | 9 +- .../invoicesections_client_example_test.go | 258 ---- .../billing/armbilling/models_serde.go | 3 +- .../billing/armbilling/operations_client.go | 3 +- .../operations_client_example_test.go | 54 - .../billing/armbilling/options.go | 15 - .../armbilling/partnertransfers_client.go | 7 +- .../partnertransfers_client_example_test.go | 190 --- .../armbilling/paymentmethods_client.go | 7 +- .../paymentmethods_client_example_test.go | 316 ----- .../billing/armbilling/permissions_client.go | 7 +- .../permissions_client_example_test.go | 519 ------- .../billing/armbilling/policies_client.go | 7 +- .../policies_client_example_test.go | 333 ----- .../billing/armbilling/products_client.go | 9 +- .../products_client_example_test.go | 558 -------- .../billing/armbilling/profiles_client.go | 9 +- .../profiles_client_example_test.go | 548 -------- .../billing/armbilling/property_client.go | 166 --- .../property_client_example_test.go | 280 ---- .../armbilling/recipienttransfers_client.go | 7 +- .../recipienttransfers_client_example_test.go | 255 ---- .../billing/armbilling/requests_client.go | 9 +- .../requests_client_example_test.go | 557 -------- .../armbilling/reservationorders_client.go | 9 +- .../reservationorders_client_example_test.go | 540 -------- .../billing/armbilling/reservations_client.go | 9 +- .../reservations_client_example_test.go | 906 ------------ .../billing/armbilling/responses.go | 12 - .../armbilling/roleassignments_client.go | 9 +- .../roleassignments_client_example_test.go | 1212 ----------------- .../armbilling/roledefinition_client.go | 7 +- .../roledefinition_client_example_test.go | 986 -------------- .../armbilling/savingsplanorders_client.go | 9 +- .../savingsplanorders_client_example_test.go | 495 ------- .../billing/armbilling/savingsplans_client.go | 9 +- .../savingsplans_client_example_test.go | 707 ---------- .../armbilling/subscriptions_client.go | 9 +- .../subscriptions_client_example_test.go | 1106 --------------- .../armbilling/subscriptionsaliases_client.go | 9 +- ...ubscriptionsaliases_client_example_test.go | 286 ---- .../billing/armbilling/time_rfc3339.go | 3 +- .../billing/armbilling/transactions_client.go | 9 +- .../transactions_client_example_test.go | 675 --------- .../billing/armbilling/transfers_client.go | 7 +- .../transfers_client_example_test.go | 186 --- 106 files changed, 255 insertions(+), 14635 deletions(-) delete mode 100644 sdk/resourcemanager/billing/armbilling/accounts_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/address_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/agreements_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/associatedtenants_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/availablebalances_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/customers_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/departments_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/fake/property_server.go delete mode 100644 sdk/resourcemanager/billing/armbilling/invoices_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/invoicesections_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/partnertransfers_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/paymentmethods_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/permissions_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/policies_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/products_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/profiles_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/property_client.go delete mode 100644 sdk/resourcemanager/billing/armbilling/property_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/recipienttransfers_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/requests_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/reservationorders_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/reservations_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/roleassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/roledefinition_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/savingsplanorders_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/savingsplans_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/subscriptions_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/transactions_client_example_test.go delete mode 100644 sdk/resourcemanager/billing/armbilling/transfers_client_example_test.go diff --git a/sdk/resourcemanager/billing/armbilling/CHANGELOG.md b/sdk/resourcemanager/billing/armbilling/CHANGELOG.md index 9cee70e4140c..ef83f32727a1 100644 --- a/sdk/resourcemanager/billing/armbilling/CHANGELOG.md +++ b/sdk/resourcemanager/billing/armbilling/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## 2.0.0 (2024-09-19) +### Breaking Changes + +- Function `*ClientFactory.NewPropertyClient` has been removed +- Function `NewPropertyClient` has been removed +- Function `*PropertyClient.Get` has been removed +- Function `*PropertyClient.Update` has been removed + + ## 1.0.0 (2024-09-09) ### Breaking Changes diff --git a/sdk/resourcemanager/billing/armbilling/README.md b/sdk/resourcemanager/billing/armbilling/README.md index 628b4bd06c67..a49cbc882ddd 100644 --- a/sdk/resourcemanager/billing/armbilling/README.md +++ b/sdk/resourcemanager/billing/armbilling/README.md @@ -1,6 +1,6 @@ # Azure Billing Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2) The `armbilling` module provides operations for working with Azure Billing. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Billing module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/billing/armbilling/accounts_client.go b/sdk/resourcemanager/billing/armbilling/accounts_client.go index c611e02c908b..fb5ddbb04e55 100644 --- a/sdk/resourcemanager/billing/armbilling/accounts_client.go +++ b/sdk/resourcemanager/billing/armbilling/accounts_client.go @@ -11,16 +11,15 @@ package armbilling import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // AccountsClient contains the methods for the BillingAccounts group. diff --git a/sdk/resourcemanager/billing/armbilling/accounts_client_example_test.go b/sdk/resourcemanager/billing/armbilling/accounts_client_example_test.go deleted file mode 100644 index 6b4ff246f1a2..000000000000 --- a/sdk/resourcemanager/billing/armbilling/accounts_client_example_test.go +++ /dev/null @@ -1,899 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermsAdd.json -func ExampleAccountsClient_BeginAddPaymentTerms() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginAddPaymentTerms(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", []*armbilling.PaymentTerm{ - { - EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t }()), - StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t }()), - Term: to.Ptr("net10"), - }}, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/010000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermsCancel.json -func ExampleAccountsClient_BeginCancelPaymentTerms() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginCancelPaymentTerms(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t }(), 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/010000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsConfirmTransition.json -func ExampleAccountsClient_ConfirmTransition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().ConfirmTransition(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TransitionDetails = armbilling.TransitionDetails{ - // AnniversaryDay: to.Ptr[int32](12), - // TransitionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-17T00:00:00.000Z"); return t}()), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsWithCreateSubscriptionPermissionList.json -func ExampleAccountsClient_NewListInvoiceSectionsByCreateSubscriptionPermissionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListInvoiceSectionsByCreateSubscriptionPermissionPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.AccountsClientListInvoiceSectionsByCreateSubscriptionPermissionOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InvoiceSectionWithCreateSubPermissionListResult = armbilling.InvoiceSectionWithCreateSubPermissionListResult{ - // Value: []*armbilling.InvoiceSectionWithCreateSubPermission{ - // { - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileSpendingLimit: to.Ptr(armbilling.SpendingLimitOn), - // BillingProfileStatus: to.Ptr(armbilling.BillingProfileStatusWarned), - // BillingProfileStatusReasonCode: to.Ptr(armbilling.BillingProfileStatusReasonCodePastDue), - // BillingProfileSystemID: to.Ptr("33000000-0000-0000-0000-000000000000"), - // EnabledAzurePlans: []*armbilling.AzurePlan{ - // { - // SKUDescription: to.Ptr("Microsoft Azure Plan"), - // SKUID: to.Ptr("0001"), - // }, - // { - // SKUDescription: to.Ptr("Microsoft Azure Plan for DevTest"), - // SKUID: to.Ptr("0002"), - // }}, - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionSystemID: to.Ptr("22000000-0000-0000-0000-000000000000"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermInvalid.json -func ExampleAccountsClient_ValidatePaymentTerms_paymentTermInvalid() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().ValidatePaymentTerms(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", []*armbilling.PaymentTerm{ - { - EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t }()), - StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t }()), - Term: to.Ptr("net10"), - }}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PaymentTermsEligibilityResult = armbilling.PaymentTermsEligibilityResult{ - // EligibilityDetails: []*armbilling.PaymentTermsEligibilityDetail{ - // { - // Code: to.Ptr(armbilling.PaymentTermsEligibilityCodeInvalidDateRange), - // Message: to.Ptr("The date range is invalid. The start date must be before the end date."), - // }}, - // EligibilityStatus: to.Ptr(armbilling.PaymentTermsEligibilityStatusInvalid), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermValid.json -func ExampleAccountsClient_ValidatePaymentTerms_paymentTermValid() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().ValidatePaymentTerms(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", []*armbilling.PaymentTerm{ - { - EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t }()), - StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t }()), - Term: to.Ptr("net10"), - }}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PaymentTermsEligibilityResult = armbilling.PaymentTermsEligibilityResult{ - // EligibilityStatus: to.Ptr(armbilling.PaymentTermsEligibilityStatusValid), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithExpandForPONumber.json -func ExampleAccountsClient_Get_billingAccountWithExpandForPoNumber() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "8608480", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("6564892"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountType: to.Ptr(armbilling.AccountTypeEnterprise), - // AgreementType: to.Ptr(armbilling.AgreementTypeEnterpriseAgreement), - // DisplayName: to.Ptr("Enterprise Account"), - // EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{ - // BillingCycle: to.Ptr("Monthly"), - // Channel: to.Ptr("EaDirect"), - // Cloud: to.Ptr("Azure Commercial"), - // CountryCode: to.Ptr("US"), - // Currency: to.Ptr("USD"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // ExtendedTermOption: to.Ptr(armbilling.ExtendedTermOptionOptedOut), - // PoNumber: to.Ptr("poNumber123"), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // SupportCoverage: to.Ptr("1/26/2021 - 6/30/2021"), - // SupportLevel: to.Ptr(armbilling.SupportLevelStandard), - // Language: to.Ptr("en"), - // }, - // HasReadAccess: to.Ptr(true), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithDefaultType.json -func ExampleAccountsClient_Get_billingAccountWithRegistrationNumberWithDefaultType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // RegistrationNumber: &armbilling.AccountPropertiesRegistrationNumber{ - // Type: []*string{ - // to.Ptr("RegistrationNumber")}, - // ID: to.Ptr("RegistrationId"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountWithRegistrationNumberWithType.json -func ExampleAccountsClient_Get_billingAccountWithRegistrationNumberWithType() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // RegistrationNumber: &armbilling.AccountPropertiesRegistrationNumber{ - // Type: []*string{ - // to.Ptr("TIN")}, - // ID: to.Ptr("SomeRegistrationId"), - // Required: to.Ptr(true), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json -func ExampleAccountsClient_Get_billingAccountsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json -func ExampleAccountsClient_Get_billingAccountsGetEa() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "6575495", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("6575495"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6575495"), - // Properties: &armbilling.AccountProperties{ - // AgreementType: to.Ptr(armbilling.AgreementTypeEnterpriseAgreement), - // EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{ - // BillingCycle: to.Ptr("Monthly"), - // Channel: to.Ptr("EaDirect"), - // Cloud: to.Ptr("Azure Commercial"), - // CountryCode: to.Ptr("US"), - // Currency: to.Ptr("USD"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // ExtendedTermOption: to.Ptr(armbilling.ExtendedTermOptionOptedOut), - // IndirectRelationshipInfo: &armbilling.EnrollmentDetailsIndirectRelationshipInfo{ - // BillingAccountName: to.Ptr("pcn.12345"), - // BillingProfileName: to.Ptr(""), - // DisplayName: to.Ptr("Test partner"), - // }, - // InvoiceRecipient: to.Ptr("abc@contoso.com"), - // MarkupStatus: to.Ptr(armbilling.MarkupStatusPublished), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // SupportCoverage: to.Ptr("1/26/2021 - 6/30/2021"), - // SupportLevel: to.Ptr(armbilling.SupportLevelStandard), - // Language: to.Ptr("en"), - // }, - // SoldTo: &armbilling.AccountPropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address"), - // AddressLine2: to.Ptr("Test Address"), - // AddressLine3: to.Ptr("Test Address"), - // City: to.Ptr("City"), - // Country: to.Ptr("US"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand.json -func ExampleAccountsClient_Get_billingAccountsGetWithExpand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // SoldTo: &armbilling.AccountPropertiesSoldTo{ - // AddressLine1: to.Ptr("1 Microsoft Way"), - // City: to.Ptr("Redmond"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // IsValidAddress: to.Ptr(true), - // PostalCode: to.Ptr("98052-8300"), - // Region: to.Ptr("WA"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountUpdateWithPONumber.json -func ExampleAccountsClient_BeginUpdate_billingAccountUpdateWithPoNumber() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginUpdate(ctx, "6575495", armbilling.AccountPatch{ - Properties: &armbilling.AccountProperties{ - EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{ - PoNumber: to.Ptr("poNumber123"), - }, - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("6575495"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6575495"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeNone), - // AccountType: to.Ptr(armbilling.AccountTypeEnterprise), - // AgreementType: to.Ptr(armbilling.AgreementTypeEnterpriseAgreement), - // DisplayName: to.Ptr("Enterprise Account"), - // EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{ - // BillingCycle: to.Ptr("Monthly"), - // Channel: to.Ptr("EaDirect"), - // Cloud: to.Ptr("Azure Commercial"), - // CountryCode: to.Ptr("US"), - // Currency: to.Ptr("USD"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // ExtendedTermOption: to.Ptr(armbilling.ExtendedTermOptionOptedOut), - // PoNumber: to.Ptr("poNumber123"), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // SupportCoverage: to.Ptr("1/26/2021 - 6/30/2021"), - // SupportLevel: to.Ptr(armbilling.SupportLevelStandard), - // Language: to.Ptr("en"), - // }, - // HasReadAccess: to.Ptr(true), - // SoldTo: &armbilling.AccountPropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address"), - // AddressLine2: to.Ptr("Test Address"), - // AddressLine3: to.Ptr("Test Address"), - // City: to.Ptr("City"), - // Country: to.Ptr("US"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsUpdate.json -func ExampleAccountsClient_BeginUpdate_billingAccountsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginUpdate(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", armbilling.AccountPatch{ - Properties: &armbilling.AccountProperties{ - DisplayName: to.Ptr("Test Account"), - SoldTo: &armbilling.AccountPropertiesSoldTo{ - AddressLine1: to.Ptr("1 Microsoft Way"), - City: to.Ptr("Redmond"), - CompanyName: to.Ptr("Contoso"), - Country: to.Ptr("US"), - PostalCode: to.Ptr("98052-8300"), - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armbilling.Account{ - // Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // SoldTo: &armbilling.AccountPropertiesSoldTo{ - // AddressLine1: to.Ptr("1 Microsoft Way"), - // City: to.Ptr("Redmond"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // IsValidAddress: to.Ptr(true), - // PostalCode: to.Ptr("98052-8300"), - // Region: to.Ptr("WA"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountForLegacyAccountDetails.json -func ExampleAccountsClient_NewListPager_billingAccountForLegacyAccountDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListPager(&armbilling.AccountsClientListOptions{IncludeAll: nil, - IncludeAllWithoutBillingProfiles: nil, - IncludeDeleted: nil, - IncludePendingAgreement: nil, - IncludeResellee: nil, - LegalOwnerTID: nil, - LegalOwnerOID: nil, - Filter: nil, - Expand: nil, - Top: nil, - Skip: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountListResult = armbilling.AccountListResult{ - // Value: []*armbilling.Account{ - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-0000-0000-0000-000000000001"), - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountType: to.Ptr(armbilling.AccountTypeIndividual), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftOnlineServicesProgram), - // DisplayName: to.Ptr("Individual Account 2"), - // HasReadAccess: to.Ptr(true), - // NotificationEmailAddress: to.Ptr("individual@domain.com"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsList.json -func ExampleAccountsClient_NewListPager_billingAccountsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListPager(&armbilling.AccountsClientListOptions{IncludeAll: nil, - IncludeAllWithoutBillingProfiles: nil, - IncludeDeleted: nil, - IncludePendingAgreement: nil, - IncludeResellee: nil, - LegalOwnerTID: nil, - LegalOwnerOID: nil, - Filter: nil, - Expand: nil, - Top: nil, - Skip: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountListResult = armbilling.AccountListResult{ - // Value: []*armbilling.Account{ - // { - // Name: to.Ptr("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // }, - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/20000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeProfessional), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Standard Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // }, - // { - // Name: to.Ptr("30000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/30000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeIndividual), - // AccountType: to.Ptr(armbilling.AccountTypeIndividual), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // DisplayName: to.Ptr("Individual Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // }, - // { - // Name: to.Ptr("40000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/40000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeEnterprise), - // AccountType: to.Ptr(armbilling.AccountTypeBusiness), - // AgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftPartnerAgreement), - // DisplayName: to.Ptr("Premier Business Account"), - // HasReadAccess: to.Ptr(true), - // PrimaryBillingTenantID: to.Ptr("20000000-0000-0000-0000-000000000001"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsListWithExpandForPONumber.json -func ExampleAccountsClient_NewListPager_billingAccountsListWithExpandForPoNumber() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListPager(&armbilling.AccountsClientListOptions{IncludeAll: nil, - IncludeAllWithoutBillingProfiles: nil, - IncludeDeleted: nil, - IncludePendingAgreement: nil, - IncludeResellee: nil, - LegalOwnerTID: nil, - LegalOwnerOID: nil, - Filter: nil, - Expand: to.Ptr("soldTo,enrollmentDetails/poNumber"), - Top: nil, - Skip: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountListResult = armbilling.AccountListResult{ - // Value: []*armbilling.Account{ - // { - // Name: to.Ptr("6564892"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.AccountProperties{ - // AccountStatus: to.Ptr(armbilling.AccountStatusActive), - // AccountSubType: to.Ptr(armbilling.AccountSubTypeNone), - // AccountType: to.Ptr(armbilling.AccountTypeEnterprise), - // AgreementType: to.Ptr(armbilling.AgreementTypeEnterpriseAgreement), - // DisplayName: to.Ptr("Enterprise Account"), - // EnrollmentDetails: &armbilling.AccountPropertiesEnrollmentDetails{ - // BillingCycle: to.Ptr("Monthly"), - // Channel: to.Ptr("EaDirect"), - // Cloud: to.Ptr("Azure Commercial"), - // CountryCode: to.Ptr("US"), - // Currency: to.Ptr("USD"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // ExtendedTermOption: to.Ptr(armbilling.ExtendedTermOptionOptedOut), - // PoNumber: to.Ptr("poNumber123"), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // SupportCoverage: to.Ptr("1/26/2021 - 6/30/2021"), - // SupportLevel: to.Ptr(armbilling.SupportLevelStandard), - // Language: to.Ptr("en"), - // }, - // HasReadAccess: to.Ptr(true), - // SoldTo: &armbilling.AccountPropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Enterprise Company"), - // Country: to.Ptr("US"), - // PostalCode: to.Ptr("00000-1111"), - // Region: to.Ptr("WA"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/address_client.go b/sdk/resourcemanager/billing/armbilling/address_client.go index 39f3c7d85696..f44b1385f0a4 100644 --- a/sdk/resourcemanager/billing/armbilling/address_client.go +++ b/sdk/resourcemanager/billing/armbilling/address_client.go @@ -10,12 +10,11 @@ package armbilling import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // AddressClient contains the methods for the Address group. diff --git a/sdk/resourcemanager/billing/armbilling/address_client_example_test.go b/sdk/resourcemanager/billing/armbilling/address_client_example_test.go deleted file mode 100644 index b7c01f319609..000000000000 --- a/sdk/resourcemanager/billing/armbilling/address_client_example_test.go +++ /dev/null @@ -1,93 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/addressValidateInvalid.json -func ExampleAddressClient_Validate_addressValidateInvalid() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAddressClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AddressValidationResponse = armbilling.AddressValidationResponse{ - // Status: to.Ptr(armbilling.AddressValidationStatusInvalid), - // SuggestedAddresses: []*armbilling.AddressDetails{ - // { - // AddressLine1: to.Ptr("1 Test Address"), - // City: to.Ptr("Bellevue"), - // Country: to.Ptr("US"), - // PostalCode: to.Ptr("98052"), - // Region: to.Ptr("WA"), - // }, - // { - // AddressLine1: to.Ptr("1 Test Address"), - // City: to.Ptr("Bellevue"), - // Country: to.Ptr("US"), - // PostalCode: to.Ptr("12345-0000"), - // Region: to.Ptr("WA"), - // }}, - // ValidationMessage: to.Ptr("Invalid address"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/addressValidateValid.json -func ExampleAddressClient_Validate_addressValidateValid() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAddressClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AddressValidationResponse = armbilling.AddressValidationResponse{ - // Status: to.Ptr(armbilling.AddressValidationStatusValid), - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/agreements_client.go b/sdk/resourcemanager/billing/armbilling/agreements_client.go index b81674cdd025..56b6e731c754 100644 --- a/sdk/resourcemanager/billing/armbilling/agreements_client.go +++ b/sdk/resourcemanager/billing/armbilling/agreements_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AgreementsClient contains the methods for the Agreements group. diff --git a/sdk/resourcemanager/billing/armbilling/agreements_client_example_test.go b/sdk/resourcemanager/billing/armbilling/agreements_client_example_test.go deleted file mode 100644 index 0a657aba7158..000000000000 --- a/sdk/resourcemanager/billing/armbilling/agreements_client_example_test.go +++ /dev/null @@ -1,126 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAgreementsClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "ABC123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Agreement = armbilling.Agreement{ - // Name: to.Ptr("ABC123"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/agreements"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/agreements/ABC123"), - // Properties: &armbilling.AgreementProperties{ - // AcceptanceMode: to.Ptr(armbilling.AcceptanceModeClickToAccept), - // AgreementLink: to.Ptr("https://contoso.com"), - // DisplayName: to.Ptr("Microsoft Customer Agreement"), - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-01T00:00:00.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00.000Z"); return t}()), - // LeadBillingAccountName: to.Ptr("20000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Status: to.Ptr("Active"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAgreementsClient().NewListByBillingAccountPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.AgreementsClientListByBillingAccountOptions{Expand: to.Ptr("Participants")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AgreementListResult = armbilling.AgreementListResult{ - // Value: []*armbilling.Agreement{ - // { - // Name: to.Ptr("ABC123"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/agreements"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/agreements/ABC123"), - // Properties: &armbilling.AgreementProperties{ - // AcceptanceMode: to.Ptr(armbilling.AcceptanceModeClickToAccept), - // AgreementLink: to.Ptr("https://contoso.com"), - // DisplayName: to.Ptr("Microsoft Customer Agreement"), - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-01T00:00:00.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00.000Z"); return t}()), - // LeadBillingAccountName: to.Ptr("20000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Participants: []*armbilling.Participant{ - // { - // Email: to.Ptr("abc@contoso.com"), - // Status: to.Ptr("Accepted"), - // StatusDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-01T00:00:00.000Z"); return t}()), - // }, - // { - // Email: to.Ptr("xtz@contoso.com"), - // Status: to.Ptr("Declined"), - // StatusDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-02T00:00:00.000Z"); return t}()), - // }}, - // Status: to.Ptr("Active"), - // }, - // }, - // { - // Name: to.Ptr("DEF456"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/agreements"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/agreements/DEF456"), - // Properties: &armbilling.AgreementProperties{ - // AcceptanceMode: to.Ptr(armbilling.AcceptanceModeESignEmbedded), - // AgreementLink: to.Ptr("https://contoso.com"), - // DisplayName: to.Ptr("Microsoft Customer Agreement"), - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-05T00:00:00.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-05T00:00:00.000Z"); return t}()), - // LeadBillingAccountName: to.Ptr("20000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // Participants: []*armbilling.Participant{ - // { - // Email: to.Ptr("abc@contoso.com"), - // Status: to.Ptr("Pending"), - // StatusDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-12-05T00:00:00.000Z"); return t}()), - // }}, - // Status: to.Ptr("PendingSignature"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/associatedtenants_client.go b/sdk/resourcemanager/billing/armbilling/associatedtenants_client.go index 72c24f2bc363..7e3da0262cf4 100644 --- a/sdk/resourcemanager/billing/armbilling/associatedtenants_client.go +++ b/sdk/resourcemanager/billing/armbilling/associatedtenants_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // AssociatedTenantsClient contains the methods for the AssociatedTenants group. diff --git a/sdk/resourcemanager/billing/armbilling/associatedtenants_client_example_test.go b/sdk/resourcemanager/billing/armbilling/associatedtenants_client_example_test.go deleted file mode 100644 index 86c73cfe3c38..000000000000 --- a/sdk/resourcemanager/billing/armbilling/associatedtenants_client_example_test.go +++ /dev/null @@ -1,172 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsDelete.json -func ExampleAssociatedTenantsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssociatedTenantsClient().BeginDelete(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsGet.json -func ExampleAssociatedTenantsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssociatedTenantsClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssociatedTenant = armbilling.AssociatedTenant{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/associatedTenants"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/associatedTenants/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.AssociatedTenantProperties{ - // BillingManagementState: to.Ptr(armbilling.BillingManagementTenantStateActive), - // DisplayName: to.Ptr("Contoso Finance"), - // ProvisioningBillingRequestID: to.Ptr("/providers/Microsoft.Billing/billingRequests/22222222-2222-2222-2222-222222222222"), - // ProvisioningManagementState: to.Ptr(armbilling.ProvisioningTenantStatePending), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsCreateOrUpdate.json -func ExampleAssociatedTenantsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssociatedTenantsClient().BeginCreateOrUpdate(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.AssociatedTenant{ - Properties: &armbilling.AssociatedTenantProperties{ - BillingManagementState: to.Ptr(armbilling.BillingManagementTenantStateActive), - DisplayName: to.Ptr("Contoso Finance"), - ProvisioningManagementState: to.Ptr(armbilling.ProvisioningTenantStatePending), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssociatedTenant = armbilling.AssociatedTenant{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/associatedTenants"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/associatedTenants/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.AssociatedTenantProperties{ - // BillingManagementState: to.Ptr(armbilling.BillingManagementTenantStateActive), - // DisplayName: to.Ptr("Contoso Finance"), - // ProvisioningBillingRequestID: to.Ptr("/providers/Microsoft.Billing/billingRequests/22222222-2222-2222-2222-222222222222"), - // ProvisioningManagementState: to.Ptr(armbilling.ProvisioningTenantStatePending), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsListByBillingAccount.json -func ExampleAssociatedTenantsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssociatedTenantsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.AssociatedTenantsClientListByBillingAccountOptions{IncludeRevoked: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssociatedTenantListResult = armbilling.AssociatedTenantListResult{ - // Value: []*armbilling.AssociatedTenant{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/associatedTenants"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-000000000000:00000000-0000-0000-000000000000_2019-05-31/associatedTenants/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.AssociatedTenantProperties{ - // BillingManagementState: to.Ptr(armbilling.BillingManagementTenantStateActive), - // DisplayName: to.Ptr("Contoso Finance"), - // ProvisioningManagementState: to.Ptr(armbilling.ProvisioningTenantStateNotRequested), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // { - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/associatedTenants"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-000000000000:00000000-0000-0000-000000000000_2019-05-31/associatedTenants/22222222-2222-2222-2222-222222222222"), - // Properties: &armbilling.AssociatedTenantProperties{ - // BillingManagementState: to.Ptr(armbilling.BillingManagementTenantStateNotAllowed), - // DisplayName: to.Ptr("Contoso Engineering"), - // ProvisioningBillingRequestID: to.Ptr("/providers/Microsoft.Billing/billingRequests/22222222-2222-2222-2222-222222222222"), - // ProvisioningManagementState: to.Ptr(armbilling.ProvisioningTenantStatePending), - // TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/autorest.md b/sdk/resourcemanager/billing/armbilling/autorest.md index 5b958d2c3b8e..2fb0587721e9 100644 --- a/sdk/resourcemanager/billing/armbilling/autorest.md +++ b/sdk/resourcemanager/billing/armbilling/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/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: 1.0.0 -tag: package-2024-04 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/billing/armbilling/availablebalances_client.go b/sdk/resourcemanager/billing/armbilling/availablebalances_client.go index 9db0e6571d36..56ee198e8065 100644 --- a/sdk/resourcemanager/billing/armbilling/availablebalances_client.go +++ b/sdk/resourcemanager/billing/armbilling/availablebalances_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailableBalancesClient contains the methods for the AvailableBalances group. diff --git a/sdk/resourcemanager/billing/armbilling/availablebalances_client_example_test.go b/sdk/resourcemanager/billing/armbilling/availablebalances_client_example_test.go deleted file mode 100644 index 2af4ce8de594..000000000000 --- a/sdk/resourcemanager/billing/armbilling/availablebalances_client_example_test.go +++ /dev/null @@ -1,126 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/availableBalanceGetByBillingAccount.json -func ExampleAvailableBalancesClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailableBalancesClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailableBalance = armbilling.AvailableBalance{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/availableBalance"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/availableBalance/default"), - // Properties: &armbilling.AvailableBalanceProperties{ - // Amount: &armbilling.AvailableBalancePropertiesAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](500), - // }, - // PaymentsOnAccount: []*armbilling.PaymentOnAccount{ - // { - // Amount: &armbilling.PaymentOnAccountAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Finance"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T00:00:00.000Z"); return t}()), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // InvoiceName: to.Ptr("G123456789"), - // PaymentMethodType: to.Ptr(armbilling.PaymentMethodFamilyCheckWire), - // }, - // { - // Amount: &armbilling.PaymentOnAccountAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](150), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Engineering"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/yyyy-yyyy-yyy-yyy"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T00:00:00.000Z"); return t}()), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G987654321"), - // InvoiceName: to.Ptr("G987654321"), - // PaymentMethodType: to.Ptr(armbilling.PaymentMethodFamilyCheckWire), - // }}, - // TotalPaymentsOnAccount: &armbilling.AvailableBalancePropertiesTotalPaymentsOnAccount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](200), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/availableBalanceGetByBillingProfile.json -func ExampleAvailableBalancesClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailableBalancesClient().GetByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailableBalance = armbilling.AvailableBalance{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/availableBalance"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/availableBalance/default"), - // Properties: &armbilling.AvailableBalanceProperties{ - // Amount: &armbilling.AvailableBalancePropertiesAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](500), - // }, - // PaymentsOnAccount: []*armbilling.PaymentOnAccount{ - // { - // Amount: &armbilling.PaymentOnAccountAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Finance"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T00:00:00.000Z"); return t}()), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // InvoiceName: to.Ptr("G123456789"), - // PaymentMethodType: to.Ptr(armbilling.PaymentMethodFamilyCheckWire), - // }}, - // TotalPaymentsOnAccount: &armbilling.AvailableBalancePropertiesTotalPaymentsOnAccount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](200), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/client_factory.go b/sdk/resourcemanager/billing/armbilling/client_factory.go index edf5fc6207e1..fbbb41833be2 100644 --- a/sdk/resourcemanager/billing/armbilling/client_factory.go +++ b/sdk/resourcemanager/billing/armbilling/client_factory.go @@ -157,14 +157,6 @@ func (c *ClientFactory) NewProfilesClient() *ProfilesClient { } } -// NewPropertyClient creates a new instance of PropertyClient. -func (c *ClientFactory) NewPropertyClient() *PropertyClient { - return &PropertyClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - // NewRecipientTransfersClient creates a new instance of RecipientTransfersClient. func (c *ClientFactory) NewRecipientTransfersClient() *RecipientTransfersClient { return &RecipientTransfersClient{ diff --git a/sdk/resourcemanager/billing/armbilling/constants.go b/sdk/resourcemanager/billing/armbilling/constants.go index cace7d9824f9..6bdc14fab7dc 100644 --- a/sdk/resourcemanager/billing/armbilling/constants.go +++ b/sdk/resourcemanager/billing/armbilling/constants.go @@ -10,7 +10,7 @@ package armbilling const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // AcceptanceMode - The mode of acceptance for an agreement. diff --git a/sdk/resourcemanager/billing/armbilling/customers_client.go b/sdk/resourcemanager/billing/armbilling/customers_client.go index 09800d9bfc45..e236f072e13d 100644 --- a/sdk/resourcemanager/billing/armbilling/customers_client.go +++ b/sdk/resourcemanager/billing/armbilling/customers_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // CustomersClient contains the methods for the Customers group. diff --git a/sdk/resourcemanager/billing/armbilling/customers_client_example_test.go b/sdk/resourcemanager/billing/armbilling/customers_client_example_test.go deleted file mode 100644 index 713b5f35d206..000000000000 --- a/sdk/resourcemanager/billing/armbilling/customers_client_example_test.go +++ /dev/null @@ -1,310 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersGet.json -func ExampleCustomersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomersClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Customer = armbilling.Customer{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer1"), - // EnabledAzurePlans: []*armbilling.AzurePlan{ - // { - // SKUDescription: to.Ptr("Microsoft Azure Plan for DevTest"), - // SKUID: to.Ptr("0002"), - // }}, - // Resellers: []*armbilling.Reseller{ - // { - // Description: to.Ptr("Reseller1"), - // ResellerID: to.Ptr("89e87bdf-a2a2-4687-925f-4c18b27bccfd"), - // }, - // { - // Description: to.Ptr("Reseller2"), - // ResellerID: to.Ptr("3b65b5a8-bd4f-4084-90e9-e1bd667a2b19"), - // }}, - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomersClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", &armbilling.CustomersClientListByBillingProfileOptions{Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomerListResult = armbilling.CustomerListResult{ - // Value: []*armbilling.Customer{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer1"), - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // }, - // { - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/22222222-2222-2222-2222-222222222222"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer2"), - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("zzzz-zzzz-zzz-zzz"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersGetByBillingAccount.json -func ExampleCustomersClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomersClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Customer = armbilling.Customer{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer1"), - // EnabledAzurePlans: []*armbilling.AzurePlan{ - // { - // SKUDescription: to.Ptr("Microsoft Azure Plan for DevTest"), - // SKUID: to.Ptr("0002"), - // }}, - // Resellers: []*armbilling.Reseller{ - // { - // Description: to.Ptr("Reseller1"), - // ResellerID: to.Ptr("89e87bdf-a2a2-4687-925f-4c18b27bccfd"), - // }, - // { - // Description: to.Ptr("Reseller2"), - // ResellerID: to.Ptr("3b65b5a8-bd4f-4084-90e9-e1bd667a2b19"), - // }}, - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersListByBillingAccount.json -func ExampleCustomersClient_NewListByBillingAccountPager_customersListByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomersClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.CustomersClientListByBillingAccountOptions{Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomerListResult = armbilling.CustomerListResult{ - // Value: []*armbilling.Customer{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer1"), - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // }, - // { - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/22222222-2222-2222-2222-222222222222"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer2"), - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("zzzz-zzzz-zzz-zzz"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersListByBillingAccountWithExpand.json -func ExampleCustomersClient_NewListByBillingAccountPager_customersListByBillingAccountWithExpand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomersClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.CustomersClientListByBillingAccountOptions{Expand: to.Ptr("enabledAzurePlans,resellers"), - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomerListResult = armbilling.CustomerListResult{ - // Value: []*armbilling.Customer{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.CustomerProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("customer1"), - // EnabledAzurePlans: []*armbilling.AzurePlan{ - // { - // SKUDescription: to.Ptr("Microsoft Azure Plan for DevTest"), - // SKUID: to.Ptr("0002"), - // }}, - // Resellers: []*armbilling.Reseller{ - // { - // Description: to.Ptr("Reseller1"), - // ResellerID: to.Ptr("89e87bdf-a2a2-4687-925f-4c18b27bccfd"), - // }, - // { - // Description: to.Ptr("Reseller2"), - // ResellerID: to.Ptr("3b65b5a8-bd4f-4084-90e9-e1bd667a2b19"), - // }}, - // Status: to.Ptr(armbilling.CustomerStatusActive), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/date_type.go b/sdk/resourcemanager/billing/armbilling/date_type.go index 50bb7e53c398..f5767b93bd63 100644 --- a/sdk/resourcemanager/billing/armbilling/date_type.go +++ b/sdk/resourcemanager/billing/armbilling/date_type.go @@ -11,10 +11,9 @@ package armbilling import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) const ( diff --git a/sdk/resourcemanager/billing/armbilling/departments_client.go b/sdk/resourcemanager/billing/armbilling/departments_client.go index 8ae370572fbf..6d50c3cced8c 100644 --- a/sdk/resourcemanager/billing/armbilling/departments_client.go +++ b/sdk/resourcemanager/billing/armbilling/departments_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // DepartmentsClient contains the methods for the Departments group. diff --git a/sdk/resourcemanager/billing/armbilling/departments_client_example_test.go b/sdk/resourcemanager/billing/armbilling/departments_client_example_test.go deleted file mode 100644 index b270f52e325a..000000000000 --- a/sdk/resourcemanager/billing/armbilling/departments_client_example_test.go +++ /dev/null @@ -1,101 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/departmentGet.json -func ExampleDepartmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDepartmentsClient().Get(ctx, "456598", "164821", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Department = armbilling.Department{ - // Name: to.Ptr("164821"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/456598/departments/164821"), - // Properties: &armbilling.DepartmentProperties{ - // CostCenter: to.Ptr("C1"), - // DisplayName: to.Ptr("Test department"), - // Status: to.Ptr("Active"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/departmentsListByBillingAccount.json -func ExampleDepartmentsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDepartmentsClient().NewListByBillingAccountPager("456598", &armbilling.DepartmentsClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DepartmentListResult = armbilling.DepartmentListResult{ - // Value: []*armbilling.Department{ - // { - // Name: to.Ptr("164821"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/456598/departments/164821"), - // Properties: &armbilling.DepartmentProperties{ - // CostCenter: to.Ptr("C1"), - // DisplayName: to.Ptr("departmentName1"), - // Status: to.Ptr("Active"), - // }, - // }, - // { - // Name: to.Ptr("164822"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/456598/departments/164822"), - // Properties: &armbilling.DepartmentProperties{ - // CostCenter: to.Ptr("C4"), - // DisplayName: to.Ptr("departmentName2"), - // Status: to.Ptr("Active"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go b/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go index 694e9b71822b..aea29a129bbd 100644 --- a/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go +++ b/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // EnrollmentAccountsClient contains the methods for the EnrollmentAccounts group. diff --git a/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client_example_test.go b/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client_example_test.go deleted file mode 100644 index ed55d585f339..000000000000 --- a/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client_example_test.go +++ /dev/null @@ -1,245 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountByDepartment.json -func ExampleEnrollmentAccountsClient_GetByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnrollmentAccountsClient().GetByDepartment(ctx, "6564892", "164821", "257698", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnrollmentAccount = armbilling.EnrollmentAccount{ - // Name: to.Ptr("257698"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/departments/164821/enrollmentAccounts/257698"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account0@contoso.com"), - // AuthType: to.Ptr("MicrosoftAccount"), - // CostCenter: to.Ptr("C0"), - // DepartmentDisplayName: to.Ptr("TestDept"), - // DepartmentID: to.Ptr("164821"), - // DisplayName: to.Ptr("AccountName0"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(true), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountsListByDepartment.json -func ExampleEnrollmentAccountsClient_NewListByDepartmentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEnrollmentAccountsClient().NewListByDepartmentPager("6564892", "164821", &armbilling.EnrollmentAccountsClientListByDepartmentOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EnrollmentAccountListResult = armbilling.EnrollmentAccountListResult{ - // Value: []*armbilling.EnrollmentAccount{ - // { - // Name: to.Ptr("257698"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/departments/164821/enrollmentAccounts/257698"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account0@contoso.com"), - // AuthType: to.Ptr("MicrosoftAccount"), - // CostCenter: to.Ptr("C0"), - // DepartmentDisplayName: to.Ptr("TestDept"), - // DepartmentID: to.Ptr("164821"), - // DisplayName: to.Ptr("AccountName0"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(true), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // }, - // { - // Name: to.Ptr("264698"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/departments/164821/enrollmentAccounts/264698"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account1@contoso.com"), - // AuthType: to.Ptr("Organization"), - // CostCenter: to.Ptr("C1"), - // DepartmentDisplayName: to.Ptr("TestDept"), - // DepartmentID: to.Ptr("164821"), - // DisplayName: to.Ptr("AccountName1"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(false), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountGet.json -func ExampleEnrollmentAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnrollmentAccountsClient().Get(ctx, "6564892", "257698", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnrollmentAccount = armbilling.EnrollmentAccount{ - // Name: to.Ptr("257698"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/enrollmentAccounts/257698"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account0@contoso.com"), - // AuthType: to.Ptr("Organization"), - // CostCenter: to.Ptr("C0"), - // DepartmentDisplayName: to.Ptr("TestDept123"), - // DepartmentID: to.Ptr("234516"), - // DisplayName: to.Ptr("AccountName0"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(true), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountsListByBillingAccount.json -func ExampleEnrollmentAccountsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEnrollmentAccountsClient().NewListByBillingAccountPager("6564892", &armbilling.EnrollmentAccountsClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EnrollmentAccountListResult = armbilling.EnrollmentAccountListResult{ - // Value: []*armbilling.EnrollmentAccount{ - // { - // Name: to.Ptr("257698"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/enrollmentAccounts/257698"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account0@contoso.com"), - // AuthType: to.Ptr("Organization"), - // CostCenter: to.Ptr("C0"), - // DepartmentDisplayName: to.Ptr("TestDept123"), - // DepartmentID: to.Ptr("234516"), - // DisplayName: to.Ptr("AccountName0"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(true), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // }, - // { - // Name: to.Ptr("264698"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/enrollmentAccounts/264698"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account1@contoso.com"), - // AuthType: to.Ptr("MicrosoftAccount"), - // CostCenter: to.Ptr("C1"), - // DepartmentDisplayName: to.Ptr("TestDept1"), - // DepartmentID: to.Ptr("234531"), - // DisplayName: to.Ptr("AccountName1"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(true), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // }, - // { - // Name: to.Ptr("276290"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/enrollmentAccounts/276290"), - // Properties: &armbilling.EnrollmentAccountProperties{ - // AccountOwner: to.Ptr("account2@contoso.com"), - // AuthType: to.Ptr("Organization"), - // CostCenter: to.Ptr("C2"), - // DepartmentDisplayName: to.Ptr("TestDept2"), - // DepartmentID: to.Ptr("234512"), - // DisplayName: to.Ptr("AccountName2"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-31T17:32:28.000Z"); return t}()), - // IsDevTestEnabled: to.Ptr(true), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-01T17:32:28.000Z"); return t}()), - // Status: to.Ptr("Active"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/fake/accounts_server.go b/sdk/resourcemanager/billing/armbilling/fake/accounts_server.go index 5d44940214a7..a5f16a144bad 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/accounts_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/accounts_server.go @@ -12,17 +12,16 @@ import ( "context" "errors" "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" "net/http" "net/url" "regexp" "strconv" "time" - - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" ) // AccountsServer is a fake server for instances of the armbilling.AccountsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/address_server.go b/sdk/resourcemanager/billing/armbilling/fake/address_server.go index 0bfa78711910..44e61edabdbb 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/address_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/address_server.go @@ -12,12 +12,11 @@ import ( "context" "errors" "fmt" - "net/http" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" ) // AddressServer is a fake server for instances of the armbilling.AddressClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go b/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go index 8f2614dbeb2a..f0c202507686 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // AgreementsServer is a fake server for instances of the armbilling.AgreementsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go b/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go index 6380ca83ff21..9a0fe19f87ba 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // AssociatedTenantsServer is a fake server for instances of the armbilling.AssociatedTenantsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go b/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go index a9d4dbd3578d..56ccaf6aa3df 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // AvailableBalancesServer is a fake server for instances of the armbilling.AvailableBalancesClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/customers_server.go b/sdk/resourcemanager/billing/armbilling/fake/customers_server.go index bb3a9f77de99..c9ee6c2b0d15 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/customers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/customers_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // CustomersServer is a fake server for instances of the armbilling.CustomersClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/date_type.go b/sdk/resourcemanager/billing/armbilling/fake/date_type.go index 0fcc8f604e56..6a8d61c6788c 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/date_type.go +++ b/sdk/resourcemanager/billing/armbilling/fake/date_type.go @@ -11,10 +11,9 @@ package fake import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) const ( diff --git a/sdk/resourcemanager/billing/armbilling/fake/departments_server.go b/sdk/resourcemanager/billing/armbilling/fake/departments_server.go index 676e4cfed8e0..42c2de8fd99d 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/departments_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/departments_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // DepartmentsServer is a fake server for instances of the armbilling.DepartmentsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go b/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go index baf476f747ac..02e35acd5753 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // EnrollmentAccountsServer is a fake server for instances of the armbilling.EnrollmentAccountsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/internal.go b/sdk/resourcemanager/billing/armbilling/fake/internal.go index 9b74f6994585..72f540f217a1 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/internal.go +++ b/sdk/resourcemanager/billing/armbilling/fake/internal.go @@ -9,11 +9,10 @@ package fake import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" "reflect" "sync" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" ) type nonRetriableError struct { diff --git a/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go b/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go index cbbb92e100ce..09a445709476 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go @@ -12,17 +12,16 @@ import ( "context" "errors" "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" "net/http" "net/url" "regexp" "strconv" "time" - - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" ) // InvoicesServer is a fake server for instances of the armbilling.InvoicesClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go b/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go index fab7b99e45f6..950bf77d5b0b 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // InvoiceSectionsServer is a fake server for instances of the armbilling.InvoiceSectionsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/operations_server.go b/sdk/resourcemanager/billing/armbilling/fake/operations_server.go index b72acbab8efc..fce3fa43730e 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/operations_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/operations_server.go @@ -11,13 +11,12 @@ package fake import ( "errors" "fmt" - "net/http" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" ) // OperationsServer is a fake server for instances of the armbilling.OperationsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go b/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go index 2ddfff374544..9c5ddcf17d6c 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // PartnerTransfersServer is a fake server for instances of the armbilling.PartnerTransfersClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go b/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go index 4dbc9ad461ed..21951f46abd6 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // PaymentMethodsServer is a fake server for instances of the armbilling.PaymentMethodsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go b/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go index f0dda8ebf627..8cd247b402cd 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // PermissionsServer is a fake server for instances of the armbilling.PermissionsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/policies_server.go b/sdk/resourcemanager/billing/armbilling/fake/policies_server.go index 592bda54a4f6..d07e23a479a9 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/policies_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/policies_server.go @@ -12,14 +12,13 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // PoliciesServer is a fake server for instances of the armbilling.PoliciesClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/products_server.go b/sdk/resourcemanager/billing/armbilling/fake/products_server.go index e29885ad9752..340d2f3a9b7b 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/products_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/products_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // ProductsServer is a fake server for instances of the armbilling.ProductsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go b/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go index 28d7ec31e832..6d9617c9d9e4 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // ProfilesServer is a fake server for instances of the armbilling.ProfilesClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/property_server.go b/sdk/resourcemanager/billing/armbilling/fake/property_server.go deleted file mode 100644 index 6792a4eab9eb..000000000000 --- a/sdk/resourcemanager/billing/armbilling/fake/property_server.go +++ /dev/null @@ -1,153 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" -) - -// PropertyServer is a fake server for instances of the armbilling.PropertyClient type. -type PropertyServer struct { - // Get is the fake for method PropertyClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, options *armbilling.PropertyClientGetOptions) (resp azfake.Responder[armbilling.PropertyClientGetResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method PropertyClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, parameters armbilling.Property, options *armbilling.PropertyClientUpdateOptions) (resp azfake.Responder[armbilling.PropertyClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewPropertyServerTransport creates a new instance of PropertyServerTransport with the provided implementation. -// The returned PropertyServerTransport instance is connected to an instance of armbilling.PropertyClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPropertyServerTransport(srv *PropertyServer) *PropertyServerTransport { - return &PropertyServerTransport{srv: srv} -} - -// PropertyServerTransport connects instances of armbilling.PropertyClient to instances of PropertyServer. -// Don't use this type directly, use NewPropertyServerTransport instead. -type PropertyServerTransport struct { - srv *PropertyServer -} - -// Do implements the policy.Transporter interface for PropertyServerTransport. -func (p *PropertyServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PropertyClient.Get": - resp, err = p.dispatchGet(req) - case "PropertyClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PropertyServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Billing/billingProperty/default` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - includeBillingCountryUnescaped, err := url.QueryUnescape(qp.Get("includeBillingCountry")) - if err != nil { - return nil, err - } - includeBillingCountryParam, err := parseOptional(includeBillingCountryUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - includeTransitionStatusUnescaped, err := url.QueryUnescape(qp.Get("includeTransitionStatus")) - if err != nil { - return nil, err - } - includeTransitionStatusParam, err := parseOptional(includeTransitionStatusUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armbilling.PropertyClientGetOptions - if includeBillingCountryParam != nil || includeTransitionStatusParam != nil { - options = &armbilling.PropertyClientGetOptions{ - IncludeBillingCountry: includeBillingCountryParam, - IncludeTransitionStatus: includeTransitionStatusParam, - } - } - respr, errRespr := p.srv.Get(req.Context(), options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Property, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PropertyServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if p.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Billing/billingProperty/default` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armbilling.Property](req) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Update(req.Context(), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Property, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go b/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go index b4f0d52e7641..83110bab0a7e 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // RecipientTransfersServer is a fake server for instances of the armbilling.RecipientTransfersClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/requests_server.go b/sdk/resourcemanager/billing/armbilling/fake/requests_server.go index 2d090fc77e29..1cb8e41c7037 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/requests_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/requests_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // RequestsServer is a fake server for instances of the armbilling.RequestsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go b/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go index 092128c0558e..2840685bd1fa 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // ReservationOrdersServer is a fake server for instances of the armbilling.ReservationOrdersClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go b/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go index 4a9960f14ca4..377029a4fe17 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // ReservationsServer is a fake server for instances of the armbilling.ReservationsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go b/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go index 6cd5e183100a..297da157034e 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // RoleAssignmentsServer is a fake server for instances of the armbilling.RoleAssignmentsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go b/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go index efba7d35d9a8..ca275995f554 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // RoleDefinitionServer is a fake server for instances of the armbilling.RoleDefinitionClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go b/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go index 264001d165e1..3cd0cdb31898 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // SavingsPlanOrdersServer is a fake server for instances of the armbilling.SavingsPlanOrdersClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go b/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go index 13cf494113e3..1e82e599529b 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // SavingsPlansServer is a fake server for instances of the armbilling.SavingsPlansClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/server_factory.go b/sdk/resourcemanager/billing/armbilling/fake/server_factory.go index cdcb20d52a1a..0316a9664852 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/server_factory.go +++ b/sdk/resourcemanager/billing/armbilling/fake/server_factory.go @@ -11,11 +11,10 @@ package fake import ( "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "strings" "sync" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ServerFactory is a fake server for instances of the armbilling.ClientFactory type. @@ -37,7 +36,6 @@ type ServerFactory struct { PoliciesServer PoliciesServer ProductsServer ProductsServer ProfilesServer ProfilesServer - PropertyServer PropertyServer RecipientTransfersServer RecipientTransfersServer RequestsServer RequestsServer ReservationOrdersServer ReservationOrdersServer @@ -83,7 +81,6 @@ type ServerFactoryTransport struct { trPoliciesServer *PoliciesServerTransport trProductsServer *ProductsServerTransport trProfilesServer *ProfilesServerTransport - trPropertyServer *PropertyServerTransport trRecipientTransfersServer *RecipientTransfersServerTransport trRequestsServer *RequestsServerTransport trReservationOrdersServer *ReservationOrdersServerTransport @@ -174,9 +171,6 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ProfilesClient": initServer(s, &s.trProfilesServer, func() *ProfilesServerTransport { return NewProfilesServerTransport(&s.srv.ProfilesServer) }) resp, err = s.trProfilesServer.Do(req) - case "PropertyClient": - initServer(s, &s.trPropertyServer, func() *PropertyServerTransport { return NewPropertyServerTransport(&s.srv.PropertyServer) }) - resp, err = s.trPropertyServer.Do(req) case "RecipientTransfersClient": initServer(s, &s.trRecipientTransfersServer, func() *RecipientTransfersServerTransport { return NewRecipientTransfersServerTransport(&s.srv.RecipientTransfersServer) diff --git a/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go b/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go index c2cb050def6b..07091ec509b9 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // SubscriptionsServer is a fake server for instances of the armbilling.SubscriptionsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go b/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go index 55a2852f6a39..8e8a14e55dd3 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go @@ -12,16 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - "strconv" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" + "strconv" ) // SubscriptionsAliasesServer is a fake server for instances of the armbilling.SubscriptionsAliasesClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go b/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go index ade6004b9922..81f308b0d343 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go +++ b/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go @@ -11,12 +11,11 @@ package fake import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. diff --git a/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go b/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go index 370191bb27e1..936d145d88ed 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go @@ -12,17 +12,16 @@ import ( "context" "errors" "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" "net/http" "net/url" "regexp" "strconv" "time" - - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" ) // TransactionsServer is a fake server for instances of the armbilling.TransactionsClient type. diff --git a/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go b/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go index fd1ccaf0faf1..ca3a9ce74880 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go @@ -12,15 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2" + "net/http" + "net/url" + "regexp" ) // TransfersServer is a fake server for instances of the armbilling.TransfersClient type. diff --git a/sdk/resourcemanager/billing/armbilling/go.mod b/sdk/resourcemanager/billing/armbilling/go.mod index bec9e9f01d92..af8a642f56d0 100644 --- a/sdk/resourcemanager/billing/armbilling/go.mod +++ b/sdk/resourcemanager/billing/armbilling/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/billing/armbilling/go.sum b/sdk/resourcemanager/billing/armbilling/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/billing/armbilling/go.sum +++ b/sdk/resourcemanager/billing/armbilling/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/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/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/billing/armbilling/invoices_client.go b/sdk/resourcemanager/billing/armbilling/invoices_client.go index 9a6643062eb3..492ae76b846e 100644 --- a/sdk/resourcemanager/billing/armbilling/invoices_client.go +++ b/sdk/resourcemanager/billing/armbilling/invoices_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // InvoicesClient contains the methods for the Invoices group. diff --git a/sdk/resourcemanager/billing/armbilling/invoices_client_example_test.go b/sdk/resourcemanager/billing/armbilling/invoices_client_example_test.go deleted file mode 100644 index 411810403a4a..000000000000 --- a/sdk/resourcemanager/billing/armbilling/invoices_client_example_test.go +++ /dev/null @@ -1,898 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInvoicesClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", &armbilling.InvoicesClientListByBillingProfileOptions{PeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-01"); return t }()), - PeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-30"); return t }()), - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InvoiceListResult = armbilling.InvoiceListResult{ - // Value: []*armbilling.Invoice{ - // { - // Name: to.Ptr("G123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // AzurePrepaymentApplied: &armbilling.InvoicePropertiesAzurePrepaymentApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](25.46), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // CreditAmount: &armbilling.InvoicePropertiesCreditAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }, - // { - // Name: to.Ptr("22345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeTaxReceipt), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // FreeAzureCreditApplied: &armbilling.InvoicePropertiesFreeAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // IsMonthlyInvoice: to.Ptr(false), - // PurchaseOrderNumber: to.Ptr("123456"), - // RebillDetails: &armbilling.InvoicePropertiesRebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote2"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000002"), - // RebillDetails: &armbilling.RebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000001"), - // }, - // }, - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubTotal: &armbilling.InvoicePropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // TaxAmount: &armbilling.InvoicePropertiesTaxAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](1), - // }, - // TotalAmount: &armbilling.InvoicePropertiesTotalAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](7.53), - // }, - // }, - // }, - // { - // Name: to.Ptr("G987654321"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G987654321"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // AzurePrepaymentApplied: &armbilling.InvoicePropertiesAzurePrepaymentApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](25.46), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // CreditAmount: &armbilling.InvoicePropertiesCreditAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }, - // { - // Name: to.Ptr("22345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeTaxReceipt), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-16T17:32:28.000Z"); return t}()), - // FreeAzureCreditApplied: &armbilling.InvoicePropertiesFreeAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // IsMonthlyInvoice: to.Ptr(false), - // Payments: []*armbilling.Payment{ - // { - // Amount: &armbilling.PaymentAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-14T17:32:28.000Z"); return t}()), - // PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // PaymentMethodType: to.Ptr("visa"), - // PaymentType: to.Ptr("debited"), - // }}, - // PurchaseOrderNumber: to.Ptr("123455"), - // RebillDetails: &armbilling.InvoicePropertiesRebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote2"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000002"), - // RebillDetails: &armbilling.RebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000001"), - // }, - // }, - // Status: to.Ptr(armbilling.InvoiceStatusPaid), - // SubTotal: &armbilling.InvoicePropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // TaxAmount: &armbilling.InvoicePropertiesTaxAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](1), - // }, - // TotalAmount: &armbilling.InvoicePropertiesTotalAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](7.53), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesDownloadDocumentsByBillingAccount.json -func ExampleInvoicesClient_BeginDownloadDocumentsByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoicesClient().BeginDownloadDocumentsByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", []*armbilling.DocumentDownloadRequest{ - { - DocumentName: to.Ptr("12345678"), - InvoiceName: to.Ptr("G123456789"), - }, - { - DocumentName: to.Ptr("12345678"), - InvoiceName: to.Ptr("G987654321"), - }}, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DocumentDownloadResult = armbilling.DocumentDownloadResult{ - // ExpiryTime: to.Ptr("2023-02-16T17:32:28Z"), - // URL: to.Ptr("https://myaccount.blob.core.windows.net/invoices/1383724.pdf?sv=2019-02-02&sr=b&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesAmend.json -func ExampleInvoicesClient_BeginAmend() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoicesClient().BeginAmend(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesDownloadByBillingAccount.json -func ExampleInvoicesClient_BeginDownloadByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoicesClient().BeginDownloadByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", &armbilling.InvoicesClientBeginDownloadByBillingAccountOptions{DocumentName: to.Ptr("12345678")}) - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DocumentDownloadResult = armbilling.DocumentDownloadResult{ - // ExpiryTime: to.Ptr("2023-02-16T17:32:28Z"), - // URL: to.Ptr("https://myaccount.blob.core.windows.net/invoices/1383724.pdf?sv=2019-02-02&sr=b&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesDownloadSummaryByBillingAccount.json -func ExampleInvoicesClient_BeginDownloadSummaryByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoicesClient().BeginDownloadSummaryByBillingAccount(ctx, "123456789", "G123456789", 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DocumentDownloadResult = armbilling.DocumentDownloadResult{ - // ExpiryTime: to.Ptr("2023-02-16T17:32:28Z"), - // URL: to.Ptr("https://myaccount.blob.core.windows.net/invoices/1383724_summary.pdf?sv=2019-02-02&sr=b&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGetByBillingAccount.json -func ExampleInvoicesClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInvoicesClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Invoice = armbilling.Invoice{ - // Name: to.Ptr("G123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // AzurePrepaymentApplied: &armbilling.InvoicePropertiesAzurePrepaymentApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](25.46), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // CreditAmount: &armbilling.InvoicePropertiesCreditAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }, - // { - // Name: to.Ptr("22345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeTaxReceipt), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // FreeAzureCreditApplied: &armbilling.InvoicePropertiesFreeAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // IsMonthlyInvoice: to.Ptr(false), - // PurchaseOrderNumber: to.Ptr("123456"), - // RebillDetails: &armbilling.InvoicePropertiesRebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote2"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000002"), - // RebillDetails: &armbilling.RebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000001"), - // }, - // }, - // SpecialTaxationType: to.Ptr(armbilling.SpecialTaxationTypeSubtotalLevel), - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubTotal: &armbilling.InvoicePropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // TaxAmount: &armbilling.InvoicePropertiesTaxAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](1), - // }, - // TotalAmount: &armbilling.InvoicePropertiesTotalAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](7.53), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesListByBillingAccount.json -func ExampleInvoicesClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInvoicesClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.InvoicesClientListByBillingAccountOptions{PeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-01"); return t }()), - PeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-30"); return t }()), - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InvoiceListResult = armbilling.InvoiceListResult{ - // Value: []*armbilling.Invoice{ - // { - // Name: to.Ptr("G123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // AzurePrepaymentApplied: &armbilling.InvoicePropertiesAzurePrepaymentApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](25.46), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // CreditAmount: &armbilling.InvoicePropertiesCreditAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }, - // { - // Name: to.Ptr("22345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeTaxReceipt), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // FreeAzureCreditApplied: &armbilling.InvoicePropertiesFreeAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // IsMonthlyInvoice: to.Ptr(false), - // PurchaseOrderNumber: to.Ptr("123456"), - // RebillDetails: &armbilling.InvoicePropertiesRebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote2"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000002"), - // RebillDetails: &armbilling.RebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000001"), - // }, - // }, - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubTotal: &armbilling.InvoicePropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // TaxAmount: &armbilling.InvoicePropertiesTaxAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](1), - // }, - // TotalAmount: &armbilling.InvoicePropertiesTotalAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](7.53), - // }, - // }, - // }, - // { - // Name: to.Ptr("G987654321"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G987654321"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // AzurePrepaymentApplied: &armbilling.InvoicePropertiesAzurePrepaymentApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](25.46), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // CreditAmount: &armbilling.InvoicePropertiesCreditAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }, - // { - // Name: to.Ptr("22345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeTaxReceipt), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-16T17:32:28.000Z"); return t}()), - // FreeAzureCreditApplied: &armbilling.InvoicePropertiesFreeAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // IsMonthlyInvoice: to.Ptr(false), - // Payments: []*armbilling.Payment{ - // { - // Amount: &armbilling.PaymentAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-14T17:32:28.000Z"); return t}()), - // PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // PaymentMethodType: to.Ptr("visa"), - // PaymentType: to.Ptr("debited"), - // }}, - // PurchaseOrderNumber: to.Ptr("123455"), - // RebillDetails: &armbilling.InvoicePropertiesRebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote2"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000002"), - // RebillDetails: &armbilling.RebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000001"), - // }, - // }, - // Status: to.Ptr(armbilling.InvoiceStatusPaid), - // SubTotal: &armbilling.InvoicePropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // TaxAmount: &armbilling.InvoicePropertiesTaxAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](1), - // }, - // TotalAmount: &armbilling.InvoicePropertiesTotalAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](7.53), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesDownloadDocumentsByBillingSubscription.json -func ExampleInvoicesClient_BeginDownloadDocumentsByBillingSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoicesClient().BeginDownloadDocumentsByBillingSubscription(ctx, []*armbilling.DocumentDownloadRequest{ - { - DocumentName: to.Ptr("12345678"), - InvoiceName: to.Ptr("E123456789"), - }, - { - DocumentName: to.Ptr("12345678"), - InvoiceName: to.Ptr("E987654321"), - }}, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DocumentDownloadResult = armbilling.DocumentDownloadResult{ - // ExpiryTime: to.Ptr("2023-02-16T17:32:28Z"), - // URL: to.Ptr("https://myaccount.blob.core.windows.net/invoices/1383724.pdf?sv=2019-02-02&sr=b&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesDownloadByBillingSubscription.json -func ExampleInvoicesClient_BeginDownloadByBillingSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoicesClient().BeginDownloadByBillingSubscription(ctx, "E123456789", &armbilling.InvoicesClientBeginDownloadByBillingSubscriptionOptions{DocumentName: to.Ptr("12345678")}) - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DocumentDownloadResult = armbilling.DocumentDownloadResult{ - // ExpiryTime: to.Ptr("2023-02-16T17:32:28Z"), - // URL: to.Ptr("https://myaccount.blob.core.windows.net/invoices/1383724.pdf?sv=2019-02-02&sr=b&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGetByBillingSubscription.json -func ExampleInvoicesClient_GetByBillingSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInvoicesClient().GetByBillingSubscription(ctx, "E123456789", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Invoice = armbilling.Invoice{ - // Name: to.Ptr("E123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/11111111-1111-1111-1111-111111111111/invoices/E123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoiceType: to.Ptr(armbilling.InvoiceTypeAzureServices), - // PurchaseOrderNumber: to.Ptr("123456"), - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubscriptionDisplayName: to.Ptr("Contoso Operations Billing"), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesListByBillingSubscription.json -func ExampleInvoicesClient_NewListByBillingSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInvoicesClient().NewListByBillingSubscriptionPager(&armbilling.InvoicesClientListByBillingSubscriptionOptions{PeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-01"); return t }()), - PeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-30"); return t }()), - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InvoiceListResult = armbilling.InvoiceListResult{ - // Value: []*armbilling.Invoice{ - // { - // Name: to.Ptr("E123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/11111111-1111-1111-1111-111111111111/invoices/E123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoiceType: to.Ptr(armbilling.InvoiceTypeAzureServices), - // PurchaseOrderNumber: to.Ptr("123456"), - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubscriptionDisplayName: to.Ptr("Contoso Operations Billing"), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // { - // Name: to.Ptr("G123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/11111111-1111-1111-1111-111111111111/invoices/G123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](15.53), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](55.99), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoiceType: to.Ptr(armbilling.InvoiceTypeAzureMarketplace), - // PurchaseOrderNumber: to.Ptr("123456"), - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubscriptionDisplayName: to.Ptr("Contoso Operations Billing"), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // { - // Name: to.Ptr("E987654321"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/11111111-1111-1111-1111-111111111111/invoices/E987654321"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-16T17:32:28.000Z"); return t}()), - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // InvoiceType: to.Ptr(armbilling.InvoiceTypeAzureSupport), - // Payments: []*armbilling.Payment{ - // { - // Amount: &armbilling.PaymentAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](2000), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-14T17:32:28.000Z"); return t}()), - // PaymentMethodFamily: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // PaymentMethodType: to.Ptr("visa"), - // PaymentType: to.Ptr("credited"), - // }}, - // PurchaseOrderNumber: to.Ptr("123456"), - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubscriptionDisplayName: to.Ptr("Contoso Operations Billing"), - // SubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGet.json -func ExampleInvoicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInvoicesClient().Get(ctx, "G123456789", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Invoice = armbilling.Invoice{ - // Name: to.Ptr("G123456789"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/invoices"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // Properties: &armbilling.InvoiceProperties{ - // AmountDue: &armbilling.InvoicePropertiesAmountDue{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](8.53), - // }, - // AzurePrepaymentApplied: &armbilling.InvoicePropertiesAzurePrepaymentApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](25.46), - // }, - // BilledAmount: &armbilling.InvoicePropertiesBilledAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // CreditAmount: &armbilling.InvoicePropertiesCreditAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // DocumentType: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // Documents: []*armbilling.InvoiceDocument{ - // { - // Name: to.Ptr("12345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeInvoice), - // }, - // { - // Name: to.Ptr("22345678"), - // Kind: to.Ptr(armbilling.InvoiceDocumentTypeTaxReceipt), - // }}, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-16T17:32:28.000Z"); return t}()), - // FreeAzureCreditApplied: &armbilling.InvoicePropertiesFreeAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](0), - // }, - // InvoiceDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // InvoicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-15T17:32:28.000Z"); return t}()), - // InvoicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T17:32:28.000Z"); return t}()), - // IsMonthlyInvoice: to.Ptr(false), - // PurchaseOrderNumber: to.Ptr("123456"), - // RebillDetails: &armbilling.InvoicePropertiesRebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote2"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000002"), - // RebillDetails: &armbilling.RebillDetails{ - // CreditNoteDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/CreditNote"), - // InvoiceDocumentID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/I000001"), - // }, - // }, - // SpecialTaxationType: to.Ptr(armbilling.SpecialTaxationTypeSubtotalLevel), - // Status: to.Ptr(armbilling.InvoiceStatusDue), - // SubTotal: &armbilling.InvoicePropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](33.99), - // }, - // TaxAmount: &armbilling.InvoicePropertiesTaxAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](1), - // }, - // TotalAmount: &armbilling.InvoicePropertiesTotalAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](7.53), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/invoicesections_client.go b/sdk/resourcemanager/billing/armbilling/invoicesections_client.go index a53638dad098..7fd764501e37 100644 --- a/sdk/resourcemanager/billing/armbilling/invoicesections_client.go +++ b/sdk/resourcemanager/billing/armbilling/invoicesections_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // InvoiceSectionsClient contains the methods for the InvoiceSections group. diff --git a/sdk/resourcemanager/billing/armbilling/invoicesections_client_example_test.go b/sdk/resourcemanager/billing/armbilling/invoicesections_client_example_test.go deleted file mode 100644 index 81da20c235c9..000000000000 --- a/sdk/resourcemanager/billing/armbilling/invoicesections_client_example_test.go +++ /dev/null @@ -1,258 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsValidateDeleteEligibilityFailure.json -func ExampleInvoiceSectionsClient_ValidateDeleteEligibility_invoiceSectionsValidateDeleteEligibilityFailure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInvoiceSectionsClient().ValidateDeleteEligibility(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeleteInvoiceSectionEligibilityResult = armbilling.DeleteInvoiceSectionEligibilityResult{ - // EligibilityDetails: []*armbilling.DeleteInvoiceSectionEligibilityDetail{ - // { - // Code: to.Ptr(armbilling.DeleteInvoiceSectionEligibilityCodeActiveBillingSubscriptions), - // Message: to.Ptr("There are active or disabled subscriptions assigned to the invoice section. Either move the subscription to another invoice section or delete the subscriptions and then try deleting the invoice section."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteInvoiceSectionEligibilityCodeLastInvoiceSection), - // Message: to.Ptr("This is the only invoice section in this billing profile so it can’t be deleted."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteInvoiceSectionEligibilityCodeActiveAzurePlans), - // Message: to.Ptr("This is the invoice section that was created when its billing profile was created so it can’t be deleted."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteInvoiceSectionEligibilityCodeReservedInstances), - // Message: to.Ptr("The invoice section has the RI asset with a billing plan."), - // }}, - // EligibilityStatus: to.Ptr(armbilling.DeleteInvoiceSectionEligibilityStatusNotAllowed), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsValidateDeleteEligibilitySuccess.json -func ExampleInvoiceSectionsClient_ValidateDeleteEligibility_invoiceSectionsValidateDeleteEligibilitySuccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInvoiceSectionsClient().ValidateDeleteEligibility(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeleteInvoiceSectionEligibilityResult = armbilling.DeleteInvoiceSectionEligibilityResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsDelete.json -func ExampleInvoiceSectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoiceSectionsClient().BeginDelete(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsGet.json -func ExampleInvoiceSectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInvoiceSectionsClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InvoiceSection = armbilling.InvoiceSection{ - // Name: to.Ptr("invoice-section-1"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/invoice-section-1"), - // Properties: &armbilling.InvoiceSectionProperties{ - // DisplayName: to.Ptr("Invoice Section 1"), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsCreateOrUpdate.json -func ExampleInvoiceSectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewInvoiceSectionsClient().BeginCreateOrUpdate(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "invoice-section-1", armbilling.InvoiceSection{ - Properties: &armbilling.InvoiceSectionProperties{ - DisplayName: to.Ptr("Invoice Section 1"), - Tags: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InvoiceSection = armbilling.InvoiceSection{ - // Name: to.Ptr("invoice-section-1"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/invoice-section-1"), - // Properties: &armbilling.InvoiceSectionProperties{ - // DisplayName: to.Ptr("Invoice Section 1"), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInvoiceSectionsClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", &armbilling.InvoiceSectionsClientListByBillingProfileOptions{IncludeDeleted: to.Ptr(true), - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InvoiceSectionListResult = armbilling.InvoiceSectionListResult{ - // Value: []*armbilling.InvoiceSection{ - // { - // Name: to.Ptr("invoice-section-1"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/invoice-section-1"), - // Properties: &armbilling.InvoiceSectionProperties{ - // DisplayName: to.Ptr("Invoice Section 1"), - // State: to.Ptr(armbilling.InvoiceSectionStateActive), - // SystemID: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // }, - // { - // Name: to.Ptr("invoice-section-2"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/invoice-section-2"), - // Properties: &armbilling.InvoiceSectionProperties{ - // DisplayName: to.Ptr("Invoice Section 2"), - // ReasonCode: to.Ptr(armbilling.InvoiceSectionStateReasonCodePastDue), - // State: to.Ptr(armbilling.InvoiceSectionStateWarned), - // SystemID: to.Ptr("zzzz-zzzz-zzz-zzz"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Marketing"), - // "pcCode": to.Ptr("Z345678"), - // }, - // }, - // }, - // { - // Name: to.Ptr("invoice-section-3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/invoice-section-3"), - // Properties: &armbilling.InvoiceSectionProperties{ - // DisplayName: to.Ptr("Invoice Section 3"), - // State: to.Ptr(armbilling.InvoiceSectionStateDeleted), - // SystemID: to.Ptr("aaaa-aaaa-aaa-aaa"), - // Tags: map[string]*string{ - // "costCategory": to.Ptr("Support"), - // "pcCode": to.Ptr("A123456"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/models_serde.go b/sdk/resourcemanager/billing/armbilling/models_serde.go index dab5acdc9953..83dc0ba365f6 100644 --- a/sdk/resourcemanager/billing/armbilling/models_serde.go +++ b/sdk/resourcemanager/billing/armbilling/models_serde.go @@ -11,9 +11,8 @@ package armbilling import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type AcceptTransferProperties. diff --git a/sdk/resourcemanager/billing/armbilling/operations_client.go b/sdk/resourcemanager/billing/armbilling/operations_client.go index 7c2900a26b2d..7f65764bdb7c 100644 --- a/sdk/resourcemanager/billing/armbilling/operations_client.go +++ b/sdk/resourcemanager/billing/armbilling/operations_client.go @@ -10,12 +10,11 @@ package armbilling import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. diff --git a/sdk/resourcemanager/billing/armbilling/operations_client_example_test.go b/sdk/resourcemanager/billing/armbilling/operations_client_example_test.go deleted file mode 100644 index ed301cbe01bc..000000000000 --- a/sdk/resourcemanager/billing/armbilling/operations_client_example_test.go +++ /dev/null @@ -1,54 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/operationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armbilling.OperationListResult{ - // Value: []*armbilling.Operation{ - // { - // Name: to.Ptr("{namespace}/resource/read"), - // Display: &armbilling.OperationDisplay{ - // Operation: to.Ptr("List resources"), - // Provider: to.Ptr("{namespace}"), - // Resource: to.Ptr("resource"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/options.go b/sdk/resourcemanager/billing/armbilling/options.go index 3b4d66fe3acc..d5b008e616bf 100644 --- a/sdk/resourcemanager/billing/armbilling/options.go +++ b/sdk/resourcemanager/billing/armbilling/options.go @@ -910,21 +910,6 @@ type ProfilesClientValidateDeleteEligibilityOptions struct { // placeholder for future optional parameters } -// PropertyClientGetOptions contains the optional parameters for the PropertyClient.Get method. -type PropertyClientGetOptions struct { - // A flag that specifies whether or not to include billing country. - IncludeBillingCountry *bool - - // A flag that specifies whether or not to include transition status for billing accounts with agreement type Microsoft Customer - // Agreement. - IncludeTransitionStatus *bool -} - -// PropertyClientUpdateOptions contains the optional parameters for the PropertyClient.Update method. -type PropertyClientUpdateOptions struct { - // placeholder for future optional parameters -} - // RecipientTransfersClientAcceptOptions contains the optional parameters for the RecipientTransfersClient.Accept method. type RecipientTransfersClientAcceptOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go b/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go index 6db7ce894aa6..3b5e3659c242 100644 --- a/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go +++ b/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PartnerTransfersClient contains the methods for the PartnerTransfers group. diff --git a/sdk/resourcemanager/billing/armbilling/partnertransfers_client_example_test.go b/sdk/resourcemanager/billing/armbilling/partnertransfers_client_example_test.go deleted file mode 100644 index 11e35fdcff56..000000000000 --- a/sdk/resourcemanager/billing/armbilling/partnertransfers_client_example_test.go +++ /dev/null @@ -1,190 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersGet.json -func ExamplePartnerTransfersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPartnerTransfersClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerTransferDetails = armbilling.PartnerTransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/transfers/aabb123"), - // Properties: &armbilling.PartnerTransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorCustomerType: to.Ptr(armbilling.InitiatorCustomerTypePartner), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersInitiate.json -func ExamplePartnerTransfersClient_Initiate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPartnerTransfersClient().Initiate(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", armbilling.PartnerInitiateTransferRequest{ - Properties: &armbilling.PartnerInitiateTransferProperties{ - RecipientEmailID: to.Ptr("user@contoso.com"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerTransferDetails = armbilling.PartnerTransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/transfers/aabb123"), - // Properties: &armbilling.PartnerTransferProperties{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorCustomerType: to.Ptr(armbilling.InitiatorCustomerTypePartner), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersCancel.json -func ExamplePartnerTransfersClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPartnerTransfersClient().Cancel(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PartnerTransferDetails = armbilling.PartnerTransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/transfers/aabb123"), - // Properties: &armbilling.PartnerTransferProperties{ - // CanceledBy: to.Ptr("user@contoso.com"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorCustomerType: to.Ptr(armbilling.InitiatorCustomerTypePartner), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersList.json -func ExamplePartnerTransfersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPartnerTransfersClient().NewListPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartnerTransferDetailsListResult = armbilling.PartnerTransferDetailsListResult{ - // Value: []*armbilling.PartnerTransferDetails{ - // { - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/transfers/aabb123"), - // Properties: &armbilling.PartnerTransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorCustomerType: to.Ptr(armbilling.InitiatorCustomerTypePartner), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/paymentmethods_client.go b/sdk/resourcemanager/billing/armbilling/paymentmethods_client.go index db5687885d09..4eaf567960bc 100644 --- a/sdk/resourcemanager/billing/armbilling/paymentmethods_client.go +++ b/sdk/resourcemanager/billing/armbilling/paymentmethods_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PaymentMethodsClient contains the methods for the PaymentMethods group. diff --git a/sdk/resourcemanager/billing/armbilling/paymentmethods_client_example_test.go b/sdk/resourcemanager/billing/armbilling/paymentmethods_client_example_test.go deleted file mode 100644 index ba4d45539026..000000000000 --- a/sdk/resourcemanager/billing/armbilling/paymentmethods_client_example_test.go +++ /dev/null @@ -1,316 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsListByBillingProfile.json -func ExamplePaymentMethodsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPaymentMethodsClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", "ABC1-A1CD-AB1-BP1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PaymentMethodLinksListResult = armbilling.PaymentMethodLinksListResult{ - // Value: []*armbilling.PaymentMethodLink{ - // { - // Name: to.Ptr("ABCDABCDABC0"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/paymentMethodLinks"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31/billingProfiles/ABC1-A1CD-AB1-BP1/paymentMethodLinks/ABCDABCDABC0"), - // Properties: &armbilling.PaymentMethodLinkProperties{ - // AccountHolderName: to.Ptr("abc"), - // DisplayName: to.Ptr("Master Card"), - // Expiration: to.Ptr("1/2035"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // LastFourDigits: to.Ptr("1270"), - // Logos: []*armbilling.PaymentMethodLogo{ - // { - // MimeType: to.Ptr("image/png"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa_rect.png"), - // }, - // { - // MimeType: to.Ptr("image/svg+xml"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa.svg"), - // }}, - // PaymentMethodID: to.Ptr("/providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0"), - // PaymentMethodType: to.Ptr("mc"), - // Status: to.Ptr(armbilling.PaymentMethodStatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsGetByBillingProfile.json -func ExamplePaymentMethodsClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPaymentMethodsClient().GetByBillingProfile(ctx, "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", "ABC1-A1CD-AB1-BP1", "ABCDABCDABC0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PaymentMethodLink = armbilling.PaymentMethodLink{ - // Name: to.Ptr("ABCDABCDABC0"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/paymentMethodLinks"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31/billingProfiles/ABC1-A1CD-AB1-BP1/paymentMethodLinks/ABCDABCDABC0"), - // Properties: &armbilling.PaymentMethodLinkProperties{ - // AccountHolderName: to.Ptr("abc"), - // DisplayName: to.Ptr("Master Card"), - // Expiration: to.Ptr("1/2035"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // LastFourDigits: to.Ptr("1270"), - // Logos: []*armbilling.PaymentMethodLogo{ - // { - // MimeType: to.Ptr("image/png"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa_rect.png"), - // }, - // { - // MimeType: to.Ptr("image/svg+xml"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa.svg"), - // }}, - // PaymentMethodID: to.Ptr("/providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0"), - // PaymentMethodType: to.Ptr("mc"), - // Status: to.Ptr(armbilling.PaymentMethodStatusActive), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsListByBillingAccount.json -func ExamplePaymentMethodsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPaymentMethodsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PaymentMethodsListResult = armbilling.PaymentMethodsListResult{ - // Value: []*armbilling.PaymentMethod{ - // { - // Name: to.Ptr("21dd9edc-af71-4d62-80ce-37151d475326"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/paymentMethods"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31/paymentMethods/21dd9edc-af71-4d62-80ce-37151d475326"), - // Properties: &armbilling.PaymentMethodProperties{ - // DisplayName: to.Ptr("Check/wire transfer"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCheckWire), - // PaymentMethodType: to.Ptr("check"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsGetByBillingAccount.json -func ExamplePaymentMethodsClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPaymentMethodsClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", "21dd9edc-af71-4d62-80ce-37151d475326", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PaymentMethod = armbilling.PaymentMethod{ - // Name: to.Ptr("21dd9edc-af71-4d62-80ce-37151d475326"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/paymentMethods"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31/paymentMethods/21dd9edc-af71-4d62-80ce-37151d475326"), - // Properties: &armbilling.PaymentMethodProperties{ - // DisplayName: to.Ptr("Check/wire transfer"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCheckWire), - // PaymentMethodType: to.Ptr("check"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsListByUser.json -func ExamplePaymentMethodsClient_NewListByUserPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPaymentMethodsClient().NewListByUserPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PaymentMethodsListResult = armbilling.PaymentMethodsListResult{ - // Value: []*armbilling.PaymentMethod{ - // { - // Name: to.Ptr("ABCDABCDABC0"), - // Type: to.Ptr("Microsoft.Billing/paymentMethods"), - // ID: to.Ptr("/providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0"), - // Properties: &armbilling.PaymentMethodProperties{ - // AccountHolderName: to.Ptr("abc"), - // DisplayName: to.Ptr("Master Card"), - // Expiration: to.Ptr("1/2035"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // LastFourDigits: to.Ptr("1270"), - // Logos: []*armbilling.PaymentMethodLogo{ - // { - // MimeType: to.Ptr("image/png"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_mc_rect.png"), - // }, - // { - // MimeType: to.Ptr("image/svg+xml"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_mc.svg"), - // }}, - // PaymentMethodType: to.Ptr("mc"), - // Status: to.Ptr(armbilling.PaymentMethodStatusActive), - // }, - // }, - // { - // Name: to.Ptr("ABCDABCDABC1"), - // Type: to.Ptr("Microsoft.Billing/paymentMethods"), - // ID: to.Ptr("/providers/Microsoft.Billing/paymentMethods/ABCDABCDABC1"), - // Properties: &armbilling.PaymentMethodProperties{ - // AccountHolderName: to.Ptr("abc"), - // DisplayName: to.Ptr("Visa"), - // Expiration: to.Ptr("1/2025"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // LastFourDigits: to.Ptr("7373"), - // Logos: []*armbilling.PaymentMethodLogo{ - // { - // MimeType: to.Ptr("image/png"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa_rect.png"), - // }, - // { - // MimeType: to.Ptr("image/svg+xml"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa.svg"), - // }}, - // PaymentMethodType: to.Ptr("visa"), - // Status: to.Ptr(armbilling.PaymentMethodStatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsDeleteByUser.json -func ExamplePaymentMethodsClient_DeleteByUser() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPaymentMethodsClient().DeleteByUser(ctx, "ABCDABCDABC0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsGetByUser.json -func ExamplePaymentMethodsClient_GetByUser() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPaymentMethodsClient().GetByUser(ctx, "ABCDABCDABC0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PaymentMethod = armbilling.PaymentMethod{ - // Name: to.Ptr("ABCDABCDABC0"), - // Type: to.Ptr("Microsoft.Billing/paymentMethods"), - // ID: to.Ptr("/providers/Microsoft.Billing/paymentMethods/ABCDABCDABC0"), - // Properties: &armbilling.PaymentMethodProperties{ - // AccountHolderName: to.Ptr("abc"), - // DisplayName: to.Ptr("Master Card"), - // Expiration: to.Ptr("1/2035"), - // Family: to.Ptr(armbilling.PaymentMethodFamilyCreditCard), - // LastFourDigits: to.Ptr("1270"), - // Logos: []*armbilling.PaymentMethodLogo{ - // { - // MimeType: to.Ptr("image/png"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa_rect.png"), - // }, - // { - // MimeType: to.Ptr("image/svg+xml"), - // URL: to.Ptr("https://contoso.com/staticresourceservice/images/v4/logo_visa.svg"), - // }}, - // PaymentMethodType: to.Ptr("mc"), - // Status: to.Ptr(armbilling.PaymentMethodStatusActive), - // }, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/permissions_client.go b/sdk/resourcemanager/billing/armbilling/permissions_client.go index fa0a628f0ce4..395a3a512d88 100644 --- a/sdk/resourcemanager/billing/armbilling/permissions_client.go +++ b/sdk/resourcemanager/billing/armbilling/permissions_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PermissionsClient contains the methods for the BillingPermissions group. diff --git a/sdk/resourcemanager/billing/armbilling/permissions_client_example_test.go b/sdk/resourcemanager/billing/armbilling/permissions_client_example_test.go deleted file mode 100644 index 3af160935fc7..000000000000 --- a/sdk/resourcemanager/billing/armbilling/permissions_client_example_test.go +++ /dev/null @@ -1,519 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByBillingAccount.json -func ExamplePermissionsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByBillingAccountPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("20000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("20000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByBillingProfile.json -func ExamplePermissionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByBillingProfilePager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("20000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("20000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByBillingProfile.json -func ExamplePermissionsClient_CheckAccessByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionsClient().CheckAccessByBillingProfile(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", armbilling.CheckAccessRequest{ - Actions: []*string{ - to.Ptr("Microsoft.Billing/billingAccounts/read"), - to.Ptr("Microsoft.Subscription/subscriptions/write")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckAccessResponseArray = []*armbilling.CheckAccessResponse{ - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionAllowed), - // Action: to.Ptr("Microsoft.Billing/billingAccounts/read"), - // }, - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionNotAllowed), - // Action: to.Ptr("Microsoft.Subscription/subscriptions/write"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByCustomer.json -func ExamplePermissionsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByCustomerPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "BKM6-54VH-BG7-PGB", "11111111-1111-1111-1111-111111111111", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByCustomer.json -func ExamplePermissionsClient_CheckAccessByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionsClient().CheckAccessByCustomer(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", armbilling.CheckAccessRequest{ - Actions: []*string{ - to.Ptr("Microsoft.Billing/billingAccounts/read"), - to.Ptr("Microsoft.Subscription/subscriptions/write")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckAccessResponseArray = []*armbilling.CheckAccessResponse{ - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionAllowed), - // Action: to.Ptr("Microsoft.Billing/billingAccounts/read"), - // }, - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionNotAllowed), - // Action: to.Ptr("Microsoft.Subscription/subscriptions/write"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByInvoiceSection.json -func ExamplePermissionsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByInvoiceSectionPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "XXXX-XXXX-XXX-XXX", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByInvoiceSection.json -func ExamplePermissionsClient_CheckAccessByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionsClient().CheckAccessByInvoiceSection(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "Q7GV-UUVA-PJA-TGB", armbilling.CheckAccessRequest{ - Actions: []*string{ - to.Ptr("Microsoft.Billing/billingAccounts/read"), - to.Ptr("Microsoft.Subscription/subscriptions/write")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckAccessResponseArray = []*armbilling.CheckAccessResponse{ - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionAllowed), - // Action: to.Ptr("Microsoft.Billing/billingAccounts/read"), - // }, - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionNotAllowed), - // Action: to.Ptr("Microsoft.Subscription/subscriptions/write"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByBillingAccount.json -func ExamplePermissionsClient_CheckAccessByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionsClient().CheckAccessByBillingAccount(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", armbilling.CheckAccessRequest{ - Actions: []*string{ - to.Ptr("Microsoft.Billing/billingAccounts/read"), - to.Ptr("Microsoft.Subscription/subscriptions/write")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckAccessResponseArray = []*armbilling.CheckAccessResponse{ - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionAllowed), - // Action: to.Ptr("Microsoft.Billing/billingAccounts/read"), - // }, - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionNotAllowed), - // Action: to.Ptr("Microsoft.Subscription/subscriptions/write"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByCustomerAtBillingAccount.json -func ExamplePermissionsClient_NewListByCustomerAtBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByCustomerAtBillingAccountPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByDepartment.json -func ExamplePermissionsClient_NewListByDepartmentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByDepartmentPager("6100092", "123456", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/departments/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/write")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByDepartment.json -func ExamplePermissionsClient_CheckAccessByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionsClient().CheckAccessByDepartment(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "12345", armbilling.CheckAccessRequest{ - Actions: []*string{ - to.Ptr("Microsoft.Billing/billingAccounts/read"), - to.Ptr("Microsoft.Subscription/subscriptions/write")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckAccessResponseArray = []*armbilling.CheckAccessResponse{ - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionAllowed), - // Action: to.Ptr("Microsoft.Billing/billingAccounts/read"), - // }, - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionNotAllowed), - // Action: to.Ptr("Microsoft.Subscription/subscriptions/write"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPermissionsListByEnrollmentAccount.json -func ExamplePermissionsClient_NewListByEnrollmentAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListByEnrollmentAccountPager("6100092", "123456", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionListResult = armbilling.PermissionListResult{ - // Value: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/write")}, - // NotActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByEnrollmentAccount.json -func ExamplePermissionsClient_CheckAccessByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPermissionsClient().CheckAccessByEnrollmentAccount(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "123456", armbilling.CheckAccessRequest{ - Actions: []*string{ - to.Ptr("Microsoft.Billing/billingAccounts/read"), - to.Ptr("Microsoft.Subscription/subscriptions/write")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckAccessResponseArray = []*armbilling.CheckAccessResponse{ - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionAllowed), - // Action: to.Ptr("Microsoft.Billing/billingAccounts/read"), - // }, - // { - // AccessDecision: to.Ptr(armbilling.AccessDecisionNotAllowed), - // Action: to.Ptr("Microsoft.Subscription/subscriptions/write"), - // }} -} diff --git a/sdk/resourcemanager/billing/armbilling/policies_client.go b/sdk/resourcemanager/billing/armbilling/policies_client.go index 29c00c7fb82a..35329cc3d691 100644 --- a/sdk/resourcemanager/billing/armbilling/policies_client.go +++ b/sdk/resourcemanager/billing/armbilling/policies_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PoliciesClient contains the methods for the Policies group. diff --git a/sdk/resourcemanager/billing/armbilling/policies_client_example_test.go b/sdk/resourcemanager/billing/armbilling/policies_client_example_test.go deleted file mode 100644 index fe36109b6ff0..000000000000 --- a/sdk/resourcemanager/billing/armbilling/policies_client_example_test.go +++ /dev/null @@ -1,333 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByCustomer.json -func ExamplePoliciesClient_GetByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoliciesClient().GetByCustomer(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", armbilling.ServiceDefinedResourceNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomerPolicy = armbilling.CustomerPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/policies/default"), - // Properties: &armbilling.CustomerPolicyProperties{ - // ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByCustomer.json -func ExamplePoliciesClient_BeginCreateOrUpdateByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoliciesClient().BeginCreateOrUpdateByCustomer(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", armbilling.CustomerPolicy{ - Properties: &armbilling.CustomerPolicyProperties{ - ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomerPolicy = armbilling.CustomerPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/policies/default"), - // Properties: &armbilling.CustomerPolicyProperties{ - // ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByBillingProfile.json -func ExamplePoliciesClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoliciesClient().GetByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProfilePolicy = armbilling.ProfilePolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/policies/default"), - // Properties: &armbilling.ProfilePolicyProperties{ - // InvoiceSectionLabelManagement: to.Ptr(armbilling.InvoiceSectionLabelManagementPolicyAllowed), - // MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyAllAllowed), - // ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyAllowed), - // SavingsPlanPurchases: to.Ptr(armbilling.SavingsPlanPurchasesPolicyAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByBillingProfile.json -func ExamplePoliciesClient_BeginCreateOrUpdateByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoliciesClient().BeginCreateOrUpdateByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", armbilling.ProfilePolicy{ - Properties: &armbilling.ProfilePolicyProperties{ - InvoiceSectionLabelManagement: to.Ptr(armbilling.InvoiceSectionLabelManagementPolicyAllowed), - MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyAllAllowed), - ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyAllowed), - SavingsPlanPurchases: to.Ptr(armbilling.SavingsPlanPurchasesPolicyAllowed), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProfilePolicy = armbilling.ProfilePolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/policies/default"), - // Properties: &armbilling.ProfilePolicyProperties{ - // InvoiceSectionLabelManagement: to.Ptr(armbilling.InvoiceSectionLabelManagementPolicyAllowed), - // MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyAllAllowed), - // ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyAllowed), - // SavingsPlanPurchases: to.Ptr(armbilling.SavingsPlanPurchasesPolicyAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByCustomerAtBillingAccount.json -func ExamplePoliciesClient_GetByCustomerAtBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoliciesClient().GetByCustomerAtBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomerPolicy = armbilling.CustomerPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/policies/default"), - // Properties: &armbilling.CustomerPolicyProperties{ - // ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByCustomerAtBillingAccount.json -func ExamplePoliciesClient_BeginCreateOrUpdateByCustomerAtBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoliciesClient().BeginCreateOrUpdateByCustomerAtBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.CustomerPolicy{ - Properties: &armbilling.CustomerPolicyProperties{ - ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomerPolicy = armbilling.CustomerPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/policies/default"), - // Properties: &armbilling.CustomerPolicyProperties{ - // ViewCharges: to.Ptr(armbilling.ViewChargesPolicyAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByBillingAccount.json -func ExamplePoliciesClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoliciesClient().GetByBillingAccount(ctx, "1234567", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccountPolicy = armbilling.AccountPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234567/policies/default"), - // Properties: &armbilling.AccountPolicyProperties{ - // EnterpriseAgreementPolicies: &armbilling.AccountPolicyPropertiesEnterpriseAgreementPolicies{ - // AuthenticationType: to.Ptr(armbilling.EnrollmentAuthLevelStateOrganizationalAccountOnly), - // }, - // MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyAllAllowed), - // ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyAllowed), - // SavingsPlanPurchases: to.Ptr(armbilling.SavingsPlanPurchasesPolicyNotAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByBillingAccount.json -func ExamplePoliciesClient_BeginCreateOrUpdateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoliciesClient().BeginCreateOrUpdateByBillingAccount(ctx, "1234567", armbilling.AccountPolicy{ - Properties: &armbilling.AccountPolicyProperties{ - EnterpriseAgreementPolicies: &armbilling.AccountPolicyPropertiesEnterpriseAgreementPolicies{ - AuthenticationType: to.Ptr(armbilling.EnrollmentAuthLevelStateOrganizationalAccountOnly), - }, - MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyAllAllowed), - ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyAllowed), - SavingsPlanPurchases: to.Ptr(armbilling.SavingsPlanPurchasesPolicyNotAllowed), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccountPolicy = armbilling.AccountPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/policies"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234567/policies/default"), - // Properties: &armbilling.AccountPolicyProperties{ - // EnterpriseAgreementPolicies: &armbilling.AccountPolicyPropertiesEnterpriseAgreementPolicies{ - // AuthenticationType: to.Ptr(armbilling.EnrollmentAuthLevelStateOrganizationalAccountOnly), - // }, - // MarketplacePurchases: to.Ptr(armbilling.MarketplacePurchasesPolicyAllAllowed), - // ReservationPurchases: to.Ptr(armbilling.ReservationPurchasesPolicyAllowed), - // SavingsPlanPurchases: to.Ptr(armbilling.SavingsPlanPurchasesPolicyNotAllowed), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetBySubscription.json -func ExamplePoliciesClient_GetBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoliciesClient().GetBySubscription(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionPolicy = armbilling.SubscriptionPolicy{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/policies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/policies/default"), - // Properties: &armbilling.SubscriptionPolicyProperties{ - // Policies: []*armbilling.PolicySummary{ - // { - // Name: to.Ptr("ViewCharges"), - // PolicyType: to.Ptr(armbilling.PolicyTypeSystemControlled), - // Scope: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - // Value: to.Ptr("Allowed"), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/products_client.go b/sdk/resourcemanager/billing/armbilling/products_client.go index 0f8c8ed0590e..ef1dff404b85 100644 --- a/sdk/resourcemanager/billing/armbilling/products_client.go +++ b/sdk/resourcemanager/billing/armbilling/products_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ProductsClient contains the methods for the Products group. diff --git a/sdk/resourcemanager/billing/armbilling/products_client_example_test.go b/sdk/resourcemanager/billing/armbilling/products_client_example_test.go deleted file mode 100644 index 0d4c88066f64..000000000000 --- a/sdk/resourcemanager/billing/armbilling/products_client_example_test.go +++ /dev/null @@ -1,558 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewListByInvoiceSectionPager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", &armbilling.ProductsClientListByInvoiceSectionOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductListResult = armbilling.ProductListResult{ - // Value: []*armbilling.Product{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("My Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Test Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Test Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewListByBillingProfilePager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "ea36e548-1505-41db-bebc-46fff3d37998", &armbilling.ProductsClientListByBillingProfileOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductListResult = armbilling.ProductListResult{ - // Value: []*armbilling.Product{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("My Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Test Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Test Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewListByCustomerPager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "Q7GV-UUVA-PJA-TGB", &armbilling.ProductsClientListByCustomerOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductListResult = armbilling.ProductListResult{ - // Value: []*armbilling.Product{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("My Product"), - // SKUDescription: to.Ptr("Microsoft Azure Standard"), - // SKUID: to.Ptr("0002"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("Test Product"), - // SKUDescription: to.Ptr("Microsoft Azure Standard"), - // SKUID: to.Ptr("0002"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProducts/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("Dev Test Product"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productMove.json -func ExampleProductsClient_BeginMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginMove(ctx, "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "6b96d3f2-9008-4a9d-912f-f87744185aa3", armbilling.MoveProductRequest{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Product = armbilling.Product{ - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/products/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.ProductProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("My Product"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // SKUDescription: to.Ptr("Microsoft Azure Plan"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productValidateMoveFailure.json -func ExampleProductsClient_ValidateMoveEligibility_productValidateMoveFailure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().ValidateMoveEligibility(ctx, "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "6b96d3f2-9008-4a9d-912f-f87744185aa3", armbilling.MoveProductRequest{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MoveProductEligibilityResult = armbilling.MoveProductEligibilityResult{ - // ErrorDetails: &armbilling.MoveProductEligibilityResultErrorDetails{ - // Code: to.Ptr(armbilling.MoveValidationErrorCodeProductInactive), - // Message: to.Ptr("Invoice Sections can only be changed for active products."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productValidateMoveSuccess.json -func ExampleProductsClient_ValidateMoveEligibility_productValidateMoveSuccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().ValidateMoveEligibility(ctx, "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "6b96d3f2-9008-4a9d-912f-f87744185aa3", armbilling.MoveProductRequest{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MoveProductEligibilityResult = armbilling.MoveProductEligibilityResult{ - // IsMoveEligible: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsGet.json -func ExampleProductsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Product = armbilling.Product{ - // Name: to.Ptr("90000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/products/90000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.ProductProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("My product"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr("2023-01-04T22:39:34.2606750Z"), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsUpdate.json -func ExampleProductsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().Update(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.ProductPatch{ - Properties: &armbilling.ProductProperties{ - AutoRenew: to.Ptr(armbilling.AutoRenewOn), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Product = armbilling.Product{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/products/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.ProductProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Product Display Name"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr("2023-01-05T22:39:34.2606750Z"), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.ProductsClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProductListResult = armbilling.ProductListResult{ - // Value: []*armbilling.Product{ - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/products/90000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.ProductProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("My product"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr("2023-01-04T22:39:34.2606750Z"), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/products/90000000-0000-0000-0000-000000000001"), - // Properties: &armbilling.ProductProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Test product"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // ProductType: to.Ptr("Software Product Type"), - // ProductTypeID: to.Ptr("EFG456"), - // PurchaseDate: to.Ptr("2023-01-06T22:39:34.2606750Z"), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusActive), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/products"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/products/90000000-0000-0000-0000-000000000002"), - // Properties: &armbilling.ProductProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Dev product"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // ProductType: to.Ptr("Reservation Product Type"), - // ProductTypeID: to.Ptr("JKL789"), - // PurchaseDate: to.Ptr("2023-01-05T22:39:34.2606750Z"), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.ProductStatusSuspended), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/profiles_client.go b/sdk/resourcemanager/billing/armbilling/profiles_client.go index be75785bb10e..93aefbe69e39 100644 --- a/sdk/resourcemanager/billing/armbilling/profiles_client.go +++ b/sdk/resourcemanager/billing/armbilling/profiles_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ProfilesClient contains the methods for the BillingProfiles group. diff --git a/sdk/resourcemanager/billing/armbilling/profiles_client_example_test.go b/sdk/resourcemanager/billing/armbilling/profiles_client_example_test.go deleted file mode 100644 index ff0180263495..000000000000 --- a/sdk/resourcemanager/billing/armbilling/profiles_client_example_test.go +++ /dev/null @@ -1,548 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesValidateDeleteEligibilityFailure.json -func ExampleProfilesClient_ValidateDeleteEligibility_billingProfilesValidateDeleteEligibilityFailure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().ValidateDeleteEligibility(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeleteBillingProfileEligibilityResult = armbilling.DeleteBillingProfileEligibilityResult{ - // EligibilityDetails: []*armbilling.DeleteBillingProfileEligibilityDetail{ - // { - // Code: to.Ptr(armbilling.DeleteBillingProfileEligibilityCodeActiveBillingSubscriptions), - // Message: to.Ptr("There are active or disabled subscriptions assigned to the invoice section. Either move the subscription to another invoice section or delete the subscriptions and then try deleting the invoice section."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteBillingProfileEligibilityCodeLastBillingProfile), - // Message: to.Ptr("Billing profile cannot be deleted as this is the only billing profile in this billing account."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteBillingProfileEligibilityCodeOutstandingCharges), - // Message: to.Ptr("Billing Profile cannot be deleted as there are outstanding charges on this billing profile."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteBillingProfileEligibilityCodePendingCharges), - // Message: to.Ptr("Billing Profile cannot be deleted as there are pending charges accumulating on this billing profile."), - // }, - // { - // Code: to.Ptr(armbilling.DeleteBillingProfileEligibilityCodeReservedInstances), - // Message: to.Ptr("Billing Profile cannot be deleted as there are reserved assets with a billing plan."), - // }}, - // EligibilityStatus: to.Ptr(armbilling.DeleteBillingProfileEligibilityStatusNotAllowed), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesValidateDeleteEligibilitySuccess.json -func ExampleProfilesClient_ValidateDeleteEligibility_billingProfilesValidateDeleteEligibilitySuccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().ValidateDeleteEligibility(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeleteBillingProfileEligibilityResult = armbilling.DeleteBillingProfileEligibilityResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesDelete.json -func ExampleProfilesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProfilesClient().BeginDelete(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesGet.json -func ExampleProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProfilesClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Profile = armbilling.Profile{ - // Name: to.Ptr("xxxx-xxxx-xxx-xxx"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Properties: &armbilling.ProfileProperties{ - // BillTo: &armbilling.ProfilePropertiesBillTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Currency: to.Ptr("USD"), - // DisplayName: to.Ptr("Billing Profile 1"), - // HasReadAccess: to.Ptr(true), - // InvoiceDay: to.Ptr[int32](5), - // InvoiceEmailOptIn: to.Ptr(true), - // InvoiceRecipients: []*string{ - // to.Ptr("abc@contoso.com"), - // to.Ptr("xyz@contoso.com")}, - // PoNumber: to.Ptr("ABC12345"), - // ShipTo: &armbilling.ProfilePropertiesShipTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // SoldTo: &armbilling.ProfilePropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // SpendingLimit: to.Ptr(armbilling.SpendingLimitOn), - // SpendingLimitDetails: []*armbilling.SpendingLimitDetails{ - // { - // Type: to.Ptr(armbilling.SpendingLimitTypeFreeAccount), - // Amount: to.Ptr[float32](200), - // Currency: to.Ptr("USD"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T00:00:00.000Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armbilling.SpendingLimitStatusActive), - // }}, - // Status: to.Ptr(armbilling.BillingProfileStatusWarned), - // StatusReasonCode: to.Ptr(armbilling.BillingProfileStatusReasonCodePastDue), - // SystemID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesCreateOrUpdate.json -func ExampleProfilesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProfilesClient().BeginCreateOrUpdate(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", armbilling.Profile{ - Properties: &armbilling.ProfileProperties{ - BillTo: &armbilling.ProfilePropertiesBillTo{ - AddressLine1: to.Ptr("Test Address1"), - AddressLine2: to.Ptr("Test Address2"), - AddressLine3: to.Ptr("Test Address3"), - City: to.Ptr("City"), - CompanyName: to.Ptr("Contoso"), - Country: to.Ptr("US"), - Email: to.Ptr("abc@contoso.com"), - FirstName: to.Ptr("Test"), - IsValidAddress: to.Ptr(true), - LastName: to.Ptr("User"), - PhoneNumber: to.Ptr("000-000-0000"), - PostalCode: to.Ptr("00000"), - Region: to.Ptr("WA"), - }, - DisplayName: to.Ptr("Billing Profile 1"), - EnabledAzurePlans: []*armbilling.AzurePlan{ - { - SKUID: to.Ptr("0001"), - }, - { - SKUID: to.Ptr("0002"), - }}, - InvoiceEmailOptIn: to.Ptr(true), - PoNumber: to.Ptr("ABC12345"), - ShipTo: &armbilling.ProfilePropertiesShipTo{ - AddressLine1: to.Ptr("Test Address1"), - AddressLine2: to.Ptr("Test Address2"), - AddressLine3: to.Ptr("Test Address3"), - City: to.Ptr("City"), - CompanyName: to.Ptr("Contoso"), - Country: to.Ptr("US"), - Email: to.Ptr("abc@contoso.com"), - FirstName: to.Ptr("Test"), - IsValidAddress: to.Ptr(true), - LastName: to.Ptr("User"), - PhoneNumber: to.Ptr("000-000-0000"), - PostalCode: to.Ptr("00000"), - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Profile = armbilling.Profile{ - // Name: to.Ptr("xxxx-xxxx-xxx-xxx"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Properties: &armbilling.ProfileProperties{ - // BillTo: &armbilling.ProfilePropertiesBillTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Currency: to.Ptr("USD"), - // DisplayName: to.Ptr("Billing Profile 1"), - // HasReadAccess: to.Ptr(true), - // InvoiceDay: to.Ptr[int32](5), - // InvoiceEmailOptIn: to.Ptr(true), - // PoNumber: to.Ptr("ABC12345"), - // ShipTo: &armbilling.ProfilePropertiesShipTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Status: to.Ptr(armbilling.BillingProfileStatusActive), - // SystemID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProfilesClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.ProfilesClientListByBillingAccountOptions{IncludeDeleted: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProfileListResult = armbilling.ProfileListResult{ - // Value: []*armbilling.Profile{ - // { - // Name: to.Ptr("xxxx-xxxx-xxx-xxx"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Properties: &armbilling.ProfileProperties{ - // BillTo: &armbilling.ProfilePropertiesBillTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Currency: to.Ptr("USD"), - // DisplayName: to.Ptr("Billing Profile 1"), - // HasReadAccess: to.Ptr(true), - // InvoiceDay: to.Ptr[int32](5), - // InvoiceEmailOptIn: to.Ptr(true), - // InvoiceRecipients: []*string{ - // to.Ptr("abc@contoso.com"), - // to.Ptr("xyz@contoso.com")}, - // PoNumber: to.Ptr("ABC12345"), - // ShipTo: &armbilling.ProfilePropertiesShipTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // SoldTo: &armbilling.ProfilePropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // SpendingLimit: to.Ptr(armbilling.SpendingLimitOn), - // SpendingLimitDetails: []*armbilling.SpendingLimitDetails{ - // { - // Type: to.Ptr(armbilling.SpendingLimitTypeFreeAccount), - // Amount: to.Ptr[float32](200), - // Currency: to.Ptr("USD"), - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T00:00:00.000Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()), - // Status: to.Ptr(armbilling.SpendingLimitStatusActive), - // }}, - // Status: to.Ptr(armbilling.BillingProfileStatusWarned), - // StatusReasonCode: to.Ptr(armbilling.BillingProfileStatusReasonCodePastDue), - // SystemID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // { - // Name: to.Ptr("yyyy-yyyy-yyy-yyy"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/yyyy-yyyy-yyy-yyy"), - // Properties: &armbilling.ProfileProperties{ - // BillTo: &armbilling.ProfilePropertiesBillTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Currency: to.Ptr("USD"), - // DisplayName: to.Ptr("Billing Profile 2"), - // HasReadAccess: to.Ptr(true), - // InvoiceDay: to.Ptr[int32](5), - // InvoiceEmailOptIn: to.Ptr(true), - // InvoiceRecipients: []*string{ - // to.Ptr("abc@contoso.com"), - // to.Ptr("xyz@contoso.com")}, - // PoNumber: to.Ptr("ABC12345"), - // ShipTo: &armbilling.ProfilePropertiesShipTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // SoldTo: &armbilling.ProfilePropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Status: to.Ptr(armbilling.BillingProfileStatusUnderReview), - // StatusReasonCode: to.Ptr(armbilling.BillingProfileStatusReasonCodeUnusualActivity), - // SystemID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // }, - // }, - // { - // Name: to.Ptr("zzzz-zzzz-zzz-zzz"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/zzzz-zzzz-zzz-zzz"), - // Properties: &armbilling.ProfileProperties{ - // BillTo: &armbilling.ProfilePropertiesBillTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Currency: to.Ptr("USD"), - // DisplayName: to.Ptr("Billing Profile 1"), - // HasReadAccess: to.Ptr(true), - // InvoiceDay: to.Ptr[int32](5), - // InvoiceEmailOptIn: to.Ptr(true), - // InvoiceRecipients: []*string{ - // to.Ptr("abc@contoso.com"), - // to.Ptr("xyz@contoso.com")}, - // PoNumber: to.Ptr("ABC12345"), - // ShipTo: &armbilling.ProfilePropertiesShipTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // SoldTo: &armbilling.ProfilePropertiesSoldTo{ - // AddressLine1: to.Ptr("Test Address1"), - // AddressLine2: to.Ptr("Test Address2"), - // AddressLine3: to.Ptr("Test Address3"), - // City: to.Ptr("City"), - // CompanyName: to.Ptr("Contoso"), - // Country: to.Ptr("US"), - // Email: to.Ptr("abc@contoso.com"), - // FirstName: to.Ptr("Test"), - // IsValidAddress: to.Ptr(true), - // LastName: to.Ptr("User"), - // PhoneNumber: to.Ptr("000-000-0000"), - // PostalCode: to.Ptr("00000"), - // Region: to.Ptr("WA"), - // }, - // Status: to.Ptr(armbilling.BillingProfileStatusActive), - // SystemID: to.Ptr("33333333-3333-3333-3333-333333333333"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/property_client.go b/sdk/resourcemanager/billing/armbilling/property_client.go deleted file mode 100644 index e0d87ac2ab57..000000000000 --- a/sdk/resourcemanager/billing/armbilling/property_client.go +++ /dev/null @@ -1,166 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armbilling - -import ( - "context" - "errors" - "net/http" - "net/url" - "strconv" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// PropertyClient contains the methods for the BillingProperty group. -// Don't use this type directly, use NewPropertyClient() instead. -type PropertyClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPropertyClient creates a new instance of PropertyClient with the specified values. -// - subscriptionID - The ID that uniquely identifies a billing subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPropertyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PropertyClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PropertyClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets the billing properties for a subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - options - PropertyClientGetOptions contains the optional parameters for the PropertyClient.Get method. -func (client *PropertyClient) Get(ctx context.Context, options *PropertyClientGetOptions) (PropertyClientGetResponse, error) { - var err error - const operationName = "PropertyClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, options) - if err != nil { - return PropertyClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PropertyClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PropertyClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PropertyClient) getCreateRequest(ctx context.Context, options *PropertyClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - if options != nil && options.IncludeBillingCountry != nil { - reqQP.Set("includeBillingCountry", strconv.FormatBool(*options.IncludeBillingCountry)) - } - if options != nil && options.IncludeTransitionStatus != nil { - reqQP.Set("includeTransitionStatus", strconv.FormatBool(*options.IncludeTransitionStatus)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PropertyClient) getHandleResponse(resp *http.Response) (PropertyClientGetResponse, error) { - result := PropertyClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Property); err != nil { - return PropertyClientGetResponse{}, err - } - return result, nil -} - -// Update - Updates the billing property of a subscription. Currently, cost center can be updated for billing accounts with -// agreement type Microsoft Customer Agreement and subscription service usage address can -// be updated for billing accounts with agreement type Microsoft Online Service Program. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-01 -// - parameters - A billing property. -// - options - PropertyClientUpdateOptions contains the optional parameters for the PropertyClient.Update method. -func (client *PropertyClient) Update(ctx context.Context, parameters Property, options *PropertyClientUpdateOptions) (PropertyClientUpdateResponse, error) { - var err error - const operationName = "PropertyClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, parameters, options) - if err != nil { - return PropertyClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PropertyClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PropertyClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *PropertyClient) updateCreateRequest(ctx context.Context, parameters Property, options *PropertyClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *PropertyClient) updateHandleResponse(resp *http.Response) (PropertyClientUpdateResponse, error) { - result := PropertyClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Property); err != nil { - return PropertyClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/billing/armbilling/property_client_example_test.go b/sdk/resourcemanager/billing/armbilling/property_client_example_test.go deleted file mode 100644 index 4ab5a267ad2f..000000000000 --- a/sdk/resourcemanager/billing/armbilling/property_client_example_test.go +++ /dev/null @@ -1,280 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMCA.json -func ExamplePropertyClient_Get_billingPropertyGetMca() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPropertyClient().Get(ctx, &armbilling.PropertyClientGetOptions{IncludeBillingCountry: nil, - IncludeTransitionStatus: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Property = armbilling.Property{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingProperty"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingProperty/default"), - // Properties: &armbilling.PropertyProperties{ - // BillingAccountAgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // BillingAccountDisplayName: to.Ptr("My Account"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000"), - // BillingAccountSoldToCountry: to.Ptr("US"), - // BillingAccountType: to.Ptr(armbilling.AccountTypeBusiness), - // BillingProfileDisplayName: to.Ptr("Contoso"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000/billingProfiles/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileSpendingLimit: to.Ptr(armbilling.SpendingLimitOff), - // BillingProfileStatus: to.Ptr(armbilling.BillingProfileStatusActive), - // CostCenter: to.Ptr("1010"), - // InvoiceSectionDisplayName: to.Ptr("Operations"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000/billingProfiles/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // SKUDescription: to.Ptr("Microsoft Azure Plan"), - // SKUID: to.Ptr("0001"), - // SubscriptionBillingStatus: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionBillingStatusDetails: []*armbilling.SubscriptionStatusDetails{ - // { - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // Reason: to.Ptr(armbilling.SubscriptionStatusReasonCancelled), - // }}, - // SubscriptionBillingType: to.Ptr(armbilling.SubscriptionBillingTypeFree), - // SubscriptionWorkloadType: to.Ptr(armbilling.SubscriptionWorkloadTypeProduction), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMOSP.json -func ExamplePropertyClient_Get_billingPropertyGetMosp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPropertyClient().Get(ctx, &armbilling.PropertyClientGetOptions{IncludeBillingCountry: nil, - IncludeTransitionStatus: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Property = armbilling.Property{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingProperty"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingProperty/default"), - // Properties: &armbilling.PropertyProperties{ - // BillingAccountAgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftOnlineServicesProgram), - // BillingAccountDisplayName: to.Ptr("My Account"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000"), - // BillingAccountSoldToCountry: to.Ptr("US"), - // BillingAccountType: to.Ptr(armbilling.AccountTypeIndividual), - // SubscriptionBillingType: to.Ptr(armbilling.SubscriptionBillingTypeFree), - // SubscriptionServiceUsageAddress: &armbilling.PropertyPropertiesSubscriptionServiceUsageAddress{ - // AddressLine1: to.Ptr("Address line 1"), - // AddressLine2: to.Ptr("Address line 2"), - // City: to.Ptr("City"), - // Country: to.Ptr("US"), - // FirstName: to.Ptr("Jenny"), - // LastName: to.Ptr("Doe"), - // MiddleName: to.Ptr("Ann"), - // PostalCode: to.Ptr("12345"), - // Region: to.Ptr("State"), - // }, - // SubscriptionWorkloadType: to.Ptr(armbilling.SubscriptionWorkloadTypeProduction), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMPA.json -func ExamplePropertyClient_Get_billingPropertyGetMpa() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPropertyClient().Get(ctx, &armbilling.PropertyClientGetOptions{IncludeBillingCountry: nil, - IncludeTransitionStatus: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Property = armbilling.Property{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingProperty"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingProperty/default"), - // Properties: &armbilling.PropertyProperties{ - // BillingAccountAgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // BillingAccountDisplayName: to.Ptr("My Account"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000"), - // BillingAccountSoldToCountry: to.Ptr("US"), - // BillingAccountType: to.Ptr(armbilling.AccountTypeBusiness), - // BillingProfileDisplayName: to.Ptr("Contoso"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000/billingProfiles/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileSpendingLimit: to.Ptr(armbilling.SpendingLimitOff), - // BillingProfileStatus: to.Ptr(armbilling.BillingProfileStatusActive), - // CostCenter: to.Ptr("1010"), - // CustomerDisplayName: to.Ptr("Operations"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000/billingProfiles/billingProfiles/xxxx-xxxx-xxx-xxx/customers/yyyy-yyyy-yyy-yyy"), - // SKUDescription: to.Ptr("Microsoft Azure Plan"), - // SKUID: to.Ptr("0001"), - // SubscriptionBillingStatus: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionBillingStatusDetails: []*armbilling.SubscriptionStatusDetails{ - // { - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // Reason: to.Ptr(armbilling.SubscriptionStatusReasonCancelled), - // }}, - // SubscriptionBillingType: to.Ptr(armbilling.SubscriptionBillingTypeFree), - // SubscriptionWorkloadType: to.Ptr(armbilling.SubscriptionWorkloadTypeProduction), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyPatchCostCenter.json -func ExamplePropertyClient_Update_billingPropertyPatchCostCenter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPropertyClient().Update(ctx, armbilling.Property{ - Properties: &armbilling.PropertyProperties{ - CostCenter: to.Ptr("1010"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Property = armbilling.Property{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingProperty"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingProperty/default"), - // Properties: &armbilling.PropertyProperties{ - // BillingAccountAgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftCustomerAgreement), - // BillingAccountDisplayName: to.Ptr("My Account"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000"), - // BillingAccountSoldToCountry: to.Ptr("US"), - // BillingAccountType: to.Ptr(armbilling.AccountTypeBusiness), - // BillingProfileDisplayName: to.Ptr("Contoso"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000/billingProfiles/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileSpendingLimit: to.Ptr(armbilling.SpendingLimitOff), - // BillingProfileStatus: to.Ptr(armbilling.BillingProfileStatusActive), - // CostCenter: to.Ptr("1010"), - // InvoiceSectionDisplayName: to.Ptr("Operations"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000/billingProfiles/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // SKUDescription: to.Ptr("Microsoft Azure Plan"), - // SKUID: to.Ptr("0001"), - // SubscriptionBillingStatus: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionBillingStatusDetails: []*armbilling.SubscriptionStatusDetails{ - // { - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-01T17:32:28.000Z"); return t}()), - // Reason: to.Ptr(armbilling.SubscriptionStatusReasonCancelled), - // }}, - // SubscriptionBillingType: to.Ptr(armbilling.SubscriptionBillingTypeFree), - // SubscriptionWorkloadType: to.Ptr(armbilling.SubscriptionWorkloadTypeProduction), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyPatchSubscriptionServiceUsageAddress.json -func ExamplePropertyClient_Update_billingPropertyPatchSubscriptionServiceUsageAddress() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPropertyClient().Update(ctx, armbilling.Property{ - Properties: &armbilling.PropertyProperties{ - SubscriptionServiceUsageAddress: &armbilling.PropertyPropertiesSubscriptionServiceUsageAddress{ - AddressLine1: to.Ptr("Address line 1"), - AddressLine2: to.Ptr("Address line 2"), - City: to.Ptr("City"), - Country: to.Ptr("US"), - FirstName: to.Ptr("Jenny"), - LastName: to.Ptr("Doe"), - MiddleName: to.Ptr("Ann"), - PostalCode: to.Ptr("12345"), - Region: to.Ptr("State"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Property = armbilling.Property{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Billing/billingProperty"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingProperty/default"), - // Properties: &armbilling.PropertyProperties{ - // BillingAccountAgreementType: to.Ptr(armbilling.AgreementTypeMicrosoftOnlineServicesProgram), - // BillingAccountDisplayName: to.Ptr("My Account"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000"), - // BillingAccountSoldToCountry: to.Ptr("US"), - // BillingAccountType: to.Ptr(armbilling.AccountTypeIndividual), - // SubscriptionBillingType: to.Ptr(armbilling.SubscriptionBillingTypeFree), - // SubscriptionServiceUsageAddress: &armbilling.PropertyPropertiesSubscriptionServiceUsageAddress{ - // AddressLine1: to.Ptr("Address line 1"), - // AddressLine2: to.Ptr("Address line 2"), - // City: to.Ptr("City"), - // Country: to.Ptr("US"), - // FirstName: to.Ptr("Jenny"), - // LastName: to.Ptr("Doe"), - // MiddleName: to.Ptr("Ann"), - // PostalCode: to.Ptr("12345"), - // Region: to.Ptr("State"), - // }, - // SubscriptionWorkloadType: to.Ptr(armbilling.SubscriptionWorkloadTypeProduction), - // }, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/recipienttransfers_client.go b/sdk/resourcemanager/billing/armbilling/recipienttransfers_client.go index acf6ec6af0e9..1779ba1ba668 100644 --- a/sdk/resourcemanager/billing/armbilling/recipienttransfers_client.go +++ b/sdk/resourcemanager/billing/armbilling/recipienttransfers_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecipientTransfersClient contains the methods for the RecipientTransfers group. diff --git a/sdk/resourcemanager/billing/armbilling/recipienttransfers_client_example_test.go b/sdk/resourcemanager/billing/armbilling/recipienttransfers_client_example_test.go deleted file mode 100644 index 460b35bb0cd3..000000000000 --- a/sdk/resourcemanager/billing/armbilling/recipienttransfers_client_example_test.go +++ /dev/null @@ -1,255 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersAccept.json -func ExampleRecipientTransfersClient_Accept() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecipientTransfersClient().Accept(ctx, "aabb123", armbilling.AcceptTransferRequest{ - Properties: &armbilling.AcceptTransferProperties{ - ProductDetails: []*armbilling.ProductDetails{ - { - ProductID: to.Ptr("subscriptionId"), - ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - }, - { - ProductID: to.Ptr("reservedInstanceId"), - ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecipientTransferDetails = armbilling.RecipientTransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/transfers/aabb123"), - // Properties: &armbilling.RecipientTransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersValidate.json -func ExampleRecipientTransfersClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecipientTransfersClient().Validate(ctx, "aabb123", armbilling.AcceptTransferRequest{ - Properties: &armbilling.AcceptTransferProperties{ - ProductDetails: []*armbilling.ProductDetails{ - { - ProductID: to.Ptr("subscriptionId"), - ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - }, - { - ProductID: to.Ptr("reservedInstanceId"), - ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ValidateTransferListResponse = armbilling.ValidateTransferListResponse{ - // Value: []*armbilling.ValidateTransferResponse{ - // { - // Properties: &armbilling.ValidateTransferResponseProperties{ - // ProductID: to.Ptr("subscriptionId"), - // Results: []*armbilling.ValidationResultProperties{ - // { - // Code: to.Ptr("NotIntendedRecipient"), - // Level: to.Ptr("Error"), - // Message: to.Ptr("Intended recipient is different."), - // }}, - // Status: to.Ptr("Failed"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersDecline.json -func ExampleRecipientTransfersClient_Decline() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecipientTransfersClient().Decline(ctx, "aabb123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecipientTransferDetails = armbilling.RecipientTransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/transfers/aabb123"), - // Properties: &armbilling.RecipientTransferProperties{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusDeclined), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersGet.json -func ExampleRecipientTransfersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecipientTransfersClient().Get(ctx, "aabb123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecipientTransferDetails = armbilling.RecipientTransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/transfers/aabb123"), - // Properties: &armbilling.RecipientTransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersList.json -func ExampleRecipientTransfersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecipientTransfersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecipientTransferDetailsListResult = armbilling.RecipientTransferDetailsListResult{ - // Value: []*armbilling.RecipientTransferDetails{ - // { - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/transfers/aabb123"), - // Properties: &armbilling.RecipientTransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductType("ReservedInstance")), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/requests_client.go b/sdk/resourcemanager/billing/armbilling/requests_client.go index 497428b43343..351d406e4f1a 100644 --- a/sdk/resourcemanager/billing/armbilling/requests_client.go +++ b/sdk/resourcemanager/billing/armbilling/requests_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // RequestsClient contains the methods for the BillingRequests group. diff --git a/sdk/resourcemanager/billing/armbilling/requests_client_example_test.go b/sdk/resourcemanager/billing/armbilling/requests_client_example_test.go deleted file mode 100644 index b4d28813da25..000000000000 --- a/sdk/resourcemanager/billing/armbilling/requests_client_example_test.go +++ /dev/null @@ -1,557 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByBillingProfile.json -func ExampleRequestsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRequestsClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", &armbilling.RequestsClientListByBillingProfileOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RequestListResult = armbilling.RequestListResult{ - // Value: []*armbilling.Request{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByCustomer.json -func ExampleRequestsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRequestsClient().NewListByCustomerPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", &armbilling.RequestsClientListByCustomerOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RequestListResult = armbilling.RequestListResult{ - // Value: []*armbilling.Request{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // CustomerDisplayName: to.Ptr("Customer 1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // CustomerName: to.Ptr("11111111-1111-1111-1111-111111111111"), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByInvoiceSection.json -func ExampleRequestsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRequestsClient().NewListByInvoiceSectionPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", &armbilling.RequestsClientListByInvoiceSectionOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RequestListResult = armbilling.RequestListResult{ - // Value: []*armbilling.Request{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // InvoiceSectionDisplayName: to.Ptr("Department 1"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByBillingAccount.json -func ExampleRequestsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRequestsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.RequestsClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RequestListResult = armbilling.RequestListResult{ - // Value: []*armbilling.Request{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeProvisioningAccess), - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("admin@contosofinance.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-02T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/associatedTenants/100000000-0000-0000-0000-00000000"), - // ReviewalDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-02T17:32:28.000Z"); return t}()), - // ReviewedBy: &armbilling.RequestPropertiesReviewedBy{ - // Upn: to.Ptr("admin@contosofinance.com"), - // }, - // Status: to.Ptr(armbilling.BillingRequestStatusApproved), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsGet.json -func ExampleRequestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRequestsClient().Get(ctx, "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Request = armbilling.Request{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("admin@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsCreateOrUpdate.json -func ExampleRequestsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRequestsClient().BeginCreateOrUpdate(ctx, "00000000-0000-0000-0000-000000000000", armbilling.Request{ - Properties: &armbilling.RequestProperties{ - Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - AdditionalInformation: map[string]*string{ - "RoleId": to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - }, - DecisionReason: to.Ptr("New team member"), - RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - Status: to.Ptr(armbilling.BillingRequestStatusPending), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Request = armbilling.Request{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("admin@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByUser.json -func ExampleRequestsClient_NewListByUserPager_billingRequestsListByUser() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRequestsClient().NewListByUserPager(&armbilling.RequestsClientListByUserOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RequestListResult = armbilling.RequestListResult{ - // Value: []*armbilling.Request{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeRoleAssignment), - // AdditionalInformation: map[string]*string{ - // "RoleId": to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // }, - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // Status: to.Ptr(armbilling.BillingRequestStatusPending), - // }, - // }, - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeProvisioningAccess), - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("admin@contosofinance.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-02T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/associatedTenants/100000000-0000-0000-0000-00000000"), - // ReviewalDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-02T17:32:28.000Z"); return t}()), - // ReviewedBy: &armbilling.RequestPropertiesReviewedBy{ - // Upn: to.Ptr("admin@contosofinance.com"), - // }, - // Status: to.Ptr(armbilling.BillingRequestStatusApproved), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByUserWithFilter.json -func ExampleRequestsClient_NewListByUserPager_billingRequestsListByUserWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRequestsClient().NewListByUserPager(&armbilling.RequestsClientListByUserOptions{Filter: to.Ptr("properties/status eq 'Approved'"), - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RequestListResult = armbilling.RequestListResult{ - // Value: []*armbilling.Request{ - // { - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingRequests"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingRequests/11111111-1111-1111-1111-111111111111"), - // Properties: &armbilling.RequestProperties{ - // Type: to.Ptr(armbilling.BillingRequestTypeProvisioningAccess), - // BillingAccountDisplayName: to.Ptr("Contoso"), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingAccountName: to.Ptr("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // CreatedBy: &armbilling.RequestPropertiesCreatedBy{ - // Upn: to.Ptr("foo@contoso.com"), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T17:32:28.000Z"); return t}()), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-15T17:32:28.000Z"); return t}()), - // LastUpdatedBy: &armbilling.RequestPropertiesLastUpdatedBy{ - // Upn: to.Ptr("admin@contosofinance.com"), - // }, - // LastUpdatedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-02T17:32:28.000Z"); return t}()), - // RequestScope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/associatedTenants/100000000-0000-0000-0000-00000000"), - // ReviewalDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-02T17:32:28.000Z"); return t}()), - // ReviewedBy: &armbilling.RequestPropertiesReviewedBy{ - // Upn: to.Ptr("admin@contosofinance.com"), - // }, - // Status: to.Ptr(armbilling.BillingRequestStatusApproved), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/reservationorders_client.go b/sdk/resourcemanager/billing/armbilling/reservationorders_client.go index e153906e067e..1805bef5679b 100644 --- a/sdk/resourcemanager/billing/armbilling/reservationorders_client.go +++ b/sdk/resourcemanager/billing/armbilling/reservationorders_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ReservationOrdersClient contains the methods for the ReservationOrders group. diff --git a/sdk/resourcemanager/billing/armbilling/reservationorders_client_example_test.go b/sdk/resourcemanager/billing/armbilling/reservationorders_client_example_test.go deleted file mode 100644 index bbf1d3ee6f51..000000000000 --- a/sdk/resourcemanager/billing/armbilling/reservationorders_client_example_test.go +++ /dev/null @@ -1,540 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationOrderGetByBillingAccount.json -func ExampleReservationOrdersClient_GetByBillingAccount_reservationOrderGetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationOrdersClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", &armbilling.ReservationOrdersClientGetByBillingAccountOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ReservationOrder = armbilling.ReservationOrder{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](27), - // Properties: &armbilling.ReservationOrderProperty{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-AAAA-AAA-AAA"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:13.973Z"); return t}()), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // OriginalQuantity: to.Ptr[int32](1), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // RequestDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Reservations: []*armbilling.Reservation{ - // { - // ID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/20000000-0000-0000-0000-000000000001"), - // }}, - // Term: to.Ptr("P3Y"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationOrderGetByBillingAccountWithExpandPlanInformation.json -func ExampleReservationOrdersClient_GetByBillingAccount_reservationOrderGetByBillingAccountWithExpandPlanInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationOrdersClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", &armbilling.ReservationOrdersClientGetByBillingAccountOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ReservationOrder = armbilling.ReservationOrder{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](26), - // Properties: &armbilling.ReservationOrderProperty{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-AAAA-AAA-AAA"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:13.973Z"); return t}()), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // OriginalQuantity: to.Ptr[int32](1), - // PlanInformation: &armbilling.ReservationOrderBillingPlanInformation{ - // NextPaymentDueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // Transactions: []*armbilling.ReservationPaymentDetail{ - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-12-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-12-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-01-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-01-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-02-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-02-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-03-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-03-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-04-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-04-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-05-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-05-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-06-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-06-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-07-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-07-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-08-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-08-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-09-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-09-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-10-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-10-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-11-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-11-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-12-25"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-12-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-02-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-03-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-04-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-05-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-07-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-08-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-09-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-10-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-11-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-12-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-01-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-02-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-03-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-04-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-05-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-06-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-07-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-08-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-09-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-10-25"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](19.88), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }}, - // }, - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // RequestDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Reservations: []*armbilling.Reservation{ - // { - // ID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/20000000-0000-0000-0000-000000000001"), - // }}, - // Term: to.Ptr("P3Y"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationOrdersListByBillingAccount.json -func ExampleReservationOrdersClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationOrdersClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.ReservationOrdersClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReservationOrderList = armbilling.ReservationOrderList{ - // Value: []*armbilling.ReservationOrder{ - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/400000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](10), - // Properties: &armbilling.ReservationOrderProperty{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-03T21:26:48.512Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/400000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanUpfront), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/400000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-AAAA-AAA-AAA"), - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-03T21:26:50.778Z"); return t}()), - // DisplayName: to.Ptr("SUSE_Plan_08-03-2021_14-22"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-03T21:26:48.512Z"); return t}()), - // OriginalQuantity: to.Ptr[int32](1), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // RequestDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-03T21:23:47.909Z"); return t}()), - // Reservations: []*armbilling.Reservation{ - // { - // ID: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/20000000-0000-0000-0000-000000000001"), - // }}, - // Term: to.Ptr("P3Y"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/reservations_client.go b/sdk/resourcemanager/billing/armbilling/reservations_client.go index 1c8737ebf63f..781ff463437e 100644 --- a/sdk/resourcemanager/billing/armbilling/reservations_client.go +++ b/sdk/resourcemanager/billing/armbilling/reservations_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ReservationsClient contains the methods for the Reservations group. diff --git a/sdk/resourcemanager/billing/armbilling/reservations_client_example_test.go b/sdk/resourcemanager/billing/armbilling/reservations_client_example_test.go deleted file mode 100644 index b5a194603143..000000000000 --- a/sdk/resourcemanager/billing/armbilling/reservations_client_example_test.go +++ /dev/null @@ -1,906 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.ReservationsClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Skiptoken: nil, - RefreshSummary: nil, - SelectedState: to.Ptr("Succeeded"), - Take: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReservationsListResult = armbilling.ReservationsListResult{ - // Summary: &armbilling.ReservationSummary{ - // CancelledCount: to.Ptr[float32](0), - // ExpiredCount: to.Ptr[float32](0), - // ExpiringCount: to.Ptr[float32](0), - // FailedCount: to.Ptr[float32](0), - // NoBenefitCount: to.Ptr[float32](0), - // PendingCount: to.Ptr[float32](0), - // ProcessingCount: to.Ptr[float32](0), - // SucceededCount: to.Ptr[float32](1), - // WarningCount: to.Ptr[float32](0), - // }, - // Value: []*armbilling.Reservation{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/00000000-0000-0000-0000-000000000001/reservations/00000000-0000-0000-0000-000000000000"), - // Location: to.Ptr("global"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeType: to.Ptr("Shared"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-18T21:54:31.074Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/eef82110-c91b-4395-9420-fcfcbefc5a47"), - // DisplayName: to.Ptr("VirtualMachineSoftware_01-18-2022_13-51"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // ExpiryDate: to.Ptr("2025-01-18"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-18T21:54:31.074Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0-12-31T15:54:17.000Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-01-18"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-18T21:51:29.906Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(false), - // ReservedResourceType: to.Ptr("VirtualMachineSoftware"), - // SKUDescription: to.Ptr("Sku description"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // UserFriendlyRenewState: to.Ptr("Off"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("mock_sku"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "AAAA-AAAA-AAA-AAA", &armbilling.ReservationsClientListByBillingProfileOptions{Filter: nil, - OrderBy: nil, - Skiptoken: nil, - RefreshSummary: nil, - SelectedState: to.Ptr("Succeeded"), - Take: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReservationsListResult = armbilling.ReservationsListResult{ - // Summary: &armbilling.ReservationSummary{ - // CancelledCount: to.Ptr[float32](0), - // ExpiredCount: to.Ptr[float32](0), - // ExpiringCount: to.Ptr[float32](0), - // FailedCount: to.Ptr[float32](0), - // NoBenefitCount: to.Ptr[float32](0), - // PendingCount: to.Ptr[float32](0), - // ProcessingCount: to.Ptr[float32](0), - // SucceededCount: to.Ptr[float32](1), - // WarningCount: to.Ptr[float32](0), - // }, - // Value: []*armbilling.Reservation{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/00000000-0000-0000-0000-000000000001/reservations/00000000-0000-0000-0000-000000000000"), - // Location: to.Ptr("global"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeType: to.Ptr("Shared"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-18T21:54:31.074Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/eef82110-c91b-4395-9420-fcfcbefc5a47"), - // DisplayName: to.Ptr("VirtualMachineSoftware_01-18-2022_13-51"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "1-01-01T00:00:00.000Z"); return t}()), - // ExpiryDate: to.Ptr("2025-01-18"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-18T21:54:31.074Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0-12-31T15:54:17.000Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2022-01-18"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-18T21:51:29.906Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(false), - // ReservedResourceType: to.Ptr("VirtualMachineSoftware"), - // SKUDescription: to.Ptr("Sku description"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // UserFriendlyRenewState: to.Ptr("Off"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("mock_sku"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationGetByBillingAccount.json -func ExampleReservationsClient_GetByReservationOrder_reservationGetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationsClient().GetByReservationOrder(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbilling.ReservationsClientGetByReservationOrderOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Reservation = armbilling.Reservation{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/30000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](15), - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeType: to.Ptr("Shared"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-24T01:46:05.425Z"); return t}()), - // ExpiryDate: to.Ptr("2024-11-25"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-24T01:46:05.534Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(true), - // RenewProperties: &armbilling.RenewPropertiesResponse{ - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PurchaseProperties: &armbilling.ReservationPurchaseRequest{ - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationPurchaseRequestProperties{ - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeShared), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30_renewed"), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // Quantity: to.Ptr[int32](1), - // Renew: to.Ptr(false), - // ReservedResourceProperties: &armbilling.ReservationPurchaseRequestPropertiesReservedResourceProperties{ - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // Term: to.Ptr("P3Y"), - // }, - // SKU: &armbilling.SKUName{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // }, - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // SKUDescription: to.Ptr("Reserved VM Instance, Standard_DS1_v2, US West, 3 Years"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // UserFriendlyRenewState: to.Ptr("On"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationGetByBillingAccountManagementGroup.json -func ExampleReservationsClient_GetByReservationOrder_reservationGetByBillingAccountManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationsClient().GetByReservationOrder(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbilling.ReservationsClientGetByReservationOrderOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Reservation = armbilling.Reservation{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/30000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](21), - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeProperties: &armbilling.ReservationAppliedScopeProperties{ - // DisplayName: to.Ptr("TestRg"), - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestRg"), - // TenantID: to.Ptr("50000000-0000-0000-0000-000000000009"), - // }, - // AppliedScopeType: to.Ptr("ManagementGroup"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // DisplayProvisioningState: to.Ptr("NoBenefit"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-26T01:19:31.991Z"); return t}()), - // ExpiryDate: to.Ptr("2024-11-25"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // ExtendedStatusInfo: &armbilling.ReservationExtendedStatusInfo{ - // Message: to.Ptr("The subscriptions utilizing the reservation were removed or transferred from this account and no longer receive the reservation benefit. You can cancel the reservation or transfer to the right account or create resources and subscriptions to map it to this reservation."), - // StatusCode: to.Ptr(armbilling.ReservationStatusCodeNoBenefit), - // }, - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-26T01:19:32.069Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(true), - // RenewProperties: &armbilling.RenewPropertiesResponse{ - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PurchaseProperties: &armbilling.ReservationPurchaseRequest{ - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationPurchaseRequestProperties{ - // AppliedScopeProperties: &armbilling.ReservationAppliedScopeProperties{ - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestRg"), - // TenantID: to.Ptr("50000000-0000-0000-0000-000000000009"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30_renewed"), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // Quantity: to.Ptr[int32](1), - // Renew: to.Ptr(false), - // ReservedResourceProperties: &armbilling.ReservationPurchaseRequestPropertiesReservedResourceProperties{ - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // Term: to.Ptr("P3Y"), - // }, - // SKU: &armbilling.SKUName{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // }, - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // SKUDescription: to.Ptr("Reserved VM Instance, Standard_DS1_v2, US West, 3 Years"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("ManagementGroup"), - // UserFriendlyRenewState: to.Ptr("On"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationGetByBillingAccountSingleResourceGroup.json -func ExampleReservationsClient_GetByReservationOrder_reservationGetByBillingAccountSingleResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationsClient().GetByReservationOrder(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbilling.ReservationsClientGetByReservationOrderOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Reservation = armbilling.Reservation{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/30000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](23), - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeProperties: &armbilling.ReservationAppliedScopeProperties{ - // DisplayName: to.Ptr("fastpathtesting_20210915"), - // ResourceGroupID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009/resourcegroups/fastpathtesting_20210915"), - // }, - // AppliedScopeType: to.Ptr("Single"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-26T01:21:47.293Z"); return t}()), - // ExpiryDate: to.Ptr("2024-11-25"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-26T01:21:47.356Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(true), - // RenewProperties: &armbilling.RenewPropertiesResponse{ - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PurchaseProperties: &armbilling.ReservationPurchaseRequest{ - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationPurchaseRequestProperties{ - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeSingle), - // AppliedScopes: []*string{ - // to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009/resourcegroups/fastpathtesting_20210915")}, - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30_renewed"), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // Quantity: to.Ptr[int32](1), - // Renew: to.Ptr(false), - // ReservedResourceProperties: &armbilling.ReservationPurchaseRequestPropertiesReservedResourceProperties{ - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // Term: to.Ptr("P3Y"), - // }, - // SKU: &armbilling.SKUName{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // }, - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // SKUDescription: to.Ptr("Reserved VM Instance, Standard_DS1_v2, US West, 3 Years"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("ResourceGroup"), - // UserFriendlyRenewState: to.Ptr("On"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationGetByBillingAccountSingleScope.json -func ExampleReservationsClient_GetByReservationOrder_reservationGetByBillingAccountSingleScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationsClient().GetByReservationOrder(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbilling.ReservationsClientGetByReservationOrderOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Reservation = armbilling.Reservation{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/30000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](19), - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeProperties: &armbilling.ReservationAppliedScopeProperties{ - // DisplayName: to.Ptr("Azure subscription 1"), - // SubscriptionID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // }, - // AppliedScopeType: to.Ptr("Single"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-26T01:14:18.558Z"); return t}()), - // ExpiryDate: to.Ptr("2024-11-25"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOff), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-26T01:14:18.605Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(true), - // RenewProperties: &armbilling.RenewPropertiesResponse{ - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PurchaseProperties: &armbilling.ReservationPurchaseRequest{ - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationPurchaseRequestProperties{ - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeSingle), - // AppliedScopes: []*string{ - // to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009")}, - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30_renewed"), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOff), - // Quantity: to.Ptr[int32](1), - // Renew: to.Ptr(false), - // ReservedResourceProperties: &armbilling.ReservationPurchaseRequestPropertiesReservedResourceProperties{ - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOff), - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // Term: to.Ptr("P3Y"), - // }, - // SKU: &armbilling.SKUName{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // }, - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // SKUDescription: to.Ptr("Reserved VM Instance, Standard_DS1_v2, US West, 3 Years"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("Single"), - // UserFriendlyRenewState: to.Ptr("On"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationUpdateByBillingAccount.json -func ExampleReservationsClient_BeginUpdateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReservationsClient().BeginUpdateByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbilling.Patch{ - Properties: &armbilling.PatchProperties{ - DisplayName: to.Ptr("NewName"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Reservation = armbilling.Reservation{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/reservationOrders/20000000-0000-0000-0000-000000000000/reservations/30000000-0000-0000-0000-000000000000"), - // Etag: to.Ptr[int32](15), - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeType: to.Ptr("Shared"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("NewName"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-24T01:46:05.425Z"); return t}()), - // ExpiryDate: to.Ptr("2024-11-25"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-24T01:46:05.534Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(true), - // RenewProperties: &armbilling.RenewPropertiesResponse{ - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](715.68), - // CurrencyCode: to.Ptr("USD"), - // }, - // PurchaseProperties: &armbilling.ReservationPurchaseRequest{ - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationPurchaseRequestProperties{ - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeShared), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/30000000-0000-0000-0000-000000000009"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30_renewed"), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // Quantity: to.Ptr[int32](1), - // Renew: to.Ptr(false), - // ReservedResourceProperties: &armbilling.ReservationPurchaseRequestPropertiesReservedResourceProperties{ - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // Term: to.Ptr("P3Y"), - // }, - // SKU: &armbilling.SKUName{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // }, - // }, - // ReservedResourceType: to.Ptr("VirtualMachines"), - // SKUDescription: to.Ptr("Reserved VM Instance, Standard_DS1_v2, US West, 3 Years"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // UserFriendlyRenewState: to.Ptr("On"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/reservationsGetFromOrderByBillingAccount.json -func ExampleReservationsClient_NewListByReservationOrderPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReservationList = armbilling.ReservationList{ - // Value: []*armbilling.Reservation{ - // { - // Name: to.Ptr("a7d70646-b848-4498-8093-5938128b225c"), - // Type: to.Ptr("microsoft.billing/billingAccounts/reservationOrders/reservations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/4973e1de-a829-5c64-4fef-0a692e2b3108:1970c5da-0aa4-46fd-a917-4772f9a17978_2019-05-31/reservationOrders/99f340d1-6db4-41b4-b469-cfc499716973/reservations/a7d70646-b848-4498-8093-5938128b225c"), - // Etag: to.Ptr[int32](15), - // Location: to.Ptr("westus"), - // Properties: &armbilling.ReservationProperty{ - // AppliedScopeType: to.Ptr("Shared"), - // Archived: to.Ptr(false), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:34:12.926Z"); return t}()), - // BillingPlan: to.Ptr(armbilling.ReservationBillingPlanMonthly), - // BillingScopeID: to.Ptr("/subscriptions/eef82110-c91b-4395-9420-fcfcbefc5a47"), - // DisplayName: to.Ptr("VM_RI_11-24-2021_22-30"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-24T01:46:05.425Z"); return t}()), - // ExpiryDate: to.Ptr("2024-11-25"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-25T06:34:12.926Z"); return t}()), - // InstanceFlexibility: to.Ptr(armbilling.InstanceFlexibilityOn), - // LastUpdatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-24T01:46:05.534Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-11-25"); return t}()), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-11-25T06:31:18.392Z"); return t}()), - // Quantity: to.Ptr[float32](1), - // Renew: to.Ptr(true), - // ReservedResourceType: to.Ptr("VirtualMachines"), - // SKUDescription: to.Ptr("Reserved VM Instance, Standard_DS1_v2, US West, 3 Years"), - // Term: to.Ptr("P3Y"), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // UserFriendlyRenewState: to.Ptr("On"), - // Utilization: &armbilling.ReservationPropertyUtilization{ - // Aggregates: []*armbilling.ReservationUtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.ReservationSKUProperty{ - // Name: to.Ptr("Standard_DS1_v2"), - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/responses.go b/sdk/resourcemanager/billing/armbilling/responses.go index adef3cbcfee4..52637a0c0a3e 100644 --- a/sdk/resourcemanager/billing/armbilling/responses.go +++ b/sdk/resourcemanager/billing/armbilling/responses.go @@ -550,18 +550,6 @@ type ProfilesClientValidateDeleteEligibilityResponse struct { DeleteBillingProfileEligibilityResult } -// PropertyClientGetResponse contains the response from method PropertyClient.Get. -type PropertyClientGetResponse struct { - // A billing property. - Property -} - -// PropertyClientUpdateResponse contains the response from method PropertyClient.Update. -type PropertyClientUpdateResponse struct { - // A billing property. - Property -} - // RecipientTransfersClientAcceptResponse contains the response from method RecipientTransfersClient.Accept. type RecipientTransfersClientAcceptResponse struct { // Details of the transfer. diff --git a/sdk/resourcemanager/billing/armbilling/roleassignments_client.go b/sdk/resourcemanager/billing/armbilling/roleassignments_client.go index 721ca6a6f522..b8e0b43149db 100644 --- a/sdk/resourcemanager/billing/armbilling/roleassignments_client.go +++ b/sdk/resourcemanager/billing/armbilling/roleassignments_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // RoleAssignmentsClient contains the methods for the BillingRoleAssignments group. diff --git a/sdk/resourcemanager/billing/armbilling/roleassignments_client_example_test.go b/sdk/resourcemanager/billing/armbilling/roleassignments_client_example_test.go deleted file mode 100644 index 6f27be7589c8..000000000000 --- a/sdk/resourcemanager/billing/armbilling/roleassignments_client_example_test.go +++ /dev/null @@ -1,1212 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentDeleteByBillingProfile.json -func ExampleRoleAssignmentsClient_DeleteByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentsClient().DeleteByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentGetByBillingProfile.json -func ExampleRoleAssignmentsClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "xxxx-xxxx-xxx-xxx", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("46b831ec-42b2-4f1a-8b54-3fd5ff9d6aa1"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByBillingProfile.json -func ExampleRoleAssignmentsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "xxxx-xxxx-xxx-xxx", &armbilling.RoleAssignmentsClientListByBillingProfileOptions{Filter: nil, - Top: nil, - Skip: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/00000000-0000-0000-0000-000000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateByBillingProfile.json -func ExampleRoleAssignmentsClient_BeginCreateByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("47309529-17e6-4104-b9e8-39f62fa1e5ed"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentDeleteByCustomer.json -func ExampleRoleAssignmentsClient_DeleteByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentsClient().DeleteByCustomer(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", "30000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentGetByCustomer.json -func ExampleRoleAssignmentsClient_GetByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByCustomer(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", "30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleAssignments/30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr(""), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByCustomer.json -func ExampleRoleAssignmentsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListByCustomerPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", &armbilling.RoleAssignmentsClientListByCustomerOptions{Filter: nil, - Top: nil, - Skip: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleAssignments/30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr(""), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleAssignments/30000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr(""), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateByCustomer.json -func ExampleRoleAssignmentsClient_BeginCreateByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateByCustomer(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfileName/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfileName/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleAssignments/30000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("47309529-17e6-4104-b9e8-39f62fa1e5ed"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfileName/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfileName/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/resolveBillingRoleAssignmentByCustomer.json -func ExampleRoleAssignmentsClient_BeginResolveByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginResolveByCustomer(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", &armbilling.RoleAssignmentsClientBeginResolveByCustomerOptions{ResolveScopeDisplayNames: nil, - Filter: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleAssignments/30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalTenantID: to.Ptr("c360d6f1-2709-476d-81bb-d075b213d9fc"), - // PrincipalTenantName: to.Ptr("Foo Bar"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d"), - // UserEmailAddress: to.Ptr("foo@bar.com"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleAssignments/30000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalTenantID: to.Ptr("c360d6f1-2709-476d-81bb-d075b213d9fc"), - // PrincipalTenantName: to.Ptr("Foo Bar"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/customers/703ab484-dda2-4402-827b-a74513b61e2d"), - // UserEmailAddress: to.Ptr("foo@bar.com"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentDeleteByInvoiceSection.json -func ExampleRoleAssignmentsClient_DeleteByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentsClient().DeleteByInvoiceSection(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentGetByInvoiceSection.json -func ExampleRoleAssignmentsClient_GetByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByInvoiceSection(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("46b831ec-42b2-4f1a-8b54-3fd5ff9d6aa1"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByInvoiceSection.json -func ExampleRoleAssignmentsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListByInvoiceSectionPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", &armbilling.RoleAssignmentsClientListByInvoiceSectionOptions{Filter: nil, - Top: nil, - Skip: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000002"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateByInvoiceSection.json -func ExampleRoleAssignmentsClient_BeginCreateByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateByInvoiceSection(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("47309529-17e6-4104-b9e8-39f62fa1e5ed"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/resolveBillingRoleAssignmentByInvoiceSection.json -func ExampleRoleAssignmentsClient_BeginResolveByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginResolveByInvoiceSection(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", &armbilling.RoleAssignmentsClientBeginResolveByInvoiceSectionOptions{ResolveScopeDisplayNames: nil, - Filter: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/resolveBillingRoleAssignmentByBillingProfile.json -func ExampleRoleAssignmentsClient_BeginResolveByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginResolveByBillingProfile(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "xxxx-xxxx-xxx-xxx", &armbilling.RoleAssignmentsClientBeginResolveByBillingProfileOptions{ResolveScopeDisplayNames: nil, - Filter: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/00000000-0000-0000-0000-000000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/xxxx-xxxx-xxx-xxx"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentDeleteByBillingAccount.json -func ExampleRoleAssignmentsClient_DeleteByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentsClient().DeleteByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentGetByBillingAccount.json -func ExampleRoleAssignmentsClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr(""), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateOrUpdateByBillingAccount.json -func ExampleRoleAssignmentsClient_BeginCreateOrUpdateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateOrUpdateByBillingAccount(ctx, "7898901", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", armbilling.RoleAssignment{ - Properties: &armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/billingRoleAssignments/9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("60d97094-2be4-46cc-a4fe-3633021a25b9"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalTenantID: to.Ptr("7ca289b9-c32d-4f01-8566-7ff93261d76f"), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByBillingAccount.json -func ExampleRoleAssignmentsClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", &armbilling.RoleAssignmentsClientListByBillingAccountOptions{Filter: nil, - Top: nil, - Skip: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/00000000-0000-0000-0000-000000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateByBillingAccount.json -func ExampleRoleAssignmentsClient_BeginCreateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("47309529-17e6-4104-b9e8-39f62fa1e5ed"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentDeleteByDepartment.json -func ExampleRoleAssignmentsClient_DeleteByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentsClient().DeleteByDepartment(ctx, "8608480", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentGetByDepartment.json -func ExampleRoleAssignmentsClient_GetByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByDepartment(ctx, "7898901", "225314", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/225314/billingRoleAssignments/9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByUserEmailAddress: to.Ptr("test@billtest900006.onmicrosoft.com"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/225314/billingRoleDefinitions/c15c22c0-9faf-424c-9b7e-bd91c06a240b"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/225314"), - // UserAuthenticationType: to.Ptr("Organization"), - // UserEmailAddress: to.Ptr("a_owner@billtest900006.onmicrosoft.com"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateOrUpdateByDepartment.json -func ExampleRoleAssignmentsClient_BeginCreateOrUpdateByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateOrUpdateByDepartment(ctx, "7898901", "12345", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", armbilling.RoleAssignment{ - Properties: &armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/12345/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/12345/billingRoleAssignments/9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("60d97094-2be4-46cc-a4fe-3633021a25b9"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalTenantID: to.Ptr("7ca289b9-c32d-4f01-8566-7ff93261d76f"), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/12345/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/departments/12345"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByDepartment.json -func ExampleRoleAssignmentsClient_NewListByDepartmentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListByDepartmentPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", "12345", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/departments/12345/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/departments/12345/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/departments/12345"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/departments/12345/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("\"/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/departments/12345/billingRoleDefinitions/00000000-0000-0000-0000-000000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/departments/12345"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentDeleteByEnrollmentAccount.json -func ExampleRoleAssignmentsClient_DeleteByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentsClient().DeleteByEnrollmentAccount(ctx, "8608480", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentGetByEnrollmentAccount.json -func ExampleRoleAssignmentsClient_GetByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByEnrollmentAccount(ctx, "7898901", "225314", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/225314/billingRoleAssignments/9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByUserEmailAddress: to.Ptr("test@billtest900006.onmicrosoft.com"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/225314/billingRoleDefinitions/c15c22c0-9faf-424c-9b7e-bd91c06a240b"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/225314"), - // UserAuthenticationType: to.Ptr("Organization"), - // UserEmailAddress: to.Ptr("a_owner@billtest900006.onmicrosoft.com"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentCreateOrUpdateByEnrollmentAccount.json -func ExampleRoleAssignmentsClient_BeginCreateOrUpdateByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginCreateOrUpdateByEnrollmentAccount(ctx, "7898901", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", armbilling.RoleAssignment{ - Properties: &armbilling.RoleAssignmentProperties{ - PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - PrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/123456/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db"), - UserEmailAddress: to.Ptr("john@contoso.com"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armbilling.RoleAssignment{ - // Name: to.Ptr("9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/123456/billingRoleAssignments/9dfd08c2-62a3-4d47-85bd-1cdba1408402"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("60d97094-2be4-46cc-a4fe-3633021a25b9"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalTenantID: to.Ptr("7ca289b9-c32d-4f01-8566-7ff93261d76f"), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/123456/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/123456"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByEnrollmentAccount.json -func ExampleRoleAssignmentsClient_NewListByEnrollmentAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListByEnrollmentAccountPager("6100092", "123456", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6100092/enrollmentAccounts/123456/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6100092/enrollmentAccounts/123456/billingRoleDefinitions/50000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6100092/enrollmentAccounts/123456"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6100092/enrollmentAccounts/123456/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6100092/enrollmentAccounts/123456/billingRoleDefinitions/50000000-0000-0000-0000-000000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6100092/enrollmentAccounts/123456"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/resolveBillingRoleAssignmentByBillingAccount.json -func ExampleRoleAssignmentsClient_BeginResolveByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewRoleAssignmentsClient().BeginResolveByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", &armbilling.RoleAssignmentsClientBeginResolveByBillingAccountOptions{ResolveScopeDisplayNames: nil, - Filter: 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentListResult = armbilling.RoleAssignmentListResult{ - // Value: []*armbilling.RoleAssignment{ - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/00000000-0000-0000-0000-000000000000"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"), - // }, - // }, - // { - // Name: to.Ptr("10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleAssignments"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47"), - // Properties: &armbilling.RoleAssignmentProperties{ - // CreatedByPrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // CreatedByPrincipalTenantID: to.Ptr("076915e7-de10-4323-bb34-a58c904068bb"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-19T20:10:50.102Z"); return t}()), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PrincipalType: to.Ptr(armbilling.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/00000000-0000-0000-0000-000000000001"), - // Scope: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/roledefinition_client.go b/sdk/resourcemanager/billing/armbilling/roledefinition_client.go index 510d96c9ddfb..b0787f847f0a 100644 --- a/sdk/resourcemanager/billing/armbilling/roledefinition_client.go +++ b/sdk/resourcemanager/billing/armbilling/roledefinition_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleDefinitionClient contains the methods for the BillingRoleDefinition group. diff --git a/sdk/resourcemanager/billing/armbilling/roledefinition_client_example_test.go b/sdk/resourcemanager/billing/armbilling/roledefinition_client_example_test.go deleted file mode 100644 index 494e9026f94b..000000000000 --- a/sdk/resourcemanager/billing/armbilling/roledefinition_client_example_test.go +++ /dev/null @@ -1,986 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionGetByBillingProfile.json -func ExampleRoleDefinitionClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionClient().GetByBillingProfile(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "40000000-aaaa-bbbb-cccc-100000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armbilling.RoleDefinition{ - // Name: to.Ptr("40000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/40000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the billing profile."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013")}, - // }}, - // RoleName: to.Ptr("Billing profile owner"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByBillingProfile.json -func ExampleRoleDefinitionClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionClient().NewListByBillingProfilePager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armbilling.RoleDefinitionListResult{ - // Value: []*armbilling.RoleDefinition{ - // { - // Name: to.Ptr("40000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/40000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the billing profile."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013")}, - // }}, - // RoleName: to.Ptr("Billing profile owner"), - // }, - // }, - // { - // Name: to.Ptr("40000000-aaaa-bbbb-cccc-100000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/40000000-aaaa-bbbb-cccc-100000000001"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Contributor role gives the user all permissions except access management rights to the billing profile."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013")}, - // }}, - // RoleName: to.Ptr("Billing profile contributor"), - // }, - // }, - // { - // Name: to.Ptr("40000000-aaaa-bbbb-cccc-100000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/40000000-aaaa-bbbb-cccc-100000000002"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Reader role gives the user read only access to the billing profile."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012")}, - // }}, - // RoleName: to.Ptr("Billing profile reader"), - // }, - // }, - // { - // Name: to.Ptr("40000000-aaaa-bbbb-cccc-100000000004"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/40000000-aaaa-bbbb-cccc-100000000004"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Invoice Manager role gives the user the ability to view and manage invoices."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013")}, - // }}, - // RoleName: to.Ptr("Invoice manager"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionGetByCustomer.json -func ExampleRoleDefinitionClient_GetByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionClient().GetByCustomer(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "30000000-aaaa-bbbb-cccc-100000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armbilling.RoleDefinition{ - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the customer."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018")}, - // NotActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Customer owner"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByCustomer.json -func ExampleRoleDefinitionClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionClient().NewListByCustomerPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armbilling.RoleDefinitionListResult{ - // Value: []*armbilling.RoleDefinition{ - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the customer."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018")}, - // NotActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Customer owner"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000001"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Contributor role gives the user all permissions except access management rights to the customer."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018")}, - // NotActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Customer contributor"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/customers/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/11111111-1111-1111-1111-111111111111/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000002"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The reader role gives the user read only access to the customer."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017")}, - // NotActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Customer reader"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionGetByInvoiceSection.json -func ExampleRoleDefinitionClient_GetByInvoiceSection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionClient().GetByInvoiceSection(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "30000000-aaaa-bbbb-cccc-100000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armbilling.RoleDefinition{ - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the invoice section."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018")}, - // }}, - // RoleName: to.Ptr("Invoice section owner"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByInvoiceSection.json -func ExampleRoleDefinitionClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionClient().NewListByInvoiceSectionPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armbilling.RoleDefinitionListResult{ - // Value: []*armbilling.RoleDefinition{ - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Owner role gives the user all permissions including access management rights to the invoice section."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018")}, - // }}, - // RoleName: to.Ptr("Invoice section owner"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000001"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Contributor role gives the user all permissions except access management rights to the invoice section."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018")}, - // }}, - // RoleName: to.Ptr("Invoice section contributor"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000002"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The reader role gives the user read only access to the invoice section."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017")}, - // }}, - // RoleName: to.Ptr("Invoice section reader"), - // }, - // }, - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000006"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000006"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Azure subscription creator role gives the user the ability to create an Azure subscription for the invoice section."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013")}, - // }}, - // RoleName: to.Ptr("Azure subscription creator"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionGetByBillingAccount.json -func ExampleRoleDefinitionClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionClient().GetByBillingAccount(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "50000000-aaaa-bbbb-cccc-100000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armbilling.RoleDefinition{ - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016")}, - // }}, - // RoleName: to.Ptr("Billing account owner"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByBillingAccount.json -func ExampleRoleDefinitionClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionClient().NewListByBillingAccountPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armbilling.RoleDefinitionListResult{ - // Value: []*armbilling.RoleDefinition{ - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000000"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016")}, - // }}, - // RoleName: to.Ptr("Billing account owner"), - // }, - // }, - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000001"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Contributor role gives the user all permissions except access management on the organization."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000009"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000018"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000002"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000013"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000011"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000012"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000016")}, - // }}, - // RoleName: to.Ptr("Billing account contributor"), - // }, - // }, - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000002"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Reader role gives the user read permissions to an organization."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012")}, - // }}, - // RoleName: to.Ptr("Billing account reader"), - // }, - // }, - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000002"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Reader role gives the user read permissions to an organization."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000003"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000005"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000004"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000010"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000015"), - // to.Ptr("30000000-aaaa-bbbb-cccc-200000000017"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000008"), - // to.Ptr("40000000-aaaa-bbbb-cccc-200000000012")}, - // }}, - // RoleName: to.Ptr("Billing account reader"), - // }, - // }, - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000003"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000003"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The Purchaser role gives the user permissions to make purchases by creating new Projects and Billing Groups in an organization."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000006"), - // to.Ptr("10000000-aaaa-bbbb-cccc-200000000007"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000001"), - // to.Ptr("50000000-aaaa-bbbb-cccc-200000000006")}, - // }}, - // RoleName: to.Ptr("Basic Purchaser"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionGetByDepartment.json -func ExampleRoleDefinitionClient_GetByDepartment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionClient().GetByDepartment(ctx, "123456", "7368531", "50000000-aaaa-bbbb-cccc-100000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armbilling.RoleDefinition{ - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/departments/7368531/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/departments/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/action"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/delete"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/action"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/delete")}, - // }}, - // RoleName: to.Ptr("Department Admin"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByDepartment.json -func ExampleRoleDefinitionClient_NewListByDepartmentPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionClient().NewListByDepartmentPager("123456", "7368531", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armbilling.RoleDefinitionListResult{ - // Value: []*armbilling.RoleDefinition{ - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/departments/7368531/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/departments/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/action"), - // to.Ptr("Microsoft.Billing/billingAccounts/departments/delete"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/action"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/delete"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/read")}, - // }}, - // RoleName: to.Ptr("Department Admin"), - // }, - // }, - // { - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/departments/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/departments/7368531/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000001"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/departments/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/read")}, - // }}, - // RoleName: to.Ptr("Department Reader"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionGetByEnrollmentAccount.json -func ExampleRoleDefinitionClient_GetByEnrollmentAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionClient().GetByEnrollmentAccount(ctx, "123456", "4568789", "50000000-aaaa-bbbb-cccc-100000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armbilling.RoleDefinition{ - // Name: to.Ptr("50000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/enrollmentAccounts/4568789/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/action"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/delete"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/action")}, - // }}, - // RoleName: to.Ptr("Account Owner"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByEnrollmentAccount.json -func ExampleRoleDefinitionClient_NewListByEnrollmentAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionClient().NewListByEnrollmentAccountPager("123456", "4568789", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armbilling.RoleDefinitionListResult{ - // Value: []*armbilling.RoleDefinition{ - // { - // Name: to.Ptr("30000000-aaaa-bbbb-cccc-100000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingRoleDefinitions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/enrollmentAccounts/4568789/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000"), - // Properties: &armbilling.RoleDefinitionProperties{ - // Description: to.Ptr("The account owner role gives the user all permissions including access management rights to an accounts."), - // Permissions: []*armbilling.Permission{ - // { - // Actions: []*string{ - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/action"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/delete"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/read"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/write"), - // to.Ptr("Microsoft.Billing/billingAccounts/enrollmentAccounts/billingSubscriptions/action")}, - // NotActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Account Owner"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/savingsplanorders_client.go b/sdk/resourcemanager/billing/armbilling/savingsplanorders_client.go index c0595a028a08..60e641b6d37c 100644 --- a/sdk/resourcemanager/billing/armbilling/savingsplanorders_client.go +++ b/sdk/resourcemanager/billing/armbilling/savingsplanorders_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // SavingsPlanOrdersClient contains the methods for the SavingsPlanOrders group. diff --git a/sdk/resourcemanager/billing/armbilling/savingsplanorders_client_example_test.go b/sdk/resourcemanager/billing/armbilling/savingsplanorders_client_example_test.go deleted file mode 100644 index da89cd4117be..000000000000 --- a/sdk/resourcemanager/billing/armbilling/savingsplanorders_client_example_test.go +++ /dev/null @@ -1,495 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanOrderGetByBillingAccount.json -func ExampleSavingsPlanOrdersClient_GetByBillingAccount_savingsPlanOrderGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSavingsPlanOrdersClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", &armbilling.SavingsPlanOrdersClientGetByBillingAccountOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SavingsPlanOrderModel = armbilling.SavingsPlanOrderModel{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanOrderModelProperties{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-20T02:36:22.339Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("10000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("SP1"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-01-20T02:36:22.339Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // SavingsPlans: []*string{ - // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000")}, - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanOrderExpandedScheduleGetByBillingAccount.json -func ExampleSavingsPlanOrdersClient_GetByBillingAccount_savingsPlanOrderWithExpandedPaymentsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSavingsPlanOrdersClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", &armbilling.SavingsPlanOrdersClientGetByBillingAccountOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SavingsPlanOrderModel = armbilling.SavingsPlanOrderModel{ - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanOrderModelProperties{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-20T02:36:22.339Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("10000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("SP1"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-01-20T02:36:22.339Z"); return t}()), - // PlanInformation: &armbilling.PlanInformation{ - // NextPaymentDueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-02-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](26.28), - // CurrencyCode: to.Ptr("USD"), - // }, - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-20"); return t}()), - // Transactions: []*armbilling.PaymentDetail{ - // { - // BillingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-20"); return t}()), - // PaymentDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-01-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusCompleted), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-02-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-03-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-04-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-05-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-07-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-08-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-09-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-10-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-11-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-12-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-01-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-02-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-03-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-04-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-05-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-06-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-07-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-08-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-09-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-10-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-11-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2024-12-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-01-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-02-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-03-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-04-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-05-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-06-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-07-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-08-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-09-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-10-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-11-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }, - // { - // DueDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2025-12-20"); return t}()), - // PricingCurrencyTotal: &armbilling.Price{ - // Amount: to.Ptr[float64](0.73), - // CurrencyCode: to.Ptr("USD"), - // }, - // Status: to.Ptr(armbilling.PaymentStatusScheduled), - // }}, - // }, - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // SavingsPlans: []*string{ - // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000")}, - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanOrderListByBillingAccount.json -func ExampleSavingsPlanOrdersClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSavingsPlanOrdersClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.SavingsPlanOrdersClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SavingsPlanOrderModelList = armbilling.SavingsPlanOrderModelList{ - // Value: []*armbilling.SavingsPlanOrderModel{ - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanOrderModelProperties{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-04T03:18:31.307Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("10000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("SP1"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-02-04T03:18:31.307Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // SavingsPlans: []*string{ - // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000")}, - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }, - // { - // Name: to.Ptr("20000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000001"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanOrderModelProperties{ - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-04T03:22:19.730Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("10000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("SP2"), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-02-04T03:22:19.730Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr("Succeeded"), - // SavingsPlans: []*string{ - // to.Ptr("/providers/Microsoft.BillingBenefits/savingsPlanOrders/20000000-0000-0000-0000-000000000001/savingsPlans/30000000-0000-0000-0000-000000000001")}, - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/savingsplans_client.go b/sdk/resourcemanager/billing/armbilling/savingsplans_client.go index 556a45de9be2..45f5a9a62977 100644 --- a/sdk/resourcemanager/billing/armbilling/savingsplans_client.go +++ b/sdk/resourcemanager/billing/armbilling/savingsplans_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // SavingsPlansClient contains the methods for the SavingsPlans group. diff --git a/sdk/resourcemanager/billing/armbilling/savingsplans_client_example_test.go b/sdk/resourcemanager/billing/armbilling/savingsplans_client_example_test.go deleted file mode 100644 index 8897f7768b5a..000000000000 --- a/sdk/resourcemanager/billing/armbilling/savingsplans_client_example_test.go +++ /dev/null @@ -1,707 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlansListBySavingsPlanOrders.json -func ExampleSavingsPlansClient_NewListBySavingsPlanOrderPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSavingsPlansClient().NewListBySavingsPlanOrderPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SavingsPlanModelList = armbilling.SavingsPlanModelList{ - // Value: []*armbilling.SavingsPlanModel{ - // { - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeShared), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-20T02:36:22.339Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.001), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP1"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-20T02:36:25.089Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-01-20T02:36:22.339Z"); return t}()), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-20T02:34:38.126Z"); return t}()), - // Renew: to.Ptr(false), - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlansListByBillingAccount.json -func ExampleSavingsPlansClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSavingsPlansClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.SavingsPlansClientListByBillingAccountOptions{Filter: nil, - OrderBy: nil, - Skiptoken: nil, - Take: to.Ptr[float32](3), - SelectedState: to.Ptr("Succeeded"), - RefreshSummary: to.Ptr("true"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SavingsPlanModelListResult = armbilling.SavingsPlanModelListResult{ - // Value: []*armbilling.SavingsPlanModel{ - // { - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeShared), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T02:17:03.739Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](10), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP1"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T02:17:04.989Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-16T02:17:03.739Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T02:14:58.230Z"); return t}()), - // Renew: to.Ptr(false), - // Term: to.Ptr(armbilling.SavingsPlanTermP1Y), - // UserFriendlyAppliedScopeType: to.Ptr("Shared"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }, - // { - // Name: to.Ptr("30000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000001/savingsPlans/30000000-0000-0000-0000-000000000001"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // DisplayName: to.Ptr("TestRg"), - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestRg"), - // TenantID: to.Ptr("50000000-0000-0000-0000-000000000000"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T02:22:22.725Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](10), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP2"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T02:22:24.553Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-16T02:22:22.725Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T02:20:23.473Z"); return t}()), - // Renew: to.Ptr(false), - // Term: to.Ptr(armbilling.SavingsPlanTermP1Y), - // UserFriendlyAppliedScopeType: to.Ptr("ManagementGroup"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }, - // { - // Name: to.Ptr("30000000-0000-0000-0000-000000000002"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000002/savingsPlans/30000000-0000-0000-0000-000000000002"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // DisplayName: to.Ptr("Azure subscription 1"), - // SubscriptionID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeSingle), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-14T21:18:55.296Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/10000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.025), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP3"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T23:54:43.823Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-10-14T21:18:55.296Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-14T21:16:57.234Z"); return t}()), - // Renew: to.Ptr(true), - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // UserFriendlyAppliedScopeType: to.Ptr("Single"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](66), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](66), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](65.52), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }, - // { - // Name: to.Ptr("30000000-0000-0000-0000-000000000003"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000003/savingsPlans/30000000-0000-0000-0000-000000000003"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // DisplayName: to.Ptr("testRG"), - // ResourceGroupID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourcegroups/testRG"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeSingle), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-08T00:00:06.363Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.001), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP4"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-30T21:18:12.196Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-11-08T00:00:06.363Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T23:57:58.242Z"); return t}()), - // Renew: to.Ptr(false), - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // UserFriendlyAppliedScopeType: to.Ptr("ResourceGroup"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](100), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](100), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](100), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }}, - // Summary: &armbilling.SavingsPlanSummaryCount{ - // CancelledCount: to.Ptr[float32](0), - // ExpiredCount: to.Ptr[float32](0), - // ExpiringCount: to.Ptr[float32](0), - // FailedCount: to.Ptr[float32](0), - // NoBenefitCount: to.Ptr[float32](0), - // PendingCount: to.Ptr[float32](0), - // ProcessingCount: to.Ptr[float32](0), - // SucceededCount: to.Ptr[float32](3), - // WarningCount: to.Ptr[float32](0), - // }, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanGetByBillingAccount.json -func ExampleSavingsPlansClient_GetByBillingAccount_savingsPlanGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSavingsPlansClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbilling.SavingsPlansClientGetByBillingAccountOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SavingsPlanModel = armbilling.SavingsPlanModel{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // DisplayName: to.Ptr("TestRg"), - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestRg"), - // TenantID: to.Ptr("70000000-0000-0000-0000-000000000000"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T02:25:11.718Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/50000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.001), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP1"), - // DisplayProvisioningState: to.Ptr("NoBenefit"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T01:35:36.290Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-11-16T02:25:11.718Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T02:23:21.386Z"); return t}()), - // Renew: to.Ptr(false), - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // UserFriendlyAppliedScopeType: to.Ptr("ManagementGroup"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanGetExpandRenewPropertiesByBillingAccount.json -func ExampleSavingsPlansClient_GetByBillingAccount_savingsPlanGetExpandRenewProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSavingsPlansClient().GetByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", &armbilling.SavingsPlansClientGetByBillingAccountOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SavingsPlanModel = armbilling.SavingsPlanModel{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // DisplayName: to.Ptr("TestRg"), - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestRg"), - // TenantID: to.Ptr("70000000-0000-0000-0000-000000000000"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T02:25:11.718Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/50000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.001), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP1"), - // DisplayProvisioningState: to.Ptr("NoBenefit"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-16T01:35:36.290Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-11-16T02:25:11.718Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T02:23:21.386Z"); return t}()), - // Renew: to.Ptr(false), - // RenewProperties: &armbilling.RenewProperties{ - // PurchaseProperties: &armbilling.PurchaseRequest{ - // Properties: &armbilling.PurchaseRequestProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/TestRg"), - // TenantID: to.Ptr("70000000-0000-0000-0000-000000000000"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - // BillingPlan: to.Ptr(armbilling.BillingPlan("Monthly")), - // BillingScopeID: to.Ptr("/subscriptions/50000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.001), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("SP1_renewed"), - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // }, - // }, - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // UserFriendlyAppliedScopeType: to.Ptr("ManagementGroup"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // { - // Grain: to.Ptr[float32](1), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](7), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }, - // { - // Grain: to.Ptr[float32](30), - // GrainUnit: to.Ptr("days"), - // Value: to.Ptr[float32](0), - // ValueUnit: to.Ptr("percentage"), - // }}, - // Trend: to.Ptr("SAME"), - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanUpdateByBillingAccount.json -func ExampleSavingsPlansClient_BeginUpdateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSavingsPlansClient().BeginUpdateByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbilling.SavingsPlanUpdateRequest{ - Properties: &armbilling.SavingsPlanUpdateRequestProperties{ - AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/mg1"), - TenantID: to.Ptr("80000000-0000-0000-0000-000000000000"), - }, - AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - DisplayName: to.Ptr("sp_newName"), - Renew: to.Ptr(true), - RenewProperties: &armbilling.RenewProperties{ - PurchaseProperties: &armbilling.PurchaseRequest{ - Properties: &armbilling.PurchaseRequestProperties{ - AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/mg1"), - TenantID: to.Ptr("80000000-0000-0000-0000-000000000000"), - }, - AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - BillingScopeID: to.Ptr("/subscriptions/50000000-0000-0000-0000-000000000000"), - Commitment: &armbilling.Commitment{ - Amount: to.Ptr[float64](0.001), - CurrencyCode: to.Ptr("USD"), - Grain: to.Ptr(armbilling.CommitmentGrainHourly), - }, - DisplayName: to.Ptr("sp_newName_renewed"), - Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - }, - SKU: &armbilling.SKU{ - Name: to.Ptr("Compute_Savings_Plan"), - }, - }, - }, - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SavingsPlanModel = armbilling.SavingsPlanModel{ - // Name: to.Ptr("30000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("microsoft.billing/billingAccounts/savingsPlanOrders/savingsPlans"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/savingsPlanOrders/20000000-0000-0000-0000-000000000000/savingsPlans/30000000-0000-0000-0000-000000000000"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armbilling.SavingsPlanModelProperties{ - // AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - // DisplayName: to.Ptr("mg1"), - // ManagementGroupID: to.Ptr("/providers/Microsoft.Management/managementGroups/mg1"), - // TenantID: to.Ptr("80000000-0000-0000-0000-000000000000"), - // }, - // AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeManagementGroup), - // BenefitStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-04T03:18:31.307Z"); return t}()), - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"), - // BillingPlan: to.Ptr(armbilling.BillingPlanP1M), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/AAAA-BBBB-CCC-DDD"), - // BillingScopeID: to.Ptr("/subscriptions/50000000-0000-0000-0000-000000000000"), - // Commitment: &armbilling.Commitment{ - // Amount: to.Ptr[float64](0.001), - // CurrencyCode: to.Ptr("USD"), - // Grain: to.Ptr(armbilling.CommitmentGrainHourly), - // }, - // DisplayName: to.Ptr("sp_newName"), - // DisplayProvisioningState: to.Ptr("Succeeded"), - // EffectiveDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-04T04:30:49.198Z"); return t}()), - // ExpiryDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-02-04T03:18:31.307Z"); return t}()), - // ProductCode: to.Ptr("20000000-0000-0000-0000-000000000005"), - // ProvisioningState: to.Ptr(armbilling.ProvisioningStateSucceeded), - // PurchaseDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-04T03:16:38.906Z"); return t}()), - // Renew: to.Ptr(true), - // Term: to.Ptr(armbilling.SavingsPlanTermP3Y), - // UserFriendlyAppliedScopeType: to.Ptr("ManagementGroup"), - // Utilization: &armbilling.Utilization{ - // Aggregates: []*armbilling.UtilizationAggregates{ - // }, - // }, - // }, - // SKU: &armbilling.SKU{ - // Name: to.Ptr("Compute_Savings_Plan"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/savingsPlanValidateUpdateByBillingAccount.json -func ExampleSavingsPlansClient_ValidateUpdateByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSavingsPlansClient().ValidateUpdateByBillingAccount(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", armbilling.SavingsPlanUpdateValidateRequest{ - Benefits: []*armbilling.SavingsPlanUpdateRequestProperties{ - { - AppliedScopeProperties: &armbilling.AppliedScopeProperties{ - SubscriptionID: to.Ptr("/subscriptions/50000000-0000-0000-0000-000000000000"), - }, - AppliedScopeType: to.Ptr(armbilling.AppliedScopeTypeSingle), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SavingsPlanValidateResponse = armbilling.SavingsPlanValidateResponse{ - // Benefits: []*armbilling.SavingsPlanValidResponseProperty{ - // { - // Valid: to.Ptr(true), - // }}, - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/subscriptions_client.go b/sdk/resourcemanager/billing/armbilling/subscriptions_client.go index 1672dfb78ded..cf65e9368884 100644 --- a/sdk/resourcemanager/billing/armbilling/subscriptions_client.go +++ b/sdk/resourcemanager/billing/armbilling/subscriptions_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // SubscriptionsClient contains the methods for the BillingSubscriptions group. diff --git a/sdk/resourcemanager/billing/armbilling/subscriptions_client_example_test.go b/sdk/resourcemanager/billing/armbilling/subscriptions_client_example_test.go deleted file mode 100644 index e45814f6e8d1..000000000000 --- a/sdk/resourcemanager/billing/armbilling/subscriptions_client_example_test.go +++ /dev/null @@ -1,1106 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionGetByBillingProfile.json -func ExampleSubscriptionsClient_GetByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionsClient().GetByBillingProfile(ctx, "pcn.94077792", "6478903", "6b96d3f2-9008-4a9d-912f-f87744185aa3", &armbilling.SubscriptionsClientGetByBillingProfileOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armbilling.Subscription{ - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/pcn.94077792/billingProfiles/6478903/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/pcn.94077792/billingProfiles/6478903"), - // BillingProfileName: to.Ptr("47268432"), - // DisplayName: to.Ptr("My Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/6564892/billingProfiles/11000000-0000-0000-0000-000000000000/invoiceSections/22000000-0000-0000-0000-000000000000"), - // ProvisioningTenantID: to.Ptr("7d62dbd1-1348-4496-b2f8-df6948c103ee"), - // Quantity: to.Ptr[int64](50), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // SystemOverrides: &armbilling.SystemOverrides{ - // Cancellation: to.Ptr(armbilling.CancellationAllowed), - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsListByBillingProfileEA.json -func ExampleSubscriptionsClient_NewListByBillingProfilePager_billingSubscriptionsListByBillingProfileEa() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByBillingProfilePager("pcn.94077792", "6478903", &armbilling.SubscriptionsClientListByBillingProfileOptions{IncludeDeleted: nil, - Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/pcn.94077792/billingProfiles/6478903/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/pcn.94077792/billingProfiles/6478903"), - // BillingProfileName: to.Ptr("47268432"), - // DisplayName: to.Ptr("My Subscription"), - // EnrollmentAccountDisplayName: to.Ptr("billtest332211@outlook.com"), - // EnrollmentAccountID: to.Ptr("172988"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsListByBillingProfileMCA.json -func ExampleSubscriptionsClient_NewListByBillingProfilePager_billingSubscriptionsListByBillingProfileMca() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByBillingProfilePager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "ea36e548-1505-41db-bebc-46fff3d37998", &armbilling.SubscriptionsClientListByBillingProfileOptions{IncludeDeleted: nil, - Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("My Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Test Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // }, - // }, - // { - // Name: to.Ptr("90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/90D31600-D46D-4084-84C6-1235CDAFFB56"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("90D31600-D46D-4084-84C6-1235CDAFFB56"), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Test Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/22000000-0000-0000-0000-000000000000"), - // ResourceURI: to.Ptr("/providers/Microsoft.Domain/domainSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByCustomerPager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", &armbilling.SubscriptionsClientListByCustomerOptions{IncludeDeleted: nil, - Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // BillingProfileName: to.Ptr("ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("My Subscription"), - // Reseller: &armbilling.Reseller{ - // Description: to.Ptr("Reseller1"), - // ResellerID: to.Ptr("89e87bdf-a2a2-4687-925f-4c18b27bccfd"), - // }, - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // SKUDescription: to.Ptr("Microsoft Azure Standard"), - // SKUID: to.Ptr("0002"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // BillingProfileName: to.Ptr("ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("Test Subscription"), - // Reseller: &armbilling.Reseller{ - // Description: to.Ptr("Reseller3"), - // ResellerID: to.Ptr("3b65b5a8-bd4f-4084-90e9-e1bd667a2b19"), - // }, - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // SKUDescription: to.Ptr("Microsoft Azure Standard"), - // SKUID: to.Ptr("0002"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // BillingProfileName: to.Ptr("ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("Dev Test Subscription"), - // ResourceURI: to.Ptr("/providers/Microsoft.Domain/domainSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByInvoiceSectionPager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", &armbilling.SubscriptionsClientListByInvoiceSectionOptions{IncludeDeleted: nil, - Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("My Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Test Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // }, - // }, - // { - // Name: to.Ptr("90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/90D31600-D46D-4084-84C6-1235CDAFFB56"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/90D31600-D46D-4084-84C6-1235CDAFFB56"), - // SKUDescription: to.Ptr("Microsoft Azure Dev/Test"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("90D31600-D46D-4084-84C6-1235CDAFFB56"), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // DisplayName: to.Ptr("Dev Test Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // ResourceURI: to.Ptr("/providers/Microsoft.Domain/domainSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsCancel.json -func ExampleSubscriptionsClient_BeginCancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsClient().BeginCancel(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.CancelSubscriptionRequest{ - CancellationReason: to.Ptr(armbilling.CancellationReasonCompromise), - CustomerID: to.Ptr("11111111-1111-1111-1111-111111111111"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsMerge.json -func ExampleSubscriptionsClient_BeginMerge() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsClient().BeginMerge(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.SubscriptionMergeRequest{ - Quantity: to.Ptr[int32](1), - TargetBillingSubscriptionName: to.Ptr("22222222-2222-2222-2222-222222222222"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armbilling.Subscription{ - // Name: to.Ptr("22222222-2222-2222-2222-222222222222"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/22222222-2222-2222-2222-222222222222"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Billing Subscription Display Name"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](2), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionMove.json -func ExampleSubscriptionsClient_BeginMove() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsClient().BeginMove(ctx, "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "6b96d3f2-9008-4a9d-912f-f87744185aa3", armbilling.MoveBillingSubscriptionRequest{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armbilling.Subscription{ - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("Contoso operations billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // ConsumptionCostCenter: to.Ptr("ABC1234"), - // DisplayName: to.Ptr("My Subscription"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - // SKUDescription: to.Ptr("Microsoft Azure Plan"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsSplit.json -func ExampleSubscriptionsClient_BeginSplit() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsClient().BeginSplit(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.SubscriptionSplitRequest{ - BillingFrequency: to.Ptr("P1M"), - Quantity: to.Ptr[int32](1), - TargetProductTypeID: to.Ptr("XYZ56789"), - TargetSKUID: to.Ptr("0001"), - TermDuration: to.Ptr("P1M"), - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armbilling.Subscription{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/11111111-1111-1111-1111-111111111111"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Billing Subscription Display Name"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionValidateMoveFailure.json -func ExampleSubscriptionsClient_ValidateMoveEligibility_billingSubscriptionValidateMoveFailure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionsClient().ValidateMoveEligibility(ctx, "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "6b96d3f2-9008-4a9d-912f-f87744185aa3", armbilling.MoveBillingSubscriptionRequest{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MoveBillingSubscriptionEligibilityResult = armbilling.MoveBillingSubscriptionEligibilityResult{ - // ErrorDetails: &armbilling.MoveBillingSubscriptionErrorDetails{ - // Code: to.Ptr(armbilling.SubscriptionTransferValidationErrorCodeSubscriptionNotActive), - // Message: to.Ptr("Invoice Sections can only be changed for active subscriptions."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionValidateMoveSuccess.json -func ExampleSubscriptionsClient_ValidateMoveEligibility_billingSubscriptionValidateMoveSuccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionsClient().ValidateMoveEligibility(ctx, "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "6b96d3f2-9008-4a9d-912f-f87744185aa3", armbilling.MoveBillingSubscriptionRequest{ - DestinationInvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MoveBillingSubscriptionEligibilityResult = armbilling.MoveBillingSubscriptionEligibilityResult{ - // IsMoveEligible: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsDelete.json -func ExampleSubscriptionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsClient().BeginDelete(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsGet.json -func ExampleSubscriptionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionsClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", &armbilling.SubscriptionsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armbilling.Subscription{ - // Name: to.Ptr("90000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000000"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("My subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000000"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsUpdate.json -func ExampleSubscriptionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsClient().BeginUpdate(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", armbilling.SubscriptionPatch{ - Properties: &armbilling.SubscriptionProperties{ - ConsumptionCostCenter: to.Ptr("ABC1234"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Subscription = armbilling.Subscription{ - // Name: to.Ptr("11111111-1111-1111-1111-111111111111"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/11111111-1111-1111-1111-111111111111"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Billing Subscription Display Name"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.SubscriptionsClientListByBillingAccountOptions{IncludeDeleted: to.Ptr(false), - IncludeTenantSubscriptions: to.Ptr(false), - IncludeFailed: nil, - Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000000"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("My subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000000"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000001"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-06T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-07T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Test subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("Software"), - // ProductType: to.Ptr("Software Product Type"), - // ProductTypeID: to.Ptr("EFG456"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-06T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000001"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-07T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-07T22:39:34.260Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptions/90000000-0000-0000-0000-000000000002"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Dev subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("ReservationOrder"), - // ProductType: to.Ptr("Reservation Product Type"), - // ProductTypeID: to.Ptr("JKL789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/90000000-0000-0000-0000-000000000002"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusSuspended), - // SuspensionReasonDetails: []*armbilling.SubscriptionStatusDetails{ - // { - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-15T22:39:34.260Z"); return t}()), - // Reason: to.Ptr(armbilling.SubscriptionStatusReasonCancelled), - // }}, - // SuspensionReasons: []*string{ - // to.Ptr("Cancelled")}, - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsListByCustomerAtBillingAccount.json -func ExampleSubscriptionsClient_NewListByCustomerAtBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByCustomerAtBillingAccountPager("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", "Q7GV-UUVA-PJA-TGB", &armbilling.SubscriptionsClientListByCustomerAtBillingAccountOptions{IncludeDeleted: nil, - Expand: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // BillingProfileName: to.Ptr("ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("My Subscription"), - // Reseller: &armbilling.Reseller{ - // Description: to.Ptr("Reseller1"), - // ResellerID: to.Ptr("89e87bdf-a2a2-4687-925f-4c18b27bccfd"), - // }, - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // SKUDescription: to.Ptr("Microsoft Azure Standard"), - // SKUID: to.Ptr("0002"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("6b96d3f2-9008-4a9d-912f-f87744185aa3"), - // }, - // }, - // { - // Name: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // BillingProfileName: to.Ptr("ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("Test Subscription"), - // Reseller: &armbilling.Reseller{ - // Description: to.Ptr("Reseller3"), - // ResellerID: to.Ptr("3b65b5a8-bd4f-4084-90e9-e1bd667a2b19"), - // }, - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // SKUDescription: to.Ptr("Microsoft Azure Standard"), - // SKUID: to.Ptr("0002"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("CD0BBD7A-461A-4D9A-9C59-EAE51A0D5D12"), - // }, - // }, - // { - // Name: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // Properties: &armbilling.SubscriptionProperties{ - // BillingProfileDisplayName: to.Ptr("BillingProfile1"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998"), - // BillingProfileName: to.Ptr("ea36e548-1505-41db-bebc-46fff3d37998"), - // CustomerDisplayName: to.Ptr("Customer1"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/customers/Q7GV-UUVA-PJA-TGB"), - // DisplayName: to.Ptr("Dev Test Subscription"), - // ResourceURI: to.Ptr("/providers/Microsoft.Domain/domainSubscriptions/9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // SKUDescription: to.Ptr("Domain Name Registration ORG"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SubscriptionID: to.Ptr("9e90f86b-22fc-42f3-bfe2-0ac3e7c01d32"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsListByEnrollmentAccount.json -func ExampleSubscriptionsClient_NewListByEnrollmentAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsClient().NewListByEnrollmentAccountPager("6564892", "172988", &armbilling.SubscriptionsClientListByEnrollmentAccountOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionListResult = armbilling.SubscriptionListResult{ - // Value: []*armbilling.Subscription{ - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/6564892/billingSubscriptions/90000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.SubscriptionProperties{ - // ConsumptionCostCenter: to.Ptr("123"), - // DisplayName: to.Ptr("TestSubscription"), - // EnrollmentAccountDisplayName: to.Ptr("billtest332211@outlook.com"), - // EnrollmentAccountID: to.Ptr("172988"), - // EnrollmentAccountSubscriptionDetails: &armbilling.EnrollmentAccountSubscriptionDetails{ - // EnrollmentAccountStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T00:00:00.000Z"); return t}()), - // }, - // SubscriptionID: to.Ptr("90000000-0000-0000-0000-000000000000"), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/6564892/billingSubscriptions/90000000-0000-0000-0000-000000000001"), - // Properties: &armbilling.SubscriptionProperties{ - // ConsumptionCostCenter: to.Ptr(""), - // DisplayName: to.Ptr("Microsoft Azure Enterprise-1"), - // EnrollmentAccountDisplayName: to.Ptr("billtest332211@outlook.com"), - // EnrollmentAccountID: to.Ptr("172988"), - // EnrollmentAccountSubscriptionDetails: &armbilling.EnrollmentAccountSubscriptionDetails{ - // EnrollmentAccountStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T00:00:00.000Z"); return t}()), - // SubscriptionEnrollmentAccountStatus: to.Ptr(armbilling.SubscriptionEnrollmentAccountStatusDeleted), - // }, - // SubscriptionID: to.Ptr("90000000-0000-0000-0000-000000000001"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client.go b/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client.go index e815c0f17923..1f4aad9f2adb 100644 --- a/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client.go +++ b/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client.go @@ -11,15 +11,14 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // SubscriptionsAliasesClient contains the methods for the BillingSubscriptionsAliases group. diff --git a/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client_example_test.go b/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client_example_test.go deleted file mode 100644 index 566ca7b56a4f..000000000000 --- a/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client_example_test.go +++ /dev/null @@ -1,286 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasGet.json -func ExampleSubscriptionsAliasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSubscriptionsAliasesClient().Get(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "c356b7c7-7545-4686-b843-c1a49cf853fc", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionAlias = armbilling.SubscriptionAlias{ - // Name: to.Ptr("c356b7c7-7545-4686-b843-c1a49cf853fc"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptionAliases"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/c356b7c7-7545-4686-b843-c1a49cf853fc"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionAliasProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Billing Subscription Display Name"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // BillingSubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasCreateOrUpdate.json -func ExampleSubscriptionsAliasesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSubscriptionsAliasesClient().BeginCreateOrUpdate(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "c356b7c7-7545-4686-b843-c1a49cf853fc", armbilling.SubscriptionAlias{ - Properties: &armbilling.SubscriptionAliasProperties{ - BillingFrequency: to.Ptr("P1M"), - DisplayName: to.Ptr("Subscription 3"), - Quantity: to.Ptr[int64](1), - SKUID: to.Ptr("0001"), - TermDuration: to.Ptr("P1M"), - }, - }, 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SubscriptionAlias = armbilling.SubscriptionAlias{ - // Name: to.Ptr("c356b7c7-7545-4686-b843-c1a49cf853fc"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptionAliases"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/c356b7c7-7545-4686-b843-c1a49cf853fc"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionAliasProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Billing Subscription Display Name"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // BillingSubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasList.json -func ExampleSubscriptionsAliasesClient_NewListByBillingAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSubscriptionsAliasesClient().NewListByBillingAccountPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", &armbilling.SubscriptionsAliasesClientListByBillingAccountOptions{IncludeDeleted: nil, - Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SubscriptionAliasListResult = armbilling.SubscriptionAliasListResult{ - // Value: []*armbilling.SubscriptionAlias{ - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptionAliases"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/90000000-0000-0000-0000-000000000000"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionAliasProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("My subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("SeatBased"), - // ProductType: to.Ptr("Seat-Based Product Type"), - // ProductTypeID: to.Ptr("XYZ56789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-04T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/11111111-1111-1111-1111-111111111111"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // BillingSubscriptionID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000001"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptionAliases"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/90000000-0000-0000-0000-000000000001"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-06T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-07T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionAliasProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Test subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("Software"), - // ProductType: to.Ptr("Software Product Type"), - // ProductTypeID: to.Ptr("EFG456"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-06T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/22222222-2222-2222-2222-222222222222"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusActive), - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-07T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-07T22:39:34.260Z"); return t}()), - // BillingSubscriptionID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // }, - // }, - // { - // Name: to.Ptr("90000000-0000-0000-0000-000000000002"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingSubscriptionAliases"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingSubscriptionAliases/90000000-0000-0000-0000-000000000002"), - // SystemData: &armbilling.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-25T22:39:34.260Z"); return t}()), - // }, - // Properties: &armbilling.SubscriptionAliasProperties{ - // AutoRenew: to.Ptr(armbilling.AutoRenewOn), - // BillingProfileDisplayName: to.Ptr("Billing Profile Display Name"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // BillingProfileName: to.Ptr("xxxx-xxxx-xxx-xxx"), - // DisplayName: to.Ptr("Dev subscription"), - // InvoiceSectionDisplayName: to.Ptr("Invoice Section Display Name"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy"), - // InvoiceSectionName: to.Ptr("yyyy-yyyy-yyy-yyy"), - // ProductCategory: to.Ptr("ReservationOrder"), - // ProductType: to.Ptr("Reservation Product Type"), - // ProductTypeID: to.Ptr("JKL789"), - // PurchaseDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // Quantity: to.Ptr[int64](1), - // ResourceURI: to.Ptr("/providers/Microsoft.Capacity/reservationOrders/33333333-3333-3333-3333-333333333333"), - // SKUDescription: to.Ptr("SKU Description"), - // SKUID: to.Ptr("0001"), - // Status: to.Ptr(armbilling.BillingSubscriptionStatusSuspended), - // SuspensionReasonDetails: []*armbilling.SubscriptionStatusDetails{ - // { - // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-15T22:39:34.260Z"); return t}()), - // Reason: to.Ptr(armbilling.SubscriptionStatusReasonCancelled), - // }}, - // SuspensionReasons: []*string{ - // to.Ptr("Cancelled")}, - // SystemOverrides: &armbilling.SystemOverrides{ - // CancellationAllowedEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-01T22:39:34.260Z"); return t}()), - // }, - // TermDuration: to.Ptr("P1M"), - // TermEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-05T22:39:34.260Z"); return t}()), - // TermStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-05T22:39:34.260Z"); return t}()), - // BillingSubscriptionID: to.Ptr("33333333-3333-3333-3333-333333333333"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/billing/armbilling/time_rfc3339.go b/sdk/resourcemanager/billing/armbilling/time_rfc3339.go index 7615ead1d286..47998ce6f67c 100644 --- a/sdk/resourcemanager/billing/armbilling/time_rfc3339.go +++ b/sdk/resourcemanager/billing/armbilling/time_rfc3339.go @@ -11,12 +11,11 @@ package armbilling import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. diff --git a/sdk/resourcemanager/billing/armbilling/transactions_client.go b/sdk/resourcemanager/billing/armbilling/transactions_client.go index 397ac3f24097..9bb405e2a729 100644 --- a/sdk/resourcemanager/billing/armbilling/transactions_client.go +++ b/sdk/resourcemanager/billing/armbilling/transactions_client.go @@ -11,16 +11,15 @@ package armbilling import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // TransactionsClient contains the methods for the Transactions group. diff --git a/sdk/resourcemanager/billing/armbilling/transactions_client_example_test.go b/sdk/resourcemanager/billing/armbilling/transactions_client_example_test.go deleted file mode 100644 index 4af70387df40..000000000000 --- a/sdk/resourcemanager/billing/armbilling/transactions_client_example_test.go +++ /dev/null @@ -1,675 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByCustomer.json -func ExampleTransactionsClient_NewListByCustomerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTransactionsClient().NewListByCustomerPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "22000000-0000-0000-0000-000000000000", func() time.Time { t, _ := time.Parse("2006-01-02", "2024-04-01"); return t }(), func() time.Time { t, _ := time.Parse("2006-01-02", "2023-05-30"); return t }(), armbilling.TransactionTypeBilled, &armbilling.TransactionsClientListByCustomerOptions{Filter: to.Ptr("properties/date gt '2020-10-01'"), - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: to.Ptr("storage"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TransactionListResult = armbilling.TransactionListResult{ - // Value: []*armbilling.Transaction{ - // { - // Name: to.Ptr("41000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/41000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](2000), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](100), - // }, - // CustomerDisplayName: to.Ptr("Contoso operations customer"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/22000000-0000-0000-0000-000000000000"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("G123456789"), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0001"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard D1, US West 3"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](4500), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](500), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5000), - // }, - // TransactionType: to.Ptr("Purchase"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](11.25), - // }, - // }, - // { - // Name: to.Ptr("51000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/51000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // CustomerDisplayName: to.Ptr("Contoso operations customer"), - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/customers/22000000-0000-0000-0000-000000000000"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("pending"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0002"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard Support"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](45), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // TransactionType: to.Ptr("Cancel"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](1.25), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByInvoiceSection.json -func ExampleTransactionsClient_NewListByInvoiceSectionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTransactionsClient().NewListByInvoiceSectionPager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "22000000-0000-0000-0000-000000000000", func() time.Time { t, _ := time.Parse("2006-01-02", "2024-04-01"); return t }(), func() time.Time { t, _ := time.Parse("2006-01-02", "2023-05-30"); return t }(), armbilling.TransactionTypeBilled, &armbilling.TransactionsClientListByInvoiceSectionOptions{Filter: to.Ptr("properties/date gt '2020-10-01'"), - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: to.Ptr("storage"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TransactionListResult = armbilling.TransactionListResult{ - // Value: []*armbilling.Transaction{ - // { - // Name: to.Ptr("41000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/41000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](2000), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](100), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("G123456789"), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/22000000-0000-0000-0000-000000000000"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0001"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard D1, US West 3"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](4500), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](500), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5000), - // }, - // TransactionType: to.Ptr("Purchase"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](11.25), - // }, - // }, - // { - // Name: to.Ptr("51000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/51000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("pending"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/22000000-0000-0000-0000-000000000000"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0002"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard Support"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](45), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // TransactionType: to.Ptr("Cancel"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](1.25), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByBillingProfile.json -func ExampleTransactionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTransactionsClient().NewListByBillingProfilePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", func() time.Time { t, _ := time.Parse("2006-01-02", "2024-04-01"); return t }(), func() time.Time { t, _ := time.Parse("2006-01-02", "2023-05-30"); return t }(), armbilling.TransactionTypeBilled, &armbilling.TransactionsClientListByBillingProfileOptions{Filter: to.Ptr("properties/date gt '2020-10-01'"), - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: to.Ptr("storage"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TransactionListResult = armbilling.TransactionListResult{ - // Value: []*armbilling.Transaction{ - // { - // Name: to.Ptr("41000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/41000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](2000), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](100), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("G123456789"), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/22000000-0000-0000-0000-000000000000"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0001"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard D1, US West 3"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](4500), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](500), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5000), - // }, - // TransactionType: to.Ptr("Purchase"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](11.25), - // }, - // }, - // { - // Name: to.Ptr("51000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/51000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("pending"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/22000000-0000-0000-0000-000000000000"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0002"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard Support"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](45), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // TransactionType: to.Ptr("Cancel"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](1.25), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-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() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTransactionsClient().NewListByInvoicePager("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", &armbilling.TransactionsClientListByInvoiceOptions{Filter: nil, - OrderBy: nil, - Top: nil, - Skip: nil, - Count: nil, - Search: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TransactionListResult = armbilling.TransactionListResult{ - // Value: []*armbilling.Transaction{ - // { - // Name: to.Ptr("41000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/41000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](2000), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](100), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("G123456789"), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/invoices/G123456789"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/22000000-0000-0000-0000-000000000000"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0001"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard D1, US West 3"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](4500), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](500), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5000), - // }, - // TransactionType: to.Ptr("Purchase"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](11.25), - // }, - // }, - // { - // Name: to.Ptr("51000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Billing/billingAccounts/billingProfiles/transactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/BillingProfiles/xxxx-xxxx-xxx-xxx/transactions/51000000-0000-0000-0000-000000000000"), - // Properties: &armbilling.TransactionProperties{ - // AzureCreditApplied: &armbilling.TransactionPropertiesAzureCreditApplied{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // BillingCurrency: to.Ptr("USD"), - // BillingProfileDisplayName: "Contoso operations billing", - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx"), - // ConsumptionCommitmentDecremented: &armbilling.TransactionPropertiesConsumptionCommitmentDecremented{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-01T00:00:00.000Z"); return t}()), - // Discount: to.Ptr[float32](0.1), - // EffectivePrice: &armbilling.TransactionPropertiesEffectivePrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](10), - // }, - // ExchangeRate: to.Ptr[float32](1), - // Invoice: to.Ptr("pending"), - // InvoiceSectionDisplayName: to.Ptr("Contoso operations invoiceSection"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/22000000-0000-0000-0000-000000000000"), - // MarketPrice: &armbilling.TransactionPropertiesMarketPrice{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](20), - // }, - // PartNumber: to.Ptr("0002"), - // PricingCurrency: to.Ptr("USD"), - // ProductDescription: to.Ptr("Standard Support"), - // ProductFamily: to.Ptr("Storage"), - // ProductType: to.Ptr("VM Instance"), - // ProductTypeID: to.Ptr("A12345"), - // Quantity: to.Ptr[int32](1), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-30T00:00:00.000Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-01T00:00:00.000Z"); return t}()), - // SubTotal: &armbilling.TransactionPropertiesSubTotal{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](45), - // }, - // Tax: &armbilling.TransactionPropertiesTax{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](5), - // }, - // TransactionAmount: &armbilling.TransactionPropertiesTransactionAmount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float32](50), - // }, - // TransactionType: to.Ptr("Cancel"), - // UnitOfMeasure: to.Ptr("1 Minute"), - // UnitType: to.Ptr("1 Runtime Minute"), - // Units: to.Ptr[float32](1.25), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsDownloadByInvoice.json -func ExampleTransactionsClient_BeginTransactionsDownloadByInvoice() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTransactionsClient().BeginTransactionsDownloadByInvoice(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DocumentDownloadResult = armbilling.DocumentDownloadResult{ - // ExpiryTime: to.Ptr("2023-02-16T17:32:28Z"), - // URL: to.Ptr("https://myaccount.blob.core.windows.net/invoices/1383724_invoice.csv?sv=2019-02-02&sr=b&sp=r"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionSummaryGetByInvoice.json -func ExampleTransactionsClient_GetTransactionSummaryByInvoice() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTransactionsClient().GetTransactionSummaryByInvoice(ctx, "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", &armbilling.TransactionsClientGetTransactionSummaryByInvoiceOptions{Filter: nil, - Search: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TransactionSummary = armbilling.TransactionSummary{ - // AzureCreditApplied: to.Ptr[float32](100), - // BillingCurrency: to.Ptr("USD"), - // ConsumptionCommitmentDecremented: to.Ptr[float32](1000), - // SubTotal: to.Ptr[float32](1000), - // Tax: to.Ptr[float32](500), - // Total: to.Ptr[float32](5400), - // } -} diff --git a/sdk/resourcemanager/billing/armbilling/transfers_client.go b/sdk/resourcemanager/billing/armbilling/transfers_client.go index 33dd865c36fd..eb3da525982b 100644 --- a/sdk/resourcemanager/billing/armbilling/transfers_client.go +++ b/sdk/resourcemanager/billing/armbilling/transfers_client.go @@ -11,14 +11,13 @@ package armbilling import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TransfersClient contains the methods for the Transfers group. diff --git a/sdk/resourcemanager/billing/armbilling/transfers_client_example_test.go b/sdk/resourcemanager/billing/armbilling/transfers_client_example_test.go deleted file mode 100644 index 59ef5e50ef3d..000000000000 --- a/sdk/resourcemanager/billing/armbilling/transfers_client_example_test.go +++ /dev/null @@ -1,186 +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. -// DO NOT EDIT. - -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/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersGet.json -func ExampleTransfersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTransfersClient().Get(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TransferDetails = armbilling.TransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/transfers/aabb123"), - // Properties: &armbilling.TransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersInitiate.json -func ExampleTransfersClient_Initiate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTransfersClient().Initiate(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", armbilling.InitiateTransferRequest{ - Properties: &armbilling.InitiateTransferProperties{ - RecipientEmailID: to.Ptr("user@contoso.com"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TransferDetails = armbilling.TransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/transfers/aabb123"), - // Properties: &armbilling.TransferProperties{ - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersCancel.json -func ExampleTransfersClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTransfersClient().Cancel(ctx, "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TransferDetails = armbilling.TransferDetails{ - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/transfers/aabb123"), - // Properties: &armbilling.TransferProperties{ - // CanceledBy: to.Ptr("user@contoso.com"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c08ac9813477921ad8295b98ced8f82d11b8f913/specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersList.json -func ExampleTransfersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armbilling.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTransfersClient().NewListPager("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TransferDetailsListResult = armbilling.TransferDetailsListResult{ - // Value: []*armbilling.TransferDetails{ - // { - // Name: to.Ptr("aabb123"), - // Type: to.Ptr("Microsoft.Billing/transfers"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx/invoiceSections/yyyy-yyyy-yyy-yyy/transfers/aabb123"), - // Properties: &armbilling.TransferProperties{ - // DetailedTransferStatus: []*armbilling.DetailedTransferStatus{ - // { - // ProductID: to.Ptr("subscriptionId"), - // ProductName: to.Ptr("Azure subscription 1"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureSubscription), - // SKUDescription: to.Ptr("MS-AZR-0017G"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }, - // { - // ProductID: to.Ptr("reservedInstanceId"), - // ProductName: to.Ptr("Reservation name"), - // ProductType: to.Ptr(armbilling.ProductTypeAzureReservation), - // SKUDescription: to.Ptr("Standard_D2s_v3;VirtualMachines;P1Y"), - // TransferStatus: to.Ptr(armbilling.ProductTransferStatusInProgress), - // }}, - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-11-05T17:32:28.000Z"); return t}()), - // InitiatorEmailID: to.Ptr("xyz@contoso.com"), - // RecipientEmailID: to.Ptr("user@contoso.com"), - // TransferStatus: to.Ptr(armbilling.TransferStatusInProgress), - // }, - // }}, - // } - } -}