diff --git a/sdk/resourcemanager/billing/armbilling/CHANGELOG.md b/sdk/resourcemanager/billing/armbilling/CHANGELOG.md index 9cee70e4140c..341ff1d5e848 100644 --- a/sdk/resourcemanager/billing/armbilling/CHANGELOG.md +++ b/sdk/resourcemanager/billing/armbilling/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-04-21) +### Other Changes + + ## 1.0.0 (2024-09-09) ### Breaking Changes diff --git a/sdk/resourcemanager/billing/armbilling/accounts_client.go b/sdk/resourcemanager/billing/armbilling/accounts_client.go index c611e02c908b..38dfd98780dd 100644 --- a/sdk/resourcemanager/billing/armbilling/accounts_client.go +++ b/sdk/resourcemanager/billing/armbilling/accounts_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,16 +8,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. @@ -101,7 +97,7 @@ func (client *AccountsClient) addPaymentTerms(ctx context.Context, billingAccoun } // addPaymentTermsCreateRequest creates the AddPaymentTerms request. -func (client *AccountsClient) addPaymentTermsCreateRequest(ctx context.Context, billingAccountName string, parameters []*PaymentTerm, options *AccountsClientBeginAddPaymentTermsOptions) (*policy.Request, error) { +func (client *AccountsClient) addPaymentTermsCreateRequest(ctx context.Context, billingAccountName string, parameters []*PaymentTerm, _ *AccountsClientBeginAddPaymentTermsOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/addPaymentTerms" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -175,7 +171,7 @@ func (client *AccountsClient) cancelPaymentTerms(ctx context.Context, billingAcc } // cancelPaymentTermsCreateRequest creates the CancelPaymentTerms request. -func (client *AccountsClient) cancelPaymentTermsCreateRequest(ctx context.Context, billingAccountName string, parameters time.Time, options *AccountsClientBeginCancelPaymentTermsOptions) (*policy.Request, error) { +func (client *AccountsClient) cancelPaymentTermsCreateRequest(ctx context.Context, billingAccountName string, parameters time.Time, _ *AccountsClientBeginCancelPaymentTermsOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/cancelPaymentTerms" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -226,7 +222,7 @@ func (client *AccountsClient) ConfirmTransition(ctx context.Context, billingAcco } // confirmTransitionCreateRequest creates the ConfirmTransition request. -func (client *AccountsClient) confirmTransitionCreateRequest(ctx context.Context, billingAccountName string, options *AccountsClientConfirmTransitionOptions) (*policy.Request, error) { +func (client *AccountsClient) confirmTransitionCreateRequest(ctx context.Context, billingAccountName string, _ *AccountsClientConfirmTransitionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/confirmTransition" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -281,7 +277,7 @@ func (client *AccountsClient) Get(ctx context.Context, billingAccountName string } // getCreateRequest creates the Get request. -func (client *AccountsClient) getCreateRequest(ctx context.Context, billingAccountName string, options *AccountsClientGetOptions) (*policy.Request, error) { +func (client *AccountsClient) getCreateRequest(ctx context.Context, billingAccountName string, _ *AccountsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -513,7 +509,7 @@ func (client *AccountsClient) update(ctx context.Context, billingAccountName str } // updateCreateRequest creates the Update request. -func (client *AccountsClient) updateCreateRequest(ctx context.Context, billingAccountName string, parameters AccountPatch, options *AccountsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AccountsClient) updateCreateRequest(ctx context.Context, billingAccountName string, parameters AccountPatch, _ *AccountsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -565,7 +561,7 @@ func (client *AccountsClient) ValidatePaymentTerms(ctx context.Context, billingA } // validatePaymentTermsCreateRequest creates the ValidatePaymentTerms request. -func (client *AccountsClient) validatePaymentTermsCreateRequest(ctx context.Context, billingAccountName string, parameters []*PaymentTerm, options *AccountsClientValidatePaymentTermsOptions) (*policy.Request, error) { +func (client *AccountsClient) validatePaymentTermsCreateRequest(ctx context.Context, billingAccountName string, parameters []*PaymentTerm, _ *AccountsClientValidatePaymentTermsOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/validatePaymentTerms" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..871cab2e4ad9 100644 --- a/sdk/resourcemanager/billing/armbilling/address_client.go +++ b/sdk/resourcemanager/billing/armbilling/address_client.go @@ -1,6 +1,3 @@ -//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. @@ -10,12 +7,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. @@ -67,7 +63,7 @@ func (client *AddressClient) Validate(ctx context.Context, parameters AddressDet } // validateCreateRequest creates the Validate request. -func (client *AddressClient) validateCreateRequest(ctx context.Context, parameters AddressDetails, options *AddressClientValidateOptions) (*policy.Request, error) { +func (client *AddressClient) validateCreateRequest(ctx context.Context, parameters AddressDetails, _ *AddressClientValidateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/validateAddress" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { 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..fe189500d1bd 100644 --- a/sdk/resourcemanager/billing/armbilling/agreements_client.go +++ b/sdk/resourcemanager/billing/armbilling/agreements_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -71,7 +67,7 @@ func (client *AgreementsClient) Get(ctx context.Context, billingAccountName stri } // getCreateRequest creates the Get request. -func (client *AgreementsClient) getCreateRequest(ctx context.Context, billingAccountName string, agreementName string, options *AgreementsClientGetOptions) (*policy.Request, error) { +func (client *AgreementsClient) getCreateRequest(ctx context.Context, billingAccountName string, agreementName string, _ *AgreementsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..657cbea6c204 100644 --- a/sdk/resourcemanager/billing/armbilling/associatedtenants_client.go +++ b/sdk/resourcemanager/billing/armbilling/associatedtenants_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -95,7 +91,7 @@ func (client *AssociatedTenantsClient) createOrUpdate(ctx context.Context, billi } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AssociatedTenantsClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, associatedTenantName string, parameters AssociatedTenant, options *AssociatedTenantsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AssociatedTenantsClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, associatedTenantName string, parameters AssociatedTenant, _ *AssociatedTenantsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -171,7 +167,7 @@ func (client *AssociatedTenantsClient) deleteOperation(ctx context.Context, bill } // deleteCreateRequest creates the Delete request. -func (client *AssociatedTenantsClient) deleteCreateRequest(ctx context.Context, billingAccountName string, associatedTenantName string, options *AssociatedTenantsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AssociatedTenantsClient) deleteCreateRequest(ctx context.Context, billingAccountName string, associatedTenantName string, _ *AssociatedTenantsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -222,7 +218,7 @@ func (client *AssociatedTenantsClient) Get(ctx context.Context, billingAccountNa } // getCreateRequest creates the Get request. -func (client *AssociatedTenantsClient) getCreateRequest(ctx context.Context, billingAccountName string, associatedTenantName string, options *AssociatedTenantsClientGetOptions) (*policy.Request, error) { +func (client *AssociatedTenantsClient) getCreateRequest(ctx context.Context, billingAccountName string, associatedTenantName string, _ *AssociatedTenantsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..2e46b2e3888d 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: 1.0.1 ``` \ 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..6709f6eaa469 100644 --- a/sdk/resourcemanager/billing/armbilling/availablebalances_client.go +++ b/sdk/resourcemanager/billing/armbilling/availablebalances_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -74,7 +70,7 @@ func (client *AvailableBalancesClient) GetByBillingAccount(ctx context.Context, } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *AvailableBalancesClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, options *AvailableBalancesClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *AvailableBalancesClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, _ *AvailableBalancesClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/availableBalance/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -134,7 +130,7 @@ func (client *AvailableBalancesClient) GetByBillingProfile(ctx context.Context, } // getByBillingProfileCreateRequest creates the GetByBillingProfile request. -func (client *AvailableBalancesClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *AvailableBalancesClientGetByBillingProfileOptions) (*policy.Request, error) { +func (client *AvailableBalancesClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *AvailableBalancesClientGetByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..be1d0620f204 100644 --- a/sdk/resourcemanager/billing/armbilling/client_factory.go +++ b/sdk/resourcemanager/billing/armbilling/client_factory.go @@ -1,6 +1,3 @@ -//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. diff --git a/sdk/resourcemanager/billing/armbilling/constants.go b/sdk/resourcemanager/billing/armbilling/constants.go index cace7d9824f9..c2e71a80646b 100644 --- a/sdk/resourcemanager/billing/armbilling/constants.go +++ b/sdk/resourcemanager/billing/armbilling/constants.go @@ -1,6 +1,3 @@ -//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. @@ -10,7 +7,7 @@ package armbilling const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // 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..a072e5a79bc3 100644 --- a/sdk/resourcemanager/billing/armbilling/customers_client.go +++ b/sdk/resourcemanager/billing/armbilling/customers_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -74,7 +70,7 @@ func (client *CustomersClient) Get(ctx context.Context, billingAccountName strin } // getCreateRequest creates the Get request. -func (client *CustomersClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, options *CustomersClientGetOptions) (*policy.Request, error) { +func (client *CustomersClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, _ *CustomersClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -140,7 +136,7 @@ func (client *CustomersClient) GetByBillingAccount(ctx context.Context, billingA } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *CustomersClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, options *CustomersClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *CustomersClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, _ *CustomersClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..399d9c1793c4 100644 --- a/sdk/resourcemanager/billing/armbilling/date_type.go +++ b/sdk/resourcemanager/billing/armbilling/date_type.go @@ -1,6 +1,3 @@ -//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. @@ -11,10 +8,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..482e9300b1ff 100644 --- a/sdk/resourcemanager/billing/armbilling/departments_client.go +++ b/sdk/resourcemanager/billing/armbilling/departments_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -72,7 +68,7 @@ func (client *DepartmentsClient) Get(ctx context.Context, billingAccountName str } // getCreateRequest creates the Get request. -func (client *DepartmentsClient) getCreateRequest(ctx context.Context, billingAccountName string, departmentName string, options *DepartmentsClientGetOptions) (*policy.Request, error) { +func (client *DepartmentsClient) getCreateRequest(ctx context.Context, billingAccountName string, departmentName string, _ *DepartmentsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..96008cd772c3 100644 --- a/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go +++ b/sdk/resourcemanager/billing/armbilling/enrollmentaccounts_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -73,7 +69,7 @@ func (client *EnrollmentAccountsClient) Get(ctx context.Context, billingAccountN } // getCreateRequest creates the Get request. -func (client *EnrollmentAccountsClient) getCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, options *EnrollmentAccountsClientGetOptions) (*policy.Request, error) { +func (client *EnrollmentAccountsClient) getCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, _ *EnrollmentAccountsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -136,7 +132,7 @@ func (client *EnrollmentAccountsClient) GetByDepartment(ctx context.Context, bil } // getByDepartmentCreateRequest creates the GetByDepartment request. -func (client *EnrollmentAccountsClient) getByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, enrollmentAccountName string, options *EnrollmentAccountsClientGetByDepartmentOptions) (*policy.Request, error) { +func (client *EnrollmentAccountsClient) getByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, enrollmentAccountName string, _ *EnrollmentAccountsClientGetByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/enrollmentAccounts/{enrollmentAccountName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..8e9ae2e08016 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/accounts_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/accounts_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,17 +9,16 @@ import ( "context" "errors" "fmt" - "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" + "net/http" + "net/url" + "regexp" + "strconv" + "time" ) // AccountsServer is a fake server for instances of the armbilling.AccountsClient type. @@ -93,35 +89,54 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "AccountsClient.BeginAddPaymentTerms": - resp, err = a.dispatchBeginAddPaymentTerms(req) - case "AccountsClient.BeginCancelPaymentTerms": - resp, err = a.dispatchBeginCancelPaymentTerms(req) - case "AccountsClient.ConfirmTransition": - resp, err = a.dispatchConfirmTransition(req) - case "AccountsClient.Get": - resp, err = a.dispatchGet(req) - case "AccountsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AccountsClient.NewListInvoiceSectionsByCreateSubscriptionPermissionPager": - resp, err = a.dispatchNewListInvoiceSectionsByCreateSubscriptionPermissionPager(req) - case "AccountsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - case "AccountsClient.ValidatePaymentTerms": - resp, err = a.dispatchValidatePaymentTerms(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return a.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (a *AccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if accountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = accountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AccountsClient.BeginAddPaymentTerms": + res.resp, res.err = a.dispatchBeginAddPaymentTerms(req) + case "AccountsClient.BeginCancelPaymentTerms": + res.resp, res.err = a.dispatchBeginCancelPaymentTerms(req) + case "AccountsClient.ConfirmTransition": + res.resp, res.err = a.dispatchConfirmTransition(req) + case "AccountsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AccountsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AccountsClient.NewListInvoiceSectionsByCreateSubscriptionPermissionPager": + res.resp, res.err = a.dispatchNewListInvoiceSectionsByCreateSubscriptionPermissionPager(req) + case "AccountsClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + case "AccountsClient.ValidatePaymentTerms": + res.resp, res.err = a.dispatchValidatePaymentTerms(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AccountsServerTransport) dispatchBeginAddPaymentTerms(req *http.Request) (*http.Response, error) { @@ -533,3 +548,9 @@ func (a *AccountsServerTransport) dispatchValidatePaymentTerms(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to AccountsServerTransport +var accountsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/address_server.go b/sdk/resourcemanager/billing/armbilling/fake/address_server.go index 0bfa78711910..e23244c8362e 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/address_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/address_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,12 +9,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" + "net/http" ) // AddressServer is a fake server for instances of the armbilling.AddressClient type. @@ -48,21 +44,40 @@ func (a *AddressServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AddressClient.Validate": - resp, err = a.dispatchValidate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AddressServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if addressServerTransportInterceptor != nil { + res.resp, res.err, intercepted = addressServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AddressClient.Validate": + res.resp, res.err = a.dispatchValidate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AddressServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { @@ -87,3 +102,9 @@ func (a *AddressServerTransport) dispatchValidate(req *http.Request) (*http.Resp } return resp, nil } + +// set this to conditionally intercept incoming requests to AddressServerTransport +var addressServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go b/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go index 8f2614dbeb2a..bf7980cf8e14 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/agreements_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // AgreementsServer is a fake server for instances of the armbilling.AgreementsClient type. @@ -59,23 +55,42 @@ func (a *AgreementsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AgreementsClient.Get": - resp, err = a.dispatchGet(req) - case "AgreementsClient.NewListByBillingAccountPager": - resp, err = a.dispatchNewListByBillingAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AgreementsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if agreementsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = agreementsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AgreementsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AgreementsClient.NewListByBillingAccountPager": + res.resp, res.err = a.dispatchNewListByBillingAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AgreementsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -159,3 +174,9 @@ func (a *AgreementsServerTransport) dispatchNewListByBillingAccountPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to AgreementsServerTransport +var agreementsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go b/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go index 6380ca83ff21..2581101d5e08 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/associatedtenants_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // AssociatedTenantsServer is a fake server for instances of the armbilling.AssociatedTenantsClient type. @@ -31,7 +27,7 @@ type AssociatedTenantsServer struct { BeginCreateOrUpdate func(ctx context.Context, billingAccountName string, associatedTenantName string, parameters armbilling.AssociatedTenant, options *armbilling.AssociatedTenantsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armbilling.AssociatedTenantsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AssociatedTenantsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, billingAccountName string, associatedTenantName string, options *armbilling.AssociatedTenantsClientBeginDeleteOptions) (resp azfake.PollerResponder[armbilling.AssociatedTenantsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AssociatedTenantsClient.Get @@ -72,27 +68,46 @@ func (a *AssociatedTenantsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AssociatedTenantsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AssociatedTenantsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AssociatedTenantsClient.Get": - resp, err = a.dispatchGet(req) - case "AssociatedTenantsClient.NewListByBillingAccountPager": - resp, err = a.dispatchNewListByBillingAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AssociatedTenantsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if associatedTenantsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = associatedTenantsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssociatedTenantsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AssociatedTenantsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AssociatedTenantsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssociatedTenantsClient.NewListByBillingAccountPager": + res.resp, res.err = a.dispatchNewListByBillingAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AssociatedTenantsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -176,9 +191,9 @@ func (a *AssociatedTenantsServerTransport) dispatchBeginDelete(req *http.Request return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) @@ -328,3 +343,9 @@ func (a *AssociatedTenantsServerTransport) dispatchNewListByBillingAccountPager( } return resp, nil } + +// set this to conditionally intercept incoming requests to AssociatedTenantsServerTransport +var associatedTenantsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go b/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go index a9d4dbd3578d..90fe8a103274 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/availablebalances_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,14 +9,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" + "net/http" + "net/url" + "regexp" ) // AvailableBalancesServer is a fake server for instances of the armbilling.AvailableBalancesClient type. @@ -54,23 +50,42 @@ func (a *AvailableBalancesServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} + +func (a *AvailableBalancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "AvailableBalancesClient.GetByBillingAccount": - resp, err = a.dispatchGetByBillingAccount(req) - case "AvailableBalancesClient.GetByBillingProfile": - resp, err = a.dispatchGetByBillingProfile(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if availableBalancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = availableBalancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AvailableBalancesClient.GetByBillingAccount": + res.resp, res.err = a.dispatchGetByBillingAccount(req) + case "AvailableBalancesClient.GetByBillingProfile": + res.resp, res.err = a.dispatchGetByBillingProfile(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AvailableBalancesServerTransport) dispatchGetByBillingAccount(req *http.Request) (*http.Response, error) { @@ -134,3 +149,9 @@ func (a *AvailableBalancesServerTransport) dispatchGetByBillingProfile(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to AvailableBalancesServerTransport +var availableBalancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/customers_server.go b/sdk/resourcemanager/billing/armbilling/fake/customers_server.go index bb3a9f77de99..5cddff4e2a61 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/customers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/customers_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // CustomersServer is a fake server for instances of the armbilling.CustomersClient type. @@ -70,27 +66,46 @@ func (c *CustomersServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CustomersClient.Get": - resp, err = c.dispatchGet(req) - case "CustomersClient.GetByBillingAccount": - resp, err = c.dispatchGetByBillingAccount(req) - case "CustomersClient.NewListByBillingAccountPager": - resp, err = c.dispatchNewListByBillingAccountPager(req) - case "CustomersClient.NewListByBillingProfilePager": - resp, err = c.dispatchNewListByBillingProfilePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CustomersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if customersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = customersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CustomersClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CustomersClient.GetByBillingAccount": + res.resp, res.err = c.dispatchGetByBillingAccount(req) + case "CustomersClient.NewListByBillingAccountPager": + res.resp, res.err = c.dispatchNewListByBillingAccountPager(req) + case "CustomersClient.NewListByBillingProfilePager": + res.resp, res.err = c.dispatchNewListByBillingProfilePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CustomersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -378,3 +393,9 @@ func (c *CustomersServerTransport) dispatchNewListByBillingProfilePager(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to CustomersServerTransport +var customersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/date_type.go b/sdk/resourcemanager/billing/armbilling/fake/date_type.go index 0fcc8f604e56..fc08a215e031 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/date_type.go +++ b/sdk/resourcemanager/billing/armbilling/fake/date_type.go @@ -1,6 +1,3 @@ -//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. @@ -11,10 +8,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..6fa4d31f29e1 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/departments_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/departments_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // DepartmentsServer is a fake server for instances of the armbilling.DepartmentsClient type. @@ -60,23 +56,42 @@ func (d *DepartmentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DepartmentsClient.Get": - resp, err = d.dispatchGet(req) - case "DepartmentsClient.NewListByBillingAccountPager": - resp, err = d.dispatchNewListByBillingAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DepartmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if departmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = departmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DepartmentsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DepartmentsClient.NewListByBillingAccountPager": + res.resp, res.err = d.dispatchNewListByBillingAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DepartmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -202,3 +217,9 @@ func (d *DepartmentsServerTransport) dispatchNewListByBillingAccountPager(req *h } return resp, nil } + +// set this to conditionally intercept incoming requests to DepartmentsServerTransport +var departmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go b/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go index baf476f747ac..fd311ee4aad3 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/enrollmentaccounts_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // EnrollmentAccountsServer is a fake server for instances of the armbilling.EnrollmentAccountsClient type. @@ -70,27 +66,46 @@ func (e *EnrollmentAccountsServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "EnrollmentAccountsClient.Get": - resp, err = e.dispatchGet(req) - case "EnrollmentAccountsClient.GetByDepartment": - resp, err = e.dispatchGetByDepartment(req) - case "EnrollmentAccountsClient.NewListByBillingAccountPager": - resp, err = e.dispatchNewListByBillingAccountPager(req) - case "EnrollmentAccountsClient.NewListByDepartmentPager": - resp, err = e.dispatchNewListByDepartmentPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EnrollmentAccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if enrollmentAccountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = enrollmentAccountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnrollmentAccountsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnrollmentAccountsClient.GetByDepartment": + res.resp, res.err = e.dispatchGetByDepartment(req) + case "EnrollmentAccountsClient.NewListByBillingAccountPager": + res.resp, res.err = e.dispatchNewListByBillingAccountPager(req) + case "EnrollmentAccountsClient.NewListByDepartmentPager": + res.resp, res.err = e.dispatchNewListByDepartmentPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *EnrollmentAccountsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -366,3 +381,9 @@ func (e *EnrollmentAccountsServerTransport) dispatchNewListByDepartmentPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to EnrollmentAccountsServerTransport +var enrollmentAccountsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/internal.go b/sdk/resourcemanager/billing/armbilling/fake/internal.go index 9b74f6994585..d186c1b38a18 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/internal.go +++ b/sdk/resourcemanager/billing/armbilling/fake/internal.go @@ -1,6 +1,3 @@ -//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. @@ -9,13 +6,17 @@ 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 result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go b/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go index cbbb92e100ce..dc77cec2763c 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/invoices_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,23 +9,22 @@ import ( "context" "errors" "fmt" - "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" + "net/http" + "net/url" + "regexp" + "strconv" + "time" ) // InvoicesServer is a fake server for instances of the armbilling.InvoicesClient type. type InvoicesServer struct { // BeginAmend is the fake for method InvoicesClient.BeginAmend - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginAmend func(ctx context.Context, billingAccountName string, invoiceName string, options *armbilling.InvoicesClientBeginAmendOptions) (resp azfake.PollerResponder[armbilling.InvoicesClientAmendResponse], errResp azfake.ErrorResponder) // BeginDownloadByBillingAccount is the fake for method InvoicesClient.BeginDownloadByBillingAccount @@ -117,43 +113,62 @@ func (i *InvoicesServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "InvoicesClient.BeginAmend": - resp, err = i.dispatchBeginAmend(req) - case "InvoicesClient.BeginDownloadByBillingAccount": - resp, err = i.dispatchBeginDownloadByBillingAccount(req) - case "InvoicesClient.BeginDownloadByBillingSubscription": - resp, err = i.dispatchBeginDownloadByBillingSubscription(req) - case "InvoicesClient.BeginDownloadDocumentsByBillingAccount": - resp, err = i.dispatchBeginDownloadDocumentsByBillingAccount(req) - case "InvoicesClient.BeginDownloadDocumentsByBillingSubscription": - resp, err = i.dispatchBeginDownloadDocumentsByBillingSubscription(req) - case "InvoicesClient.BeginDownloadSummaryByBillingAccount": - resp, err = i.dispatchBeginDownloadSummaryByBillingAccount(req) - case "InvoicesClient.Get": - resp, err = i.dispatchGet(req) - case "InvoicesClient.GetByBillingAccount": - resp, err = i.dispatchGetByBillingAccount(req) - case "InvoicesClient.GetByBillingSubscription": - resp, err = i.dispatchGetByBillingSubscription(req) - case "InvoicesClient.NewListByBillingAccountPager": - resp, err = i.dispatchNewListByBillingAccountPager(req) - case "InvoicesClient.NewListByBillingProfilePager": - resp, err = i.dispatchNewListByBillingProfilePager(req) - case "InvoicesClient.NewListByBillingSubscriptionPager": - resp, err = i.dispatchNewListByBillingSubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return i.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (i *InvoicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if invoicesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = invoicesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InvoicesClient.BeginAmend": + res.resp, res.err = i.dispatchBeginAmend(req) + case "InvoicesClient.BeginDownloadByBillingAccount": + res.resp, res.err = i.dispatchBeginDownloadByBillingAccount(req) + case "InvoicesClient.BeginDownloadByBillingSubscription": + res.resp, res.err = i.dispatchBeginDownloadByBillingSubscription(req) + case "InvoicesClient.BeginDownloadDocumentsByBillingAccount": + res.resp, res.err = i.dispatchBeginDownloadDocumentsByBillingAccount(req) + case "InvoicesClient.BeginDownloadDocumentsByBillingSubscription": + res.resp, res.err = i.dispatchBeginDownloadDocumentsByBillingSubscription(req) + case "InvoicesClient.BeginDownloadSummaryByBillingAccount": + res.resp, res.err = i.dispatchBeginDownloadSummaryByBillingAccount(req) + case "InvoicesClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InvoicesClient.GetByBillingAccount": + res.resp, res.err = i.dispatchGetByBillingAccount(req) + case "InvoicesClient.GetByBillingSubscription": + res.resp, res.err = i.dispatchGetByBillingSubscription(req) + case "InvoicesClient.NewListByBillingAccountPager": + res.resp, res.err = i.dispatchNewListByBillingAccountPager(req) + case "InvoicesClient.NewListByBillingProfilePager": + res.resp, res.err = i.dispatchNewListByBillingProfilePager(req) + case "InvoicesClient.NewListByBillingSubscriptionPager": + res.resp, res.err = i.dispatchNewListByBillingSubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *InvoicesServerTransport) dispatchBeginAmend(req *http.Request) (*http.Response, error) { @@ -189,9 +204,9 @@ func (i *InvoicesServerTransport) dispatchBeginAmend(req *http.Request) (*http.R return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { i.beginAmend.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginAmend) { i.beginAmend.remove(req) @@ -880,3 +895,9 @@ func (i *InvoicesServerTransport) dispatchNewListByBillingSubscriptionPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to InvoicesServerTransport +var invoicesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go b/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go index fab7b99e45f6..ecf4cff305f3 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/invoicesections_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // InvoiceSectionsServer is a fake server for instances of the armbilling.InvoiceSectionsClient type. @@ -31,7 +27,7 @@ type InvoiceSectionsServer struct { BeginCreateOrUpdate func(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters armbilling.InvoiceSection, options *armbilling.InvoiceSectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armbilling.InvoiceSectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method InvoiceSectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *armbilling.InvoiceSectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armbilling.InvoiceSectionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method InvoiceSectionsClient.Get @@ -76,29 +72,48 @@ func (i *InvoiceSectionsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "InvoiceSectionsClient.BeginCreateOrUpdate": - resp, err = i.dispatchBeginCreateOrUpdate(req) - case "InvoiceSectionsClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "InvoiceSectionsClient.Get": - resp, err = i.dispatchGet(req) - case "InvoiceSectionsClient.NewListByBillingProfilePager": - resp, err = i.dispatchNewListByBillingProfilePager(req) - case "InvoiceSectionsClient.ValidateDeleteEligibility": - resp, err = i.dispatchValidateDeleteEligibility(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *InvoiceSectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if invoiceSectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = invoiceSectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InvoiceSectionsClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "InvoiceSectionsClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "InvoiceSectionsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InvoiceSectionsClient.NewListByBillingProfilePager": + res.resp, res.err = i.dispatchNewListByBillingProfilePager(req) + case "InvoiceSectionsClient.ValidateDeleteEligibility": + res.resp, res.err = i.dispatchValidateDeleteEligibility(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *InvoiceSectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (i *InvoiceSectionsServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { i.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { i.beginDelete.remove(req) @@ -387,3 +402,9 @@ func (i *InvoiceSectionsServerTransport) dispatchValidateDeleteEligibility(req * } return resp, nil } + +// set this to conditionally intercept incoming requests to InvoiceSectionsServerTransport +var invoiceSectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/operations_server.go b/sdk/resourcemanager/billing/armbilling/fake/operations_server.go index b72acbab8efc..c388b8ea8e75 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/operations_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/operations_server.go @@ -1,6 +1,3 @@ -//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. @@ -11,13 +8,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" + "net/http" ) // OperationsServer is a fake server for instances of the armbilling.OperationsClient type. @@ -52,21 +48,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -95,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go b/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go index 2ddfff374544..e1eb5a4d0f1c 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/partnertransfers_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // PartnerTransfersServer is a fake server for instances of the armbilling.PartnerTransfersClient type. @@ -67,27 +63,46 @@ func (p *PartnerTransfersServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PartnerTransfersClient.Cancel": - resp, err = p.dispatchCancel(req) - case "PartnerTransfersClient.Get": - resp, err = p.dispatchGet(req) - case "PartnerTransfersClient.Initiate": - resp, err = p.dispatchInitiate(req) - case "PartnerTransfersClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PartnerTransfersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if partnerTransfersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = partnerTransfersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PartnerTransfersClient.Cancel": + res.resp, res.err = p.dispatchCancel(req) + case "PartnerTransfersClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PartnerTransfersClient.Initiate": + res.resp, res.err = p.dispatchInitiate(req) + case "PartnerTransfersClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PartnerTransfersServerTransport) dispatchCancel(req *http.Request) (*http.Response, error) { @@ -261,3 +276,9 @@ func (p *PartnerTransfersServerTransport) dispatchNewListPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to PartnerTransfersServerTransport +var partnerTransfersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go b/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go index 4dbc9ad461ed..51d541616ec7 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/paymentmethods_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // PaymentMethodsServer is a fake server for instances of the armbilling.PaymentMethodsClient type. @@ -83,33 +79,52 @@ func (p *PaymentMethodsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PaymentMethodsClient.DeleteByUser": - resp, err = p.dispatchDeleteByUser(req) - case "PaymentMethodsClient.GetByBillingAccount": - resp, err = p.dispatchGetByBillingAccount(req) - case "PaymentMethodsClient.GetByBillingProfile": - resp, err = p.dispatchGetByBillingProfile(req) - case "PaymentMethodsClient.GetByUser": - resp, err = p.dispatchGetByUser(req) - case "PaymentMethodsClient.NewListByBillingAccountPager": - resp, err = p.dispatchNewListByBillingAccountPager(req) - case "PaymentMethodsClient.NewListByBillingProfilePager": - resp, err = p.dispatchNewListByBillingProfilePager(req) - case "PaymentMethodsClient.NewListByUserPager": - resp, err = p.dispatchNewListByUserPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PaymentMethodsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if paymentMethodsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = paymentMethodsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PaymentMethodsClient.DeleteByUser": + res.resp, res.err = p.dispatchDeleteByUser(req) + case "PaymentMethodsClient.GetByBillingAccount": + res.resp, res.err = p.dispatchGetByBillingAccount(req) + case "PaymentMethodsClient.GetByBillingProfile": + res.resp, res.err = p.dispatchGetByBillingProfile(req) + case "PaymentMethodsClient.GetByUser": + res.resp, res.err = p.dispatchGetByUser(req) + case "PaymentMethodsClient.NewListByBillingAccountPager": + res.resp, res.err = p.dispatchNewListByBillingAccountPager(req) + case "PaymentMethodsClient.NewListByBillingProfilePager": + res.resp, res.err = p.dispatchNewListByBillingProfilePager(req) + case "PaymentMethodsClient.NewListByUserPager": + res.resp, res.err = p.dispatchNewListByUserPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PaymentMethodsServerTransport) dispatchDeleteByUser(req *http.Request) (*http.Response, error) { @@ -344,3 +359,9 @@ func (p *PaymentMethodsServerTransport) dispatchNewListByUserPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to PaymentMethodsServerTransport +var paymentMethodsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go b/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go index f0dda8ebf627..09f171ab5f09 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/permissions_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // PermissionsServer is a fake server for instances of the armbilling.PermissionsClient type. @@ -115,45 +111,64 @@ func (p *PermissionsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "PermissionsClient.CheckAccessByBillingAccount": - resp, err = p.dispatchCheckAccessByBillingAccount(req) - case "PermissionsClient.CheckAccessByBillingProfile": - resp, err = p.dispatchCheckAccessByBillingProfile(req) - case "PermissionsClient.CheckAccessByCustomer": - resp, err = p.dispatchCheckAccessByCustomer(req) - case "PermissionsClient.CheckAccessByDepartment": - resp, err = p.dispatchCheckAccessByDepartment(req) - case "PermissionsClient.CheckAccessByEnrollmentAccount": - resp, err = p.dispatchCheckAccessByEnrollmentAccount(req) - case "PermissionsClient.CheckAccessByInvoiceSection": - resp, err = p.dispatchCheckAccessByInvoiceSection(req) - case "PermissionsClient.NewListByBillingAccountPager": - resp, err = p.dispatchNewListByBillingAccountPager(req) - case "PermissionsClient.NewListByBillingProfilePager": - resp, err = p.dispatchNewListByBillingProfilePager(req) - case "PermissionsClient.NewListByCustomerPager": - resp, err = p.dispatchNewListByCustomerPager(req) - case "PermissionsClient.NewListByCustomerAtBillingAccountPager": - resp, err = p.dispatchNewListByCustomerAtBillingAccountPager(req) - case "PermissionsClient.NewListByDepartmentPager": - resp, err = p.dispatchNewListByDepartmentPager(req) - case "PermissionsClient.NewListByEnrollmentAccountPager": - resp, err = p.dispatchNewListByEnrollmentAccountPager(req) - case "PermissionsClient.NewListByInvoiceSectionPager": - resp, err = p.dispatchNewListByInvoiceSectionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return p.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (p *PermissionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if permissionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = permissionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PermissionsClient.CheckAccessByBillingAccount": + res.resp, res.err = p.dispatchCheckAccessByBillingAccount(req) + case "PermissionsClient.CheckAccessByBillingProfile": + res.resp, res.err = p.dispatchCheckAccessByBillingProfile(req) + case "PermissionsClient.CheckAccessByCustomer": + res.resp, res.err = p.dispatchCheckAccessByCustomer(req) + case "PermissionsClient.CheckAccessByDepartment": + res.resp, res.err = p.dispatchCheckAccessByDepartment(req) + case "PermissionsClient.CheckAccessByEnrollmentAccount": + res.resp, res.err = p.dispatchCheckAccessByEnrollmentAccount(req) + case "PermissionsClient.CheckAccessByInvoiceSection": + res.resp, res.err = p.dispatchCheckAccessByInvoiceSection(req) + case "PermissionsClient.NewListByBillingAccountPager": + res.resp, res.err = p.dispatchNewListByBillingAccountPager(req) + case "PermissionsClient.NewListByBillingProfilePager": + res.resp, res.err = p.dispatchNewListByBillingProfilePager(req) + case "PermissionsClient.NewListByCustomerPager": + res.resp, res.err = p.dispatchNewListByCustomerPager(req) + case "PermissionsClient.NewListByCustomerAtBillingAccountPager": + res.resp, res.err = p.dispatchNewListByCustomerAtBillingAccountPager(req) + case "PermissionsClient.NewListByDepartmentPager": + res.resp, res.err = p.dispatchNewListByDepartmentPager(req) + case "PermissionsClient.NewListByEnrollmentAccountPager": + res.resp, res.err = p.dispatchNewListByEnrollmentAccountPager(req) + case "PermissionsClient.NewListByInvoiceSectionPager": + res.resp, res.err = p.dispatchNewListByInvoiceSectionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PermissionsServerTransport) dispatchCheckAccessByBillingAccount(req *http.Request) (*http.Response, error) { @@ -672,3 +687,9 @@ func (p *PermissionsServerTransport) dispatchNewListByInvoiceSectionPager(req *h } return resp, nil } + +// set this to conditionally intercept incoming requests to PermissionsServerTransport +var permissionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/policies_server.go b/sdk/resourcemanager/billing/armbilling/fake/policies_server.go index 592bda54a4f6..94ba9949ae76 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/policies_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/policies_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,14 +9,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" + "net/http" + "net/url" + "regexp" ) // PoliciesServer is a fake server for instances of the armbilling.PoliciesClient type. @@ -92,37 +88,56 @@ func (p *PoliciesServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "PoliciesClient.BeginCreateOrUpdateByBillingAccount": - resp, err = p.dispatchBeginCreateOrUpdateByBillingAccount(req) - case "PoliciesClient.BeginCreateOrUpdateByBillingProfile": - resp, err = p.dispatchBeginCreateOrUpdateByBillingProfile(req) - case "PoliciesClient.BeginCreateOrUpdateByCustomer": - resp, err = p.dispatchBeginCreateOrUpdateByCustomer(req) - case "PoliciesClient.BeginCreateOrUpdateByCustomerAtBillingAccount": - resp, err = p.dispatchBeginCreateOrUpdateByCustomerAtBillingAccount(req) - case "PoliciesClient.GetByBillingAccount": - resp, err = p.dispatchGetByBillingAccount(req) - case "PoliciesClient.GetByBillingProfile": - resp, err = p.dispatchGetByBillingProfile(req) - case "PoliciesClient.GetByCustomer": - resp, err = p.dispatchGetByCustomer(req) - case "PoliciesClient.GetByCustomerAtBillingAccount": - resp, err = p.dispatchGetByCustomerAtBillingAccount(req) - case "PoliciesClient.GetBySubscription": - resp, err = p.dispatchGetBySubscription(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return p.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (p *PoliciesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if policiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = policiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PoliciesClient.BeginCreateOrUpdateByBillingAccount": + res.resp, res.err = p.dispatchBeginCreateOrUpdateByBillingAccount(req) + case "PoliciesClient.BeginCreateOrUpdateByBillingProfile": + res.resp, res.err = p.dispatchBeginCreateOrUpdateByBillingProfile(req) + case "PoliciesClient.BeginCreateOrUpdateByCustomer": + res.resp, res.err = p.dispatchBeginCreateOrUpdateByCustomer(req) + case "PoliciesClient.BeginCreateOrUpdateByCustomerAtBillingAccount": + res.resp, res.err = p.dispatchBeginCreateOrUpdateByCustomerAtBillingAccount(req) + case "PoliciesClient.GetByBillingAccount": + res.resp, res.err = p.dispatchGetByBillingAccount(req) + case "PoliciesClient.GetByBillingProfile": + res.resp, res.err = p.dispatchGetByBillingProfile(req) + case "PoliciesClient.GetByCustomer": + res.resp, res.err = p.dispatchGetByCustomer(req) + case "PoliciesClient.GetByCustomerAtBillingAccount": + res.resp, res.err = p.dispatchGetByCustomerAtBillingAccount(req) + case "PoliciesClient.GetBySubscription": + res.resp, res.err = p.dispatchGetBySubscription(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PoliciesServerTransport) dispatchBeginCreateOrUpdateByBillingAccount(req *http.Request) (*http.Response, error) { @@ -483,3 +498,9 @@ func (p *PoliciesServerTransport) dispatchGetBySubscription(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to PoliciesServerTransport +var policiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/products_server.go b/sdk/resourcemanager/billing/armbilling/fake/products_server.go index e29885ad9752..6ccf5eeabe6b 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/products_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/products_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // ProductsServer is a fake server for instances of the armbilling.ProductsClient type. @@ -92,35 +88,54 @@ func (p *ProductsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "ProductsClient.Get": - resp, err = p.dispatchGet(req) - case "ProductsClient.NewListByBillingAccountPager": - resp, err = p.dispatchNewListByBillingAccountPager(req) - case "ProductsClient.NewListByBillingProfilePager": - resp, err = p.dispatchNewListByBillingProfilePager(req) - case "ProductsClient.NewListByCustomerPager": - resp, err = p.dispatchNewListByCustomerPager(req) - case "ProductsClient.NewListByInvoiceSectionPager": - resp, err = p.dispatchNewListByInvoiceSectionPager(req) - case "ProductsClient.BeginMove": - resp, err = p.dispatchBeginMove(req) - case "ProductsClient.Update": - resp, err = p.dispatchUpdate(req) - case "ProductsClient.ValidateMoveEligibility": - resp, err = p.dispatchValidateMoveEligibility(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *ProductsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if productsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = productsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProductsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProductsClient.NewListByBillingAccountPager": + res.resp, res.err = p.dispatchNewListByBillingAccountPager(req) + case "ProductsClient.NewListByBillingProfilePager": + res.resp, res.err = p.dispatchNewListByBillingProfilePager(req) + case "ProductsClient.NewListByCustomerPager": + res.resp, res.err = p.dispatchNewListByCustomerPager(req) + case "ProductsClient.NewListByInvoiceSectionPager": + res.resp, res.err = p.dispatchNewListByInvoiceSectionPager(req) + case "ProductsClient.BeginMove": + res.resp, res.err = p.dispatchBeginMove(req) + case "ProductsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + case "ProductsClient.ValidateMoveEligibility": + res.resp, res.err = p.dispatchValidateMoveEligibility(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *ProductsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -693,3 +708,9 @@ func (p *ProductsServerTransport) dispatchValidateMoveEligibility(req *http.Requ } return resp, nil } + +// set this to conditionally intercept incoming requests to ProductsServerTransport +var productsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go b/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go index 28d7ec31e832..ccb4caab426c 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/profiles_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // ProfilesServer is a fake server for instances of the armbilling.ProfilesClient type. @@ -31,7 +27,7 @@ type ProfilesServer struct { BeginCreateOrUpdate func(ctx context.Context, billingAccountName string, billingProfileName string, parameters armbilling.Profile, options *armbilling.ProfilesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armbilling.ProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ProfilesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, billingAccountName string, billingProfileName string, options *armbilling.ProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armbilling.ProfilesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ProfilesClient.Get @@ -76,29 +72,48 @@ func (p *ProfilesServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "ProfilesClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "ProfilesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "ProfilesClient.Get": - resp, err = p.dispatchGet(req) - case "ProfilesClient.NewListByBillingAccountPager": - resp, err = p.dispatchNewListByBillingAccountPager(req) - case "ProfilesClient.ValidateDeleteEligibility": - resp, err = p.dispatchValidateDeleteEligibility(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *ProfilesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if profilesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = profilesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProfilesClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "ProfilesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProfilesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProfilesClient.NewListByBillingAccountPager": + res.resp, res.err = p.dispatchNewListByBillingAccountPager(req) + case "ProfilesClient.ValidateDeleteEligibility": + res.resp, res.err = p.dispatchValidateDeleteEligibility(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *ProfilesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -182,9 +197,9 @@ func (p *ProfilesServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -367,3 +382,9 @@ func (p *ProfilesServerTransport) dispatchValidateDeleteEligibility(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to ProfilesServerTransport +var profilesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/property_server.go b/sdk/resourcemanager/billing/armbilling/fake/property_server.go index 6792a4eab9eb..0a2aa8543766 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/property_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/property_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,14 @@ 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" + "net/http" + "net/url" + "regexp" + "strconv" ) // PropertyServer is a fake server for instances of the armbilling.PropertyClient type. @@ -55,23 +51,42 @@ func (p *PropertyServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - 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) - } +func (p *PropertyServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if propertyServerTransportInterceptor != nil { + res.resp, res.err, intercepted = propertyServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PropertyClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PropertyClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PropertyServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -151,3 +166,9 @@ func (p *PropertyServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to PropertyServerTransport +var propertyServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go b/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go index b4f0d52e7641..863be1bfa286 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/recipienttransfers_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // RecipientTransfersServer is a fake server for instances of the armbilling.RecipientTransfersClient type. @@ -71,29 +67,48 @@ func (r *RecipientTransfersServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} + +func (r *RecipientTransfersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "RecipientTransfersClient.Accept": - resp, err = r.dispatchAccept(req) - case "RecipientTransfersClient.Decline": - resp, err = r.dispatchDecline(req) - case "RecipientTransfersClient.Get": - resp, err = r.dispatchGet(req) - case "RecipientTransfersClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "RecipientTransfersClient.Validate": - resp, err = r.dispatchValidate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if recipientTransfersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = recipientTransfersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RecipientTransfersClient.Accept": + res.resp, res.err = r.dispatchAccept(req) + case "RecipientTransfersClient.Decline": + res.resp, res.err = r.dispatchDecline(req) + case "RecipientTransfersClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RecipientTransfersClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "RecipientTransfersClient.Validate": + res.resp, res.err = r.dispatchValidate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RecipientTransfersServerTransport) dispatchAccept(req *http.Request) (*http.Response, error) { @@ -246,3 +261,9 @@ func (r *RecipientTransfersServerTransport) dispatchValidate(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to RecipientTransfersServerTransport +var recipientTransfersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/requests_server.go b/sdk/resourcemanager/billing/armbilling/fake/requests_server.go index 2d090fc77e29..feeced0de6e9 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/requests_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/requests_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // RequestsServer is a fake server for instances of the armbilling.RequestsClient type. @@ -90,33 +86,52 @@ func (r *RequestsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RequestsClient.BeginCreateOrUpdate": - resp, err = r.dispatchBeginCreateOrUpdate(req) - case "RequestsClient.Get": - resp, err = r.dispatchGet(req) - case "RequestsClient.NewListByBillingAccountPager": - resp, err = r.dispatchNewListByBillingAccountPager(req) - case "RequestsClient.NewListByBillingProfilePager": - resp, err = r.dispatchNewListByBillingProfilePager(req) - case "RequestsClient.NewListByCustomerPager": - resp, err = r.dispatchNewListByCustomerPager(req) - case "RequestsClient.NewListByInvoiceSectionPager": - resp, err = r.dispatchNewListByInvoiceSectionPager(req) - case "RequestsClient.NewListByUserPager": - resp, err = r.dispatchNewListByUserPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RequestsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if requestsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = requestsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RequestsClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "RequestsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RequestsClient.NewListByBillingAccountPager": + res.resp, res.err = r.dispatchNewListByBillingAccountPager(req) + case "RequestsClient.NewListByBillingProfilePager": + res.resp, res.err = r.dispatchNewListByBillingProfilePager(req) + case "RequestsClient.NewListByCustomerPager": + res.resp, res.err = r.dispatchNewListByCustomerPager(req) + case "RequestsClient.NewListByInvoiceSectionPager": + res.resp, res.err = r.dispatchNewListByInvoiceSectionPager(req) + case "RequestsClient.NewListByUserPager": + res.resp, res.err = r.dispatchNewListByUserPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RequestsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -701,3 +716,9 @@ func (r *RequestsServerTransport) dispatchNewListByUserPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to RequestsServerTransport +var requestsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go b/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go index 092128c0558e..45a9f30bc676 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/reservationorders_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // ReservationOrdersServer is a fake server for instances of the armbilling.ReservationOrdersClient type. @@ -60,23 +56,42 @@ func (r *ReservationOrdersServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReservationOrdersClient.GetByBillingAccount": - resp, err = r.dispatchGetByBillingAccount(req) - case "ReservationOrdersClient.NewListByBillingAccountPager": - resp, err = r.dispatchNewListByBillingAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReservationOrdersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if reservationOrdersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = reservationOrdersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReservationOrdersClient.GetByBillingAccount": + res.resp, res.err = r.dispatchGetByBillingAccount(req) + case "ReservationOrdersClient.NewListByBillingAccountPager": + res.resp, res.err = r.dispatchNewListByBillingAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ReservationOrdersServerTransport) dispatchGetByBillingAccount(req *http.Request) (*http.Response, error) { @@ -193,3 +208,9 @@ func (r *ReservationOrdersServerTransport) dispatchNewListByBillingAccountPager( } return resp, nil } + +// set this to conditionally intercept incoming requests to ReservationOrdersServerTransport +var reservationOrdersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go b/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go index 4a9960f14ca4..f54ccce39b87 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/reservations_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // ReservationsServer is a fake server for instances of the armbilling.ReservationsClient type. @@ -78,29 +74,48 @@ func (r *ReservationsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReservationsClient.GetByReservationOrder": - resp, err = r.dispatchGetByReservationOrder(req) - case "ReservationsClient.NewListByBillingAccountPager": - resp, err = r.dispatchNewListByBillingAccountPager(req) - case "ReservationsClient.NewListByBillingProfilePager": - resp, err = r.dispatchNewListByBillingProfilePager(req) - case "ReservationsClient.NewListByReservationOrderPager": - resp, err = r.dispatchNewListByReservationOrderPager(req) - case "ReservationsClient.BeginUpdateByBillingAccount": - resp, err = r.dispatchBeginUpdateByBillingAccount(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReservationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if reservationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = reservationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReservationsClient.GetByReservationOrder": + res.resp, res.err = r.dispatchGetByReservationOrder(req) + case "ReservationsClient.NewListByBillingAccountPager": + res.resp, res.err = r.dispatchNewListByBillingAccountPager(req) + case "ReservationsClient.NewListByBillingProfilePager": + res.resp, res.err = r.dispatchNewListByBillingProfilePager(req) + case "ReservationsClient.NewListByReservationOrderPager": + res.resp, res.err = r.dispatchNewListByReservationOrderPager(req) + case "ReservationsClient.BeginUpdateByBillingAccount": + res.resp, res.err = r.dispatchBeginUpdateByBillingAccount(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ReservationsServerTransport) dispatchGetByReservationOrder(req *http.Request) (*http.Response, error) { @@ -442,3 +457,9 @@ func (r *ReservationsServerTransport) dispatchBeginUpdateByBillingAccount(req *h return resp, nil } + +// set this to conditionally intercept incoming requests to ReservationsServerTransport +var reservationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go b/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go index 6cd5e183100a..ca1242c5c921 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/roleassignments_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // RoleAssignmentsServer is a fake server for instances of the armbilling.RoleAssignmentsClient type. @@ -200,77 +196,96 @@ func (r *RoleAssignmentsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "RoleAssignmentsClient.BeginCreateByBillingAccount": - resp, err = r.dispatchBeginCreateByBillingAccount(req) - case "RoleAssignmentsClient.BeginCreateByBillingProfile": - resp, err = r.dispatchBeginCreateByBillingProfile(req) - case "RoleAssignmentsClient.BeginCreateByCustomer": - resp, err = r.dispatchBeginCreateByCustomer(req) - case "RoleAssignmentsClient.BeginCreateByInvoiceSection": - resp, err = r.dispatchBeginCreateByInvoiceSection(req) - case "RoleAssignmentsClient.BeginCreateOrUpdateByBillingAccount": - resp, err = r.dispatchBeginCreateOrUpdateByBillingAccount(req) - case "RoleAssignmentsClient.BeginCreateOrUpdateByDepartment": - resp, err = r.dispatchBeginCreateOrUpdateByDepartment(req) - case "RoleAssignmentsClient.BeginCreateOrUpdateByEnrollmentAccount": - resp, err = r.dispatchBeginCreateOrUpdateByEnrollmentAccount(req) - case "RoleAssignmentsClient.DeleteByBillingAccount": - resp, err = r.dispatchDeleteByBillingAccount(req) - case "RoleAssignmentsClient.DeleteByBillingProfile": - resp, err = r.dispatchDeleteByBillingProfile(req) - case "RoleAssignmentsClient.DeleteByCustomer": - resp, err = r.dispatchDeleteByCustomer(req) - case "RoleAssignmentsClient.DeleteByDepartment": - resp, err = r.dispatchDeleteByDepartment(req) - case "RoleAssignmentsClient.DeleteByEnrollmentAccount": - resp, err = r.dispatchDeleteByEnrollmentAccount(req) - case "RoleAssignmentsClient.DeleteByInvoiceSection": - resp, err = r.dispatchDeleteByInvoiceSection(req) - case "RoleAssignmentsClient.GetByBillingAccount": - resp, err = r.dispatchGetByBillingAccount(req) - case "RoleAssignmentsClient.GetByBillingProfile": - resp, err = r.dispatchGetByBillingProfile(req) - case "RoleAssignmentsClient.GetByCustomer": - resp, err = r.dispatchGetByCustomer(req) - case "RoleAssignmentsClient.GetByDepartment": - resp, err = r.dispatchGetByDepartment(req) - case "RoleAssignmentsClient.GetByEnrollmentAccount": - resp, err = r.dispatchGetByEnrollmentAccount(req) - case "RoleAssignmentsClient.GetByInvoiceSection": - resp, err = r.dispatchGetByInvoiceSection(req) - case "RoleAssignmentsClient.NewListByBillingAccountPager": - resp, err = r.dispatchNewListByBillingAccountPager(req) - case "RoleAssignmentsClient.NewListByBillingProfilePager": - resp, err = r.dispatchNewListByBillingProfilePager(req) - case "RoleAssignmentsClient.NewListByCustomerPager": - resp, err = r.dispatchNewListByCustomerPager(req) - case "RoleAssignmentsClient.NewListByDepartmentPager": - resp, err = r.dispatchNewListByDepartmentPager(req) - case "RoleAssignmentsClient.NewListByEnrollmentAccountPager": - resp, err = r.dispatchNewListByEnrollmentAccountPager(req) - case "RoleAssignmentsClient.NewListByInvoiceSectionPager": - resp, err = r.dispatchNewListByInvoiceSectionPager(req) - case "RoleAssignmentsClient.BeginResolveByBillingAccount": - resp, err = r.dispatchBeginResolveByBillingAccount(req) - case "RoleAssignmentsClient.BeginResolveByBillingProfile": - resp, err = r.dispatchBeginResolveByBillingProfile(req) - case "RoleAssignmentsClient.BeginResolveByCustomer": - resp, err = r.dispatchBeginResolveByCustomer(req) - case "RoleAssignmentsClient.BeginResolveByInvoiceSection": - resp, err = r.dispatchBeginResolveByInvoiceSection(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return r.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (r *RoleAssignmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if roleAssignmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = roleAssignmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RoleAssignmentsClient.BeginCreateByBillingAccount": + res.resp, res.err = r.dispatchBeginCreateByBillingAccount(req) + case "RoleAssignmentsClient.BeginCreateByBillingProfile": + res.resp, res.err = r.dispatchBeginCreateByBillingProfile(req) + case "RoleAssignmentsClient.BeginCreateByCustomer": + res.resp, res.err = r.dispatchBeginCreateByCustomer(req) + case "RoleAssignmentsClient.BeginCreateByInvoiceSection": + res.resp, res.err = r.dispatchBeginCreateByInvoiceSection(req) + case "RoleAssignmentsClient.BeginCreateOrUpdateByBillingAccount": + res.resp, res.err = r.dispatchBeginCreateOrUpdateByBillingAccount(req) + case "RoleAssignmentsClient.BeginCreateOrUpdateByDepartment": + res.resp, res.err = r.dispatchBeginCreateOrUpdateByDepartment(req) + case "RoleAssignmentsClient.BeginCreateOrUpdateByEnrollmentAccount": + res.resp, res.err = r.dispatchBeginCreateOrUpdateByEnrollmentAccount(req) + case "RoleAssignmentsClient.DeleteByBillingAccount": + res.resp, res.err = r.dispatchDeleteByBillingAccount(req) + case "RoleAssignmentsClient.DeleteByBillingProfile": + res.resp, res.err = r.dispatchDeleteByBillingProfile(req) + case "RoleAssignmentsClient.DeleteByCustomer": + res.resp, res.err = r.dispatchDeleteByCustomer(req) + case "RoleAssignmentsClient.DeleteByDepartment": + res.resp, res.err = r.dispatchDeleteByDepartment(req) + case "RoleAssignmentsClient.DeleteByEnrollmentAccount": + res.resp, res.err = r.dispatchDeleteByEnrollmentAccount(req) + case "RoleAssignmentsClient.DeleteByInvoiceSection": + res.resp, res.err = r.dispatchDeleteByInvoiceSection(req) + case "RoleAssignmentsClient.GetByBillingAccount": + res.resp, res.err = r.dispatchGetByBillingAccount(req) + case "RoleAssignmentsClient.GetByBillingProfile": + res.resp, res.err = r.dispatchGetByBillingProfile(req) + case "RoleAssignmentsClient.GetByCustomer": + res.resp, res.err = r.dispatchGetByCustomer(req) + case "RoleAssignmentsClient.GetByDepartment": + res.resp, res.err = r.dispatchGetByDepartment(req) + case "RoleAssignmentsClient.GetByEnrollmentAccount": + res.resp, res.err = r.dispatchGetByEnrollmentAccount(req) + case "RoleAssignmentsClient.GetByInvoiceSection": + res.resp, res.err = r.dispatchGetByInvoiceSection(req) + case "RoleAssignmentsClient.NewListByBillingAccountPager": + res.resp, res.err = r.dispatchNewListByBillingAccountPager(req) + case "RoleAssignmentsClient.NewListByBillingProfilePager": + res.resp, res.err = r.dispatchNewListByBillingProfilePager(req) + case "RoleAssignmentsClient.NewListByCustomerPager": + res.resp, res.err = r.dispatchNewListByCustomerPager(req) + case "RoleAssignmentsClient.NewListByDepartmentPager": + res.resp, res.err = r.dispatchNewListByDepartmentPager(req) + case "RoleAssignmentsClient.NewListByEnrollmentAccountPager": + res.resp, res.err = r.dispatchNewListByEnrollmentAccountPager(req) + case "RoleAssignmentsClient.NewListByInvoiceSectionPager": + res.resp, res.err = r.dispatchNewListByInvoiceSectionPager(req) + case "RoleAssignmentsClient.BeginResolveByBillingAccount": + res.resp, res.err = r.dispatchBeginResolveByBillingAccount(req) + case "RoleAssignmentsClient.BeginResolveByBillingProfile": + res.resp, res.err = r.dispatchBeginResolveByBillingProfile(req) + case "RoleAssignmentsClient.BeginResolveByCustomer": + res.resp, res.err = r.dispatchBeginResolveByCustomer(req) + case "RoleAssignmentsClient.BeginResolveByInvoiceSection": + res.resp, res.err = r.dispatchBeginResolveByInvoiceSection(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RoleAssignmentsServerTransport) dispatchBeginCreateByBillingAccount(req *http.Request) (*http.Response, error) { @@ -1754,3 +1769,9 @@ func (r *RoleAssignmentsServerTransport) dispatchBeginResolveByInvoiceSection(re return resp, nil } + +// set this to conditionally intercept incoming requests to RoleAssignmentsServerTransport +var roleAssignmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go b/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go index efba7d35d9a8..cf67fb1cc6f8 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/roledefinition_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // RoleDefinitionServer is a fake server for instances of the armbilling.RoleDefinitionClient type. @@ -109,43 +105,62 @@ func (r *RoleDefinitionServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "RoleDefinitionClient.GetByBillingAccount": - resp, err = r.dispatchGetByBillingAccount(req) - case "RoleDefinitionClient.GetByBillingProfile": - resp, err = r.dispatchGetByBillingProfile(req) - case "RoleDefinitionClient.GetByCustomer": - resp, err = r.dispatchGetByCustomer(req) - case "RoleDefinitionClient.GetByDepartment": - resp, err = r.dispatchGetByDepartment(req) - case "RoleDefinitionClient.GetByEnrollmentAccount": - resp, err = r.dispatchGetByEnrollmentAccount(req) - case "RoleDefinitionClient.GetByInvoiceSection": - resp, err = r.dispatchGetByInvoiceSection(req) - case "RoleDefinitionClient.NewListByBillingAccountPager": - resp, err = r.dispatchNewListByBillingAccountPager(req) - case "RoleDefinitionClient.NewListByBillingProfilePager": - resp, err = r.dispatchNewListByBillingProfilePager(req) - case "RoleDefinitionClient.NewListByCustomerPager": - resp, err = r.dispatchNewListByCustomerPager(req) - case "RoleDefinitionClient.NewListByDepartmentPager": - resp, err = r.dispatchNewListByDepartmentPager(req) - case "RoleDefinitionClient.NewListByEnrollmentAccountPager": - resp, err = r.dispatchNewListByEnrollmentAccountPager(req) - case "RoleDefinitionClient.NewListByInvoiceSectionPager": - resp, err = r.dispatchNewListByInvoiceSectionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return r.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (r *RoleDefinitionServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if roleDefinitionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = roleDefinitionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RoleDefinitionClient.GetByBillingAccount": + res.resp, res.err = r.dispatchGetByBillingAccount(req) + case "RoleDefinitionClient.GetByBillingProfile": + res.resp, res.err = r.dispatchGetByBillingProfile(req) + case "RoleDefinitionClient.GetByCustomer": + res.resp, res.err = r.dispatchGetByCustomer(req) + case "RoleDefinitionClient.GetByDepartment": + res.resp, res.err = r.dispatchGetByDepartment(req) + case "RoleDefinitionClient.GetByEnrollmentAccount": + res.resp, res.err = r.dispatchGetByEnrollmentAccount(req) + case "RoleDefinitionClient.GetByInvoiceSection": + res.resp, res.err = r.dispatchGetByInvoiceSection(req) + case "RoleDefinitionClient.NewListByBillingAccountPager": + res.resp, res.err = r.dispatchNewListByBillingAccountPager(req) + case "RoleDefinitionClient.NewListByBillingProfilePager": + res.resp, res.err = r.dispatchNewListByBillingProfilePager(req) + case "RoleDefinitionClient.NewListByCustomerPager": + res.resp, res.err = r.dispatchNewListByCustomerPager(req) + case "RoleDefinitionClient.NewListByDepartmentPager": + res.resp, res.err = r.dispatchNewListByDepartmentPager(req) + case "RoleDefinitionClient.NewListByEnrollmentAccountPager": + res.resp, res.err = r.dispatchNewListByEnrollmentAccountPager(req) + case "RoleDefinitionClient.NewListByInvoiceSectionPager": + res.resp, res.err = r.dispatchNewListByInvoiceSectionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RoleDefinitionServerTransport) dispatchGetByBillingAccount(req *http.Request) (*http.Response, error) { @@ -623,3 +638,9 @@ func (r *RoleDefinitionServerTransport) dispatchNewListByInvoiceSectionPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to RoleDefinitionServerTransport +var roleDefinitionServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go b/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go index 264001d165e1..bc0adc0d8e72 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/savingsplanorders_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // SavingsPlanOrdersServer is a fake server for instances of the armbilling.SavingsPlanOrdersClient type. @@ -60,23 +56,42 @@ func (s *SavingsPlanOrdersServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SavingsPlanOrdersClient.GetByBillingAccount": - resp, err = s.dispatchGetByBillingAccount(req) - case "SavingsPlanOrdersClient.NewListByBillingAccountPager": - resp, err = s.dispatchNewListByBillingAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SavingsPlanOrdersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if savingsPlanOrdersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = savingsPlanOrdersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SavingsPlanOrdersClient.GetByBillingAccount": + res.resp, res.err = s.dispatchGetByBillingAccount(req) + case "SavingsPlanOrdersClient.NewListByBillingAccountPager": + res.resp, res.err = s.dispatchNewListByBillingAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SavingsPlanOrdersServerTransport) dispatchGetByBillingAccount(req *http.Request) (*http.Response, error) { @@ -193,3 +208,9 @@ func (s *SavingsPlanOrdersServerTransport) dispatchNewListByBillingAccountPager( } return resp, nil } + +// set this to conditionally intercept incoming requests to SavingsPlanOrdersServerTransport +var savingsPlanOrdersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go b/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go index 13cf494113e3..8270e05eb2c3 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/savingsplans_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // SavingsPlansServer is a fake server for instances of the armbilling.SavingsPlansClient type. @@ -76,29 +72,48 @@ func (s *SavingsPlansServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SavingsPlansClient.GetByBillingAccount": - resp, err = s.dispatchGetByBillingAccount(req) - case "SavingsPlansClient.NewListByBillingAccountPager": - resp, err = s.dispatchNewListByBillingAccountPager(req) - case "SavingsPlansClient.NewListBySavingsPlanOrderPager": - resp, err = s.dispatchNewListBySavingsPlanOrderPager(req) - case "SavingsPlansClient.BeginUpdateByBillingAccount": - resp, err = s.dispatchBeginUpdateByBillingAccount(req) - case "SavingsPlansClient.ValidateUpdateByBillingAccount": - resp, err = s.dispatchValidateUpdateByBillingAccount(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SavingsPlansServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if savingsPlansServerTransportInterceptor != nil { + res.resp, res.err, intercepted = savingsPlansServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SavingsPlansClient.GetByBillingAccount": + res.resp, res.err = s.dispatchGetByBillingAccount(req) + case "SavingsPlansClient.NewListByBillingAccountPager": + res.resp, res.err = s.dispatchNewListByBillingAccountPager(req) + case "SavingsPlansClient.NewListBySavingsPlanOrderPager": + res.resp, res.err = s.dispatchNewListBySavingsPlanOrderPager(req) + case "SavingsPlansClient.BeginUpdateByBillingAccount": + res.resp, res.err = s.dispatchBeginUpdateByBillingAccount(req) + case "SavingsPlansClient.ValidateUpdateByBillingAccount": + res.resp, res.err = s.dispatchValidateUpdateByBillingAccount(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SavingsPlansServerTransport) dispatchGetByBillingAccount(req *http.Request) (*http.Response, error) { @@ -380,3 +395,9 @@ func (s *SavingsPlansServerTransport) dispatchValidateUpdateByBillingAccount(req } return resp, nil } + +// set this to conditionally intercept incoming requests to SavingsPlansServerTransport +var savingsPlansServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/server_factory.go b/sdk/resourcemanager/billing/armbilling/fake/server_factory.go index cdcb20d52a1a..108938f97f24 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/server_factory.go +++ b/sdk/resourcemanager/billing/armbilling/fake/server_factory.go @@ -1,6 +1,3 @@ -//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. @@ -11,45 +8,103 @@ 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. type ServerFactory struct { - AccountsServer AccountsServer - AddressServer AddressServer - AgreementsServer AgreementsServer - AssociatedTenantsServer AssociatedTenantsServer - AvailableBalancesServer AvailableBalancesServer - CustomersServer CustomersServer - DepartmentsServer DepartmentsServer - EnrollmentAccountsServer EnrollmentAccountsServer - InvoiceSectionsServer InvoiceSectionsServer - InvoicesServer InvoicesServer - OperationsServer OperationsServer - PartnerTransfersServer PartnerTransfersServer - PaymentMethodsServer PaymentMethodsServer - PermissionsServer PermissionsServer - PoliciesServer PoliciesServer - ProductsServer ProductsServer - ProfilesServer ProfilesServer - PropertyServer PropertyServer - RecipientTransfersServer RecipientTransfersServer - RequestsServer RequestsServer - ReservationOrdersServer ReservationOrdersServer - ReservationsServer ReservationsServer - RoleAssignmentsServer RoleAssignmentsServer - RoleDefinitionServer RoleDefinitionServer - SavingsPlanOrdersServer SavingsPlanOrdersServer - SavingsPlansServer SavingsPlansServer + // AccountsServer contains the fakes for client AccountsClient + AccountsServer AccountsServer + + // AddressServer contains the fakes for client AddressClient + AddressServer AddressServer + + // AgreementsServer contains the fakes for client AgreementsClient + AgreementsServer AgreementsServer + + // AssociatedTenantsServer contains the fakes for client AssociatedTenantsClient + AssociatedTenantsServer AssociatedTenantsServer + + // AvailableBalancesServer contains the fakes for client AvailableBalancesClient + AvailableBalancesServer AvailableBalancesServer + + // CustomersServer contains the fakes for client CustomersClient + CustomersServer CustomersServer + + // DepartmentsServer contains the fakes for client DepartmentsClient + DepartmentsServer DepartmentsServer + + // EnrollmentAccountsServer contains the fakes for client EnrollmentAccountsClient + EnrollmentAccountsServer EnrollmentAccountsServer + + // InvoiceSectionsServer contains the fakes for client InvoiceSectionsClient + InvoiceSectionsServer InvoiceSectionsServer + + // InvoicesServer contains the fakes for client InvoicesClient + InvoicesServer InvoicesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PartnerTransfersServer contains the fakes for client PartnerTransfersClient + PartnerTransfersServer PartnerTransfersServer + + // PaymentMethodsServer contains the fakes for client PaymentMethodsClient + PaymentMethodsServer PaymentMethodsServer + + // PermissionsServer contains the fakes for client PermissionsClient + PermissionsServer PermissionsServer + + // PoliciesServer contains the fakes for client PoliciesClient + PoliciesServer PoliciesServer + + // ProductsServer contains the fakes for client ProductsClient + ProductsServer ProductsServer + + // ProfilesServer contains the fakes for client ProfilesClient + ProfilesServer ProfilesServer + + // PropertyServer contains the fakes for client PropertyClient + PropertyServer PropertyServer + + // RecipientTransfersServer contains the fakes for client RecipientTransfersClient + RecipientTransfersServer RecipientTransfersServer + + // RequestsServer contains the fakes for client RequestsClient + RequestsServer RequestsServer + + // ReservationOrdersServer contains the fakes for client ReservationOrdersClient + ReservationOrdersServer ReservationOrdersServer + + // ReservationsServer contains the fakes for client ReservationsClient + ReservationsServer ReservationsServer + + // RoleAssignmentsServer contains the fakes for client RoleAssignmentsClient + RoleAssignmentsServer RoleAssignmentsServer + + // RoleDefinitionServer contains the fakes for client RoleDefinitionClient + RoleDefinitionServer RoleDefinitionServer + + // SavingsPlanOrdersServer contains the fakes for client SavingsPlanOrdersClient + SavingsPlanOrdersServer SavingsPlanOrdersServer + + // SavingsPlansServer contains the fakes for client SavingsPlansClient + SavingsPlansServer SavingsPlansServer + + // SubscriptionsAliasesServer contains the fakes for client SubscriptionsAliasesClient SubscriptionsAliasesServer SubscriptionsAliasesServer - SubscriptionsServer SubscriptionsServer - TransactionsServer TransactionsServer - TransfersServer TransfersServer + + // SubscriptionsServer contains the fakes for client SubscriptionsClient + SubscriptionsServer SubscriptionsServer + + // TransactionsServer contains the fakes for client TransactionsClient + TransactionsServer TransactionsServer + + // TransfersServer contains the fakes for client TransfersClient + TransfersServer TransfersServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go b/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go index c2cb050def6b..dfd727fed851 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/subscriptions_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,26 +9,25 @@ 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" + "net/http" + "net/url" + "regexp" + "strconv" ) // SubscriptionsServer is a fake server for instances of the armbilling.SubscriptionsClient type. type SubscriptionsServer struct { // BeginCancel is the fake for method SubscriptionsClient.BeginCancel - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginCancel func(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters armbilling.CancelSubscriptionRequest, options *armbilling.SubscriptionsClientBeginCancelOptions) (resp azfake.PollerResponder[armbilling.SubscriptionsClientCancelResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SubscriptionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, billingAccountName string, billingSubscriptionName string, options *armbilling.SubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armbilling.SubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SubscriptionsClient.Get @@ -134,49 +130,68 @@ func (s *SubscriptionsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SubscriptionsClient.BeginCancel": - resp, err = s.dispatchBeginCancel(req) - case "SubscriptionsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SubscriptionsClient.Get": - resp, err = s.dispatchGet(req) - case "SubscriptionsClient.GetByBillingProfile": - resp, err = s.dispatchGetByBillingProfile(req) - case "SubscriptionsClient.NewListByBillingAccountPager": - resp, err = s.dispatchNewListByBillingAccountPager(req) - case "SubscriptionsClient.NewListByBillingProfilePager": - resp, err = s.dispatchNewListByBillingProfilePager(req) - case "SubscriptionsClient.NewListByCustomerPager": - resp, err = s.dispatchNewListByCustomerPager(req) - case "SubscriptionsClient.NewListByCustomerAtBillingAccountPager": - resp, err = s.dispatchNewListByCustomerAtBillingAccountPager(req) - case "SubscriptionsClient.NewListByEnrollmentAccountPager": - resp, err = s.dispatchNewListByEnrollmentAccountPager(req) - case "SubscriptionsClient.NewListByInvoiceSectionPager": - resp, err = s.dispatchNewListByInvoiceSectionPager(req) - case "SubscriptionsClient.BeginMerge": - resp, err = s.dispatchBeginMerge(req) - case "SubscriptionsClient.BeginMove": - resp, err = s.dispatchBeginMove(req) - case "SubscriptionsClient.BeginSplit": - resp, err = s.dispatchBeginSplit(req) - case "SubscriptionsClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - case "SubscriptionsClient.ValidateMoveEligibility": - resp, err = s.dispatchValidateMoveEligibility(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SubscriptionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if subscriptionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = subscriptionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SubscriptionsClient.BeginCancel": + res.resp, res.err = s.dispatchBeginCancel(req) + case "SubscriptionsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SubscriptionsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SubscriptionsClient.GetByBillingProfile": + res.resp, res.err = s.dispatchGetByBillingProfile(req) + case "SubscriptionsClient.NewListByBillingAccountPager": + res.resp, res.err = s.dispatchNewListByBillingAccountPager(req) + case "SubscriptionsClient.NewListByBillingProfilePager": + res.resp, res.err = s.dispatchNewListByBillingProfilePager(req) + case "SubscriptionsClient.NewListByCustomerPager": + res.resp, res.err = s.dispatchNewListByCustomerPager(req) + case "SubscriptionsClient.NewListByCustomerAtBillingAccountPager": + res.resp, res.err = s.dispatchNewListByCustomerAtBillingAccountPager(req) + case "SubscriptionsClient.NewListByEnrollmentAccountPager": + res.resp, res.err = s.dispatchNewListByEnrollmentAccountPager(req) + case "SubscriptionsClient.NewListByInvoiceSectionPager": + res.resp, res.err = s.dispatchNewListByInvoiceSectionPager(req) + case "SubscriptionsClient.BeginMerge": + res.resp, res.err = s.dispatchBeginMerge(req) + case "SubscriptionsClient.BeginMove": + res.resp, res.err = s.dispatchBeginMove(req) + case "SubscriptionsClient.BeginSplit": + res.resp, res.err = s.dispatchBeginSplit(req) + case "SubscriptionsClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + case "SubscriptionsClient.ValidateMoveEligibility": + res.resp, res.err = s.dispatchValidateMoveEligibility(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SubscriptionsServerTransport) dispatchBeginCancel(req *http.Request) (*http.Response, error) { @@ -216,9 +231,9 @@ func (s *SubscriptionsServerTransport) dispatchBeginCancel(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginCancel.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginCancel) { s.beginCancel.remove(req) @@ -260,9 +275,9 @@ func (s *SubscriptionsServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -1314,3 +1329,9 @@ func (s *SubscriptionsServerTransport) dispatchValidateMoveEligibility(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to SubscriptionsServerTransport +var subscriptionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go b/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go index 55a2852f6a39..418cc8b56090 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/subscriptionsaliases_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,16 +9,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" + "net/http" + "net/url" + "regexp" + "strconv" ) // SubscriptionsAliasesServer is a fake server for instances of the armbilling.SubscriptionsAliasesClient type. @@ -66,25 +62,44 @@ func (s *SubscriptionsAliasesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SubscriptionsAliasesClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "SubscriptionsAliasesClient.Get": - resp, err = s.dispatchGet(req) - case "SubscriptionsAliasesClient.NewListByBillingAccountPager": - resp, err = s.dispatchNewListByBillingAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SubscriptionsAliasesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if subscriptionsAliasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = subscriptionsAliasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SubscriptionsAliasesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SubscriptionsAliasesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SubscriptionsAliasesClient.NewListByBillingAccountPager": + res.resp, res.err = s.dispatchNewListByBillingAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SubscriptionsAliasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -276,3 +291,9 @@ func (s *SubscriptionsAliasesServerTransport) dispatchNewListByBillingAccountPag } return resp, nil } + +// set this to conditionally intercept incoming requests to SubscriptionsAliasesServerTransport +var subscriptionsAliasesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go b/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go index ade6004b9922..7691a451714b 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go +++ b/sdk/resourcemanager/billing/armbilling/fake/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -11,12 +8,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. @@ -61,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go b/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go index 370191bb27e1..847f0310fd4f 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/transactions_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,17 +9,16 @@ import ( "context" "errors" "fmt" - "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" + "net/http" + "net/url" + "regexp" + "strconv" + "time" ) // TransactionsServer is a fake server for instances of the armbilling.TransactionsClient type. @@ -85,31 +81,50 @@ func (t *TransactionsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TransactionsClient.GetTransactionSummaryByInvoice": - resp, err = t.dispatchGetTransactionSummaryByInvoice(req) - case "TransactionsClient.NewListByBillingProfilePager": - resp, err = t.dispatchNewListByBillingProfilePager(req) - case "TransactionsClient.NewListByCustomerPager": - resp, err = t.dispatchNewListByCustomerPager(req) - case "TransactionsClient.NewListByInvoicePager": - resp, err = t.dispatchNewListByInvoicePager(req) - case "TransactionsClient.NewListByInvoiceSectionPager": - resp, err = t.dispatchNewListByInvoiceSectionPager(req) - case "TransactionsClient.BeginTransactionsDownloadByInvoice": - resp, err = t.dispatchBeginTransactionsDownloadByInvoice(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TransactionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if transactionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = transactionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TransactionsClient.GetTransactionSummaryByInvoice": + res.resp, res.err = t.dispatchGetTransactionSummaryByInvoice(req) + case "TransactionsClient.NewListByBillingProfilePager": + res.resp, res.err = t.dispatchNewListByBillingProfilePager(req) + case "TransactionsClient.NewListByCustomerPager": + res.resp, res.err = t.dispatchNewListByCustomerPager(req) + case "TransactionsClient.NewListByInvoicePager": + res.resp, res.err = t.dispatchNewListByInvoicePager(req) + case "TransactionsClient.NewListByInvoiceSectionPager": + res.resp, res.err = t.dispatchNewListByInvoiceSectionPager(req) + case "TransactionsClient.BeginTransactionsDownloadByInvoice": + res.resp, res.err = t.dispatchBeginTransactionsDownloadByInvoice(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (t *TransactionsServerTransport) dispatchGetTransactionSummaryByInvoice(req *http.Request) (*http.Response, error) { @@ -708,3 +723,9 @@ func (t *TransactionsServerTransport) dispatchBeginTransactionsDownloadByInvoice return resp, nil } + +// set this to conditionally intercept incoming requests to TransactionsServerTransport +var transactionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go b/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go index fd1ccaf0faf1..89e03b97f3ff 100644 --- a/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go +++ b/sdk/resourcemanager/billing/armbilling/fake/transfers_server.go @@ -1,6 +1,3 @@ -//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. @@ -12,15 +9,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" + "net/http" + "net/url" + "regexp" ) // TransfersServer is a fake server for instances of the armbilling.TransfersClient type. @@ -67,27 +63,46 @@ func (t *TransfersServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TransfersClient.Cancel": - resp, err = t.dispatchCancel(req) - case "TransfersClient.Get": - resp, err = t.dispatchGet(req) - case "TransfersClient.Initiate": - resp, err = t.dispatchInitiate(req) - case "TransfersClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TransfersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if transfersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = transfersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TransfersClient.Cancel": + res.resp, res.err = t.dispatchCancel(req) + case "TransfersClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TransfersClient.Initiate": + res.resp, res.err = t.dispatchInitiate(req) + case "TransfersClient.NewListPager": + res.resp, res.err = t.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (t *TransfersServerTransport) dispatchCancel(req *http.Request) (*http.Response, error) { @@ -261,3 +276,9 @@ func (t *TransfersServerTransport) dispatchNewListPager(req *http.Request) (*htt } return resp, nil } + +// set this to conditionally intercept incoming requests to TransfersServerTransport +var transfersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/billing/armbilling/go.mod b/sdk/resourcemanager/billing/armbilling/go.mod index 763d72275226..32f7c8709c50 100644 --- a/sdk/resourcemanager/billing/armbilling/go.mod +++ b/sdk/resourcemanager/billing/armbilling/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling go 1.23.0 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // 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.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/billing/armbilling/go.sum b/sdk/resourcemanager/billing/armbilling/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/billing/armbilling/go.sum +++ b/sdk/resourcemanager/billing/armbilling/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= 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-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/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/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= 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..437894b1b097 100644 --- a/sdk/resourcemanager/billing/armbilling/invoices_client.go +++ b/sdk/resourcemanager/billing/armbilling/invoices_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -98,7 +94,7 @@ func (client *InvoicesClient) amend(ctx context.Context, billingAccountName stri } // amendCreateRequest creates the Amend request. -func (client *InvoicesClient) amendCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, options *InvoicesClientBeginAmendOptions) (*policy.Request, error) { +func (client *InvoicesClient) amendCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, _ *InvoicesClientBeginAmendOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/amend" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -330,7 +326,7 @@ func (client *InvoicesClient) downloadDocumentsByBillingAccount(ctx context.Cont } // downloadDocumentsByBillingAccountCreateRequest creates the DownloadDocumentsByBillingAccount request. -func (client *InvoicesClient) downloadDocumentsByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters []*DocumentDownloadRequest, options *InvoicesClientBeginDownloadDocumentsByBillingAccountOptions) (*policy.Request, error) { +func (client *InvoicesClient) downloadDocumentsByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters []*DocumentDownloadRequest, _ *InvoicesClientBeginDownloadDocumentsByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -405,7 +401,7 @@ func (client *InvoicesClient) downloadDocumentsByBillingSubscription(ctx context } // downloadDocumentsByBillingSubscriptionCreateRequest creates the DownloadDocumentsByBillingSubscription request. -func (client *InvoicesClient) downloadDocumentsByBillingSubscriptionCreateRequest(ctx context.Context, parameters []*DocumentDownloadRequest, options *InvoicesClientBeginDownloadDocumentsByBillingSubscriptionOptions) (*policy.Request, error) { +func (client *InvoicesClient) downloadDocumentsByBillingSubscriptionCreateRequest(ctx context.Context, parameters []*DocumentDownloadRequest, _ *InvoicesClientBeginDownloadDocumentsByBillingSubscriptionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -479,7 +475,7 @@ func (client *InvoicesClient) downloadSummaryByBillingAccount(ctx context.Contex } // downloadSummaryByBillingAccountCreateRequest creates the DownloadSummaryByBillingAccount request. -func (client *InvoicesClient) downloadSummaryByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, options *InvoicesClientBeginDownloadSummaryByBillingAccountOptions) (*policy.Request, error) { +func (client *InvoicesClient) downloadSummaryByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, _ *InvoicesClientBeginDownloadSummaryByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/downloadSummary" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -530,7 +526,7 @@ func (client *InvoicesClient) Get(ctx context.Context, invoiceName string, optio } // getCreateRequest creates the Get request. -func (client *InvoicesClient) getCreateRequest(ctx context.Context, invoiceName string, options *InvoicesClientGetOptions) (*policy.Request, error) { +func (client *InvoicesClient) getCreateRequest(ctx context.Context, invoiceName string, _ *InvoicesClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}" if invoiceName == "" { return nil, errors.New("parameter invoiceName cannot be empty") @@ -588,7 +584,7 @@ func (client *InvoicesClient) GetByBillingAccount(ctx context.Context, billingAc } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *InvoicesClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, options *InvoicesClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *InvoicesClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, _ *InvoicesClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -649,7 +645,7 @@ func (client *InvoicesClient) GetByBillingSubscription(ctx context.Context, invo } // getByBillingSubscriptionCreateRequest creates the GetByBillingSubscription request. -func (client *InvoicesClient) getByBillingSubscriptionCreateRequest(ctx context.Context, invoiceName string, options *InvoicesClientGetByBillingSubscriptionOptions) (*policy.Request, error) { +func (client *InvoicesClient) getByBillingSubscriptionCreateRequest(ctx context.Context, invoiceName string, _ *InvoicesClientGetByBillingSubscriptionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") 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..fec70d25c366 100644 --- a/sdk/resourcemanager/billing/armbilling/invoicesections_client.go +++ b/sdk/resourcemanager/billing/armbilling/invoicesections_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -98,7 +94,7 @@ func (client *InvoiceSectionsClient) createOrUpdate(ctx context.Context, billing } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *InvoiceSectionsClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters InvoiceSection, options *InvoiceSectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *InvoiceSectionsClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters InvoiceSection, _ *InvoiceSectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -181,7 +177,7 @@ func (client *InvoiceSectionsClient) deleteOperation(ctx context.Context, billin } // deleteCreateRequest creates the Delete request. -func (client *InvoiceSectionsClient) deleteCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *InvoiceSectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *InvoiceSectionsClient) deleteCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, _ *InvoiceSectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -238,7 +234,7 @@ func (client *InvoiceSectionsClient) Get(ctx context.Context, billingAccountName } // getCreateRequest creates the Get request. -func (client *InvoiceSectionsClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *InvoiceSectionsClientGetOptions) (*policy.Request, error) { +func (client *InvoiceSectionsClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, _ *InvoiceSectionsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -388,7 +384,7 @@ func (client *InvoiceSectionsClient) ValidateDeleteEligibility(ctx context.Conte } // validateDeleteEligibilityCreateRequest creates the ValidateDeleteEligibility request. -func (client *InvoiceSectionsClient) validateDeleteEligibilityCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *InvoiceSectionsClientValidateDeleteEligibilityOptions) (*policy.Request, error) { +func (client *InvoiceSectionsClient) validateDeleteEligibilityCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, _ *InvoiceSectionsClientValidateDeleteEligibilityOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/validateDeleteEligibility" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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.go b/sdk/resourcemanager/billing/armbilling/models.go index 89c0d9b90384..2ef5b1d6c5a0 100644 --- a/sdk/resourcemanager/billing/armbilling/models.go +++ b/sdk/resourcemanager/billing/armbilling/models.go @@ -1,6 +1,3 @@ -//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. @@ -4356,7 +4353,7 @@ type SubscriptionAliasProperties struct { NextBillingCycleDetails *NextBillingCycleDetails // READ-ONLY; The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing - // accounts. + // accounts or billing accounts with agreement type Enterprise Agreement. OfferID *string // READ-ONLY; The status of an operation on the subscription. When None, there is no ongoing operation. When LockedForUpdate, @@ -4599,7 +4596,7 @@ type SubscriptionProperties struct { NextBillingCycleDetails *NextBillingCycleDetails // READ-ONLY; The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing - // accounts. + // accounts or billing accounts with agreement type Enterprise Agreement. OfferID *string // READ-ONLY; The status of an operation on the subscription. When None, there is no ongoing operation. When LockedForUpdate, diff --git a/sdk/resourcemanager/billing/armbilling/models_serde.go b/sdk/resourcemanager/billing/armbilling/models_serde.go index dab5acdc9953..1ed4e6c9ea50 100644 --- a/sdk/resourcemanager/billing/armbilling/models_serde.go +++ b/sdk/resourcemanager/billing/armbilling/models_serde.go @@ -1,6 +1,3 @@ -//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. @@ -11,9 +8,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..d94f3c8fcd58 100644 --- a/sdk/resourcemanager/billing/armbilling/operations_client.go +++ b/sdk/resourcemanager/billing/armbilling/operations_client.go @@ -1,6 +1,3 @@ -//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. @@ -10,12 +7,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. @@ -66,7 +62,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { 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..ab4f5cfcda4b 100644 --- a/sdk/resourcemanager/billing/armbilling/options.go +++ b/sdk/resourcemanager/billing/armbilling/options.go @@ -1,6 +1,3 @@ -//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. @@ -13,20 +10,20 @@ import "time" // AccountsClientBeginAddPaymentTermsOptions contains the optional parameters for the AccountsClient.BeginAddPaymentTerms // method. type AccountsClientBeginAddPaymentTermsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AccountsClientBeginCancelPaymentTermsOptions contains the optional parameters for the AccountsClient.BeginCancelPaymentTerms // method. type AccountsClientBeginCancelPaymentTermsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. type AccountsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -120,14 +117,14 @@ type AgreementsClientListByBillingAccountOptions struct { // AssociatedTenantsClientBeginCreateOrUpdateOptions contains the optional parameters for the AssociatedTenantsClient.BeginCreateOrUpdate // method. type AssociatedTenantsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AssociatedTenantsClientBeginDeleteOptions contains the optional parameters for the AssociatedTenantsClient.BeginDelete // method. type AssociatedTenantsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -334,13 +331,13 @@ type EnrollmentAccountsClientListByDepartmentOptions struct { // InvoiceSectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the InvoiceSectionsClient.BeginCreateOrUpdate // method. type InvoiceSectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // InvoiceSectionsClientBeginDeleteOptions contains the optional parameters for the InvoiceSectionsClient.BeginDelete method. type InvoiceSectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -385,7 +382,7 @@ type InvoiceSectionsClientValidateDeleteEligibilityOptions struct { // InvoicesClientBeginAmendOptions contains the optional parameters for the InvoicesClient.BeginAmend method. type InvoicesClientBeginAmendOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -396,7 +393,7 @@ type InvoicesClientBeginDownloadByBillingAccountOptions struct { // a tax receipt. DocumentName *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -407,28 +404,28 @@ type InvoicesClientBeginDownloadByBillingSubscriptionOptions struct { // a tax receipt. DocumentName *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // InvoicesClientBeginDownloadDocumentsByBillingAccountOptions contains the optional parameters for the InvoicesClient.BeginDownloadDocumentsByBillingAccount // method. type InvoicesClientBeginDownloadDocumentsByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // InvoicesClientBeginDownloadDocumentsByBillingSubscriptionOptions contains the optional parameters for the InvoicesClient.BeginDownloadDocumentsByBillingSubscription // method. type InvoicesClientBeginDownloadDocumentsByBillingSubscriptionOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // InvoicesClientBeginDownloadSummaryByBillingAccountOptions contains the optional parameters for the InvoicesClient.BeginDownloadSummaryByBillingAccount // method. type InvoicesClientBeginDownloadSummaryByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -687,28 +684,28 @@ type PermissionsClientListByInvoiceSectionOptions struct { // PoliciesClientBeginCreateOrUpdateByBillingAccountOptions contains the optional parameters for the PoliciesClient.BeginCreateOrUpdateByBillingAccount // method. type PoliciesClientBeginCreateOrUpdateByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoliciesClientBeginCreateOrUpdateByBillingProfileOptions contains the optional parameters for the PoliciesClient.BeginCreateOrUpdateByBillingProfile // method. type PoliciesClientBeginCreateOrUpdateByBillingProfileOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoliciesClientBeginCreateOrUpdateByCustomerAtBillingAccountOptions contains the optional parameters for the PoliciesClient.BeginCreateOrUpdateByCustomerAtBillingAccount // method. type PoliciesClientBeginCreateOrUpdateByCustomerAtBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PoliciesClientBeginCreateOrUpdateByCustomerOptions contains the optional parameters for the PoliciesClient.BeginCreateOrUpdateByCustomer // method. type PoliciesClientBeginCreateOrUpdateByCustomerOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -740,7 +737,7 @@ type PoliciesClientGetBySubscriptionOptions struct { // ProductsClientBeginMoveOptions contains the optional parameters for the ProductsClient.BeginMove method. type ProductsClientBeginMoveOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -861,13 +858,13 @@ type ProductsClientValidateMoveEligibilityOptions struct { // ProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProfilesClient.BeginCreateOrUpdate method. type ProfilesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProfilesClientBeginDeleteOptions contains the optional parameters for the ProfilesClient.BeginDelete method. type ProfilesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -952,7 +949,7 @@ type RecipientTransfersClientValidateOptions struct { // RequestsClientBeginCreateOrUpdateOptions contains the optional parameters for the RequestsClient.BeginCreateOrUpdate method. type RequestsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1107,7 +1104,7 @@ type ReservationOrdersClientListByBillingAccountOptions struct { // ReservationsClientBeginUpdateByBillingAccountOptions contains the optional parameters for the ReservationsClient.BeginUpdateByBillingAccount // method. type ReservationsClientBeginUpdateByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1171,49 +1168,49 @@ type ReservationsClientListByReservationOrderOptions struct { // RoleAssignmentsClientBeginCreateByBillingAccountOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateByBillingAccount // method. type RoleAssignmentsClientBeginCreateByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RoleAssignmentsClientBeginCreateByBillingProfileOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateByBillingProfile // method. type RoleAssignmentsClientBeginCreateByBillingProfileOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RoleAssignmentsClientBeginCreateByCustomerOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateByCustomer // method. type RoleAssignmentsClientBeginCreateByCustomerOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RoleAssignmentsClientBeginCreateByInvoiceSectionOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateByInvoiceSection // method. type RoleAssignmentsClientBeginCreateByInvoiceSectionOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RoleAssignmentsClientBeginCreateOrUpdateByBillingAccountOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateOrUpdateByBillingAccount // method. type RoleAssignmentsClientBeginCreateOrUpdateByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RoleAssignmentsClientBeginCreateOrUpdateByDepartmentOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateOrUpdateByDepartment // method. type RoleAssignmentsClientBeginCreateOrUpdateByDepartmentOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // RoleAssignmentsClientBeginCreateOrUpdateByEnrollmentAccountOptions contains the optional parameters for the RoleAssignmentsClient.BeginCreateOrUpdateByEnrollmentAccount // method. type RoleAssignmentsClientBeginCreateOrUpdateByEnrollmentAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1226,7 +1223,7 @@ type RoleAssignmentsClientBeginResolveByBillingAccountOptions struct { // Resolves the scope display name for each of the role assignments. ResolveScopeDisplayNames *bool - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1239,7 +1236,7 @@ type RoleAssignmentsClientBeginResolveByBillingProfileOptions struct { // Resolves the scope display name for each of the role assignments. ResolveScopeDisplayNames *bool - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1252,7 +1249,7 @@ type RoleAssignmentsClientBeginResolveByCustomerOptions struct { // Resolves the scope display name for each of the role assignments. ResolveScopeDisplayNames *bool - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1265,7 +1262,7 @@ type RoleAssignmentsClientBeginResolveByInvoiceSectionOptions struct { // Resolves the scope display name for each of the role assignments. ResolveScopeDisplayNames *bool - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1507,7 +1504,7 @@ type SavingsPlanOrdersClientListByBillingAccountOptions struct { // SavingsPlansClientBeginUpdateByBillingAccountOptions contains the optional parameters for the SavingsPlansClient.BeginUpdateByBillingAccount // method. type SavingsPlansClientBeginUpdateByBillingAccountOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1555,7 +1552,7 @@ type SavingsPlansClientValidateUpdateByBillingAccountOptions struct { // SubscriptionsAliasesClientBeginCreateOrUpdateOptions contains the optional parameters for the SubscriptionsAliasesClient.BeginCreateOrUpdate // method. type SubscriptionsAliasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1594,37 +1591,37 @@ type SubscriptionsAliasesClientListByBillingAccountOptions struct { // SubscriptionsClientBeginCancelOptions contains the optional parameters for the SubscriptionsClient.BeginCancel method. type SubscriptionsClientBeginCancelOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SubscriptionsClientBeginDeleteOptions contains the optional parameters for the SubscriptionsClient.BeginDelete method. type SubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SubscriptionsClientBeginMergeOptions contains the optional parameters for the SubscriptionsClient.BeginMerge method. type SubscriptionsClientBeginMergeOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SubscriptionsClientBeginMoveOptions contains the optional parameters for the SubscriptionsClient.BeginMove method. type SubscriptionsClientBeginMoveOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SubscriptionsClientBeginSplitOptions contains the optional parameters for the SubscriptionsClient.BeginSplit method. type SubscriptionsClientBeginSplitOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SubscriptionsClientBeginUpdateOptions contains the optional parameters for the SubscriptionsClient.BeginUpdate method. type SubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1837,7 +1834,7 @@ type SubscriptionsClientValidateMoveEligibilityOptions struct { // TransactionsClientBeginTransactionsDownloadByInvoiceOptions contains the optional parameters for the TransactionsClient.BeginTransactionsDownloadByInvoice // method. type TransactionsClientBeginTransactionsDownloadByInvoiceOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go b/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go index 6db7ce894aa6..c9ed1ac92c33 100644 --- a/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go +++ b/sdk/resourcemanager/billing/armbilling/partnertransfers_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -74,7 +70,7 @@ func (client *PartnerTransfersClient) Cancel(ctx context.Context, billingAccount } // cancelCreateRequest creates the Cancel request. -func (client *PartnerTransfersClient) cancelCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, transferName string, options *PartnerTransfersClientCancelOptions) (*policy.Request, error) { +func (client *PartnerTransfersClient) cancelCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, transferName string, _ *PartnerTransfersClientCancelOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}/cancel" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -145,7 +141,7 @@ func (client *PartnerTransfersClient) Get(ctx context.Context, billingAccountNam } // getCreateRequest creates the Get request. -func (client *PartnerTransfersClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, transferName string, options *PartnerTransfersClientGetOptions) (*policy.Request, error) { +func (client *PartnerTransfersClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, transferName string, _ *PartnerTransfersClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -219,7 +215,7 @@ func (client *PartnerTransfersClient) Initiate(ctx context.Context, billingAccou } // initiateCreateRequest creates the Initiate request. -func (client *PartnerTransfersClient) initiateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, transferName string, parameters PartnerInitiateTransferRequest, options *PartnerTransfersClientInitiateOptions) (*policy.Request, error) { +func (client *PartnerTransfersClient) initiateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, transferName string, parameters PartnerInitiateTransferRequest, _ *PartnerTransfersClientInitiateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -293,7 +289,7 @@ func (client *PartnerTransfersClient) NewListPager(billingAccountName string, bi } // listCreateRequest creates the List request. -func (client *PartnerTransfersClient) listCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, options *PartnerTransfersClientListOptions) (*policy.Request, error) { +func (client *PartnerTransfersClient) listCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, _ *PartnerTransfersClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..8b71f1197cef 100644 --- a/sdk/resourcemanager/billing/armbilling/paymentmethods_client.go +++ b/sdk/resourcemanager/billing/armbilling/paymentmethods_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -70,7 +66,7 @@ func (client *PaymentMethodsClient) DeleteByUser(ctx context.Context, paymentMet } // deleteByUserCreateRequest creates the DeleteByUser request. -func (client *PaymentMethodsClient) deleteByUserCreateRequest(ctx context.Context, paymentMethodName string, options *PaymentMethodsClientDeleteByUserOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) deleteByUserCreateRequest(ctx context.Context, paymentMethodName string, _ *PaymentMethodsClientDeleteByUserOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}" if paymentMethodName == "" { return nil, errors.New("parameter paymentMethodName cannot be empty") @@ -119,7 +115,7 @@ func (client *PaymentMethodsClient) GetByBillingAccount(ctx context.Context, bil } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *PaymentMethodsClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, paymentMethodName string, options *PaymentMethodsClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, paymentMethodName string, _ *PaymentMethodsClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -182,7 +178,7 @@ func (client *PaymentMethodsClient) GetByBillingProfile(ctx context.Context, bil } // getByBillingProfileCreateRequest creates the GetByBillingProfile request. -func (client *PaymentMethodsClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, paymentMethodName string, options *PaymentMethodsClientGetByBillingProfileOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, paymentMethodName string, _ *PaymentMethodsClientGetByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -246,7 +242,7 @@ func (client *PaymentMethodsClient) GetByUser(ctx context.Context, paymentMethod } // getByUserCreateRequest creates the GetByUser request. -func (client *PaymentMethodsClient) getByUserCreateRequest(ctx context.Context, paymentMethodName string, options *PaymentMethodsClientGetByUserOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) getByUserCreateRequest(ctx context.Context, paymentMethodName string, _ *PaymentMethodsClientGetByUserOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}" if paymentMethodName == "" { return nil, errors.New("parameter paymentMethodName cannot be empty") @@ -304,7 +300,7 @@ func (client *PaymentMethodsClient) NewListByBillingAccountPager(billingAccountN } // listByBillingAccountCreateRequest creates the ListByBillingAccount request. -func (client *PaymentMethodsClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, options *PaymentMethodsClientListByBillingAccountOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, _ *PaymentMethodsClientListByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -362,7 +358,7 @@ func (client *PaymentMethodsClient) NewListByBillingProfilePager(billingAccountN } // listByBillingProfileCreateRequest creates the ListByBillingProfile request. -func (client *PaymentMethodsClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *PaymentMethodsClientListByBillingProfileOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *PaymentMethodsClientListByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -421,7 +417,7 @@ func (client *PaymentMethodsClient) NewListByUserPager(options *PaymentMethodsCl } // listByUserCreateRequest creates the ListByUser request. -func (client *PaymentMethodsClient) listByUserCreateRequest(ctx context.Context, options *PaymentMethodsClientListByUserOptions) (*policy.Request, error) { +func (client *PaymentMethodsClient) listByUserCreateRequest(ctx context.Context, _ *PaymentMethodsClientListByUserOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/paymentMethods" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { 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..0985ab9f766b 100644 --- a/sdk/resourcemanager/billing/armbilling/permissions_client.go +++ b/sdk/resourcemanager/billing/armbilling/permissions_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -72,7 +68,7 @@ func (client *PermissionsClient) CheckAccessByBillingAccount(ctx context.Context } // checkAccessByBillingAccountCreateRequest creates the CheckAccessByBillingAccount request. -func (client *PermissionsClient) checkAccessByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters CheckAccessRequest, options *PermissionsClientCheckAccessByBillingAccountOptions) (*policy.Request, error) { +func (client *PermissionsClient) checkAccessByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters CheckAccessRequest, _ *PermissionsClientCheckAccessByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/checkAccess" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -133,7 +129,7 @@ func (client *PermissionsClient) CheckAccessByBillingProfile(ctx context.Context } // checkAccessByBillingProfileCreateRequest creates the CheckAccessByBillingProfile request. -func (client *PermissionsClient) checkAccessByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters CheckAccessRequest, options *PermissionsClientCheckAccessByBillingProfileOptions) (*policy.Request, error) { +func (client *PermissionsClient) checkAccessByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters CheckAccessRequest, _ *PermissionsClientCheckAccessByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/checkAccess" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -199,7 +195,7 @@ func (client *PermissionsClient) CheckAccessByCustomer(ctx context.Context, bill } // checkAccessByCustomerCreateRequest creates the CheckAccessByCustomer request. -func (client *PermissionsClient) checkAccessByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, parameters CheckAccessRequest, options *PermissionsClientCheckAccessByCustomerOptions) (*policy.Request, error) { +func (client *PermissionsClient) checkAccessByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, parameters CheckAccessRequest, _ *PermissionsClientCheckAccessByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/checkAccess" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -268,7 +264,7 @@ func (client *PermissionsClient) CheckAccessByDepartment(ctx context.Context, bi } // checkAccessByDepartmentCreateRequest creates the CheckAccessByDepartment request. -func (client *PermissionsClient) checkAccessByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, parameters CheckAccessRequest, options *PermissionsClientCheckAccessByDepartmentOptions) (*policy.Request, error) { +func (client *PermissionsClient) checkAccessByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, parameters CheckAccessRequest, _ *PermissionsClientCheckAccessByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/checkAccess" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -333,7 +329,7 @@ func (client *PermissionsClient) CheckAccessByEnrollmentAccount(ctx context.Cont } // checkAccessByEnrollmentAccountCreateRequest creates the CheckAccessByEnrollmentAccount request. -func (client *PermissionsClient) checkAccessByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, parameters CheckAccessRequest, options *PermissionsClientCheckAccessByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *PermissionsClient) checkAccessByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, parameters CheckAccessRequest, _ *PermissionsClientCheckAccessByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/checkAccess" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -399,7 +395,7 @@ func (client *PermissionsClient) CheckAccessByInvoiceSection(ctx context.Context } // checkAccessByInvoiceSectionCreateRequest creates the CheckAccessByInvoiceSection request. -func (client *PermissionsClient) checkAccessByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters CheckAccessRequest, options *PermissionsClientCheckAccessByInvoiceSectionOptions) (*policy.Request, error) { +func (client *PermissionsClient) checkAccessByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters CheckAccessRequest, _ *PermissionsClientCheckAccessByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/checkAccess" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -466,7 +462,7 @@ func (client *PermissionsClient) NewListByBillingAccountPager(billingAccountName } // listByBillingAccountCreateRequest creates the ListByBillingAccount request. -func (client *PermissionsClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, options *PermissionsClientListByBillingAccountOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, _ *PermissionsClientListByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -523,7 +519,7 @@ func (client *PermissionsClient) NewListByBillingProfilePager(billingAccountName } // listByBillingProfileCreateRequest creates the ListByBillingProfile request. -func (client *PermissionsClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *PermissionsClientListByBillingProfileOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *PermissionsClientListByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -585,7 +581,7 @@ func (client *PermissionsClient) NewListByCustomerPager(billingAccountName strin } // listByCustomerCreateRequest creates the ListByCustomer request. -func (client *PermissionsClient) listByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, options *PermissionsClientListByCustomerOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, _ *PermissionsClientListByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -651,7 +647,7 @@ func (client *PermissionsClient) NewListByCustomerAtBillingAccountPager(billingA } // listByCustomerAtBillingAccountCreateRequest creates the ListByCustomerAtBillingAccount request. -func (client *PermissionsClient) listByCustomerAtBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, options *PermissionsClientListByCustomerAtBillingAccountOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByCustomerAtBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, _ *PermissionsClientListByCustomerAtBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -712,7 +708,7 @@ func (client *PermissionsClient) NewListByDepartmentPager(billingAccountName str } // listByDepartmentCreateRequest creates the ListByDepartment request. -func (client *PermissionsClient) listByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, options *PermissionsClientListByDepartmentOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, _ *PermissionsClientListByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -773,7 +769,7 @@ func (client *PermissionsClient) NewListByEnrollmentAccountPager(billingAccountN } // listByEnrollmentAccountCreateRequest creates the ListByEnrollmentAccount request. -func (client *PermissionsClient) listByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, options *PermissionsClientListByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, _ *PermissionsClientListByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -835,7 +831,7 @@ func (client *PermissionsClient) NewListByInvoiceSectionPager(billingAccountName } // listByInvoiceSectionCreateRequest creates the ListByInvoiceSection request. -func (client *PermissionsClient) listByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *PermissionsClientListByInvoiceSectionOptions) (*policy.Request, error) { +func (client *PermissionsClient) listByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, _ *PermissionsClientListByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..42ff95133283 100644 --- a/sdk/resourcemanager/billing/armbilling/policies_client.go +++ b/sdk/resourcemanager/billing/armbilling/policies_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -95,7 +91,7 @@ func (client *PoliciesClient) createOrUpdateByBillingAccount(ctx context.Context } // createOrUpdateByBillingAccountCreateRequest creates the CreateOrUpdateByBillingAccount request. -func (client *PoliciesClient) createOrUpdateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters AccountPolicy, options *PoliciesClientBeginCreateOrUpdateByBillingAccountOptions) (*policy.Request, error) { +func (client *PoliciesClient) createOrUpdateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters AccountPolicy, _ *PoliciesClientBeginCreateOrUpdateByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -169,7 +165,7 @@ func (client *PoliciesClient) createOrUpdateByBillingProfile(ctx context.Context } // createOrUpdateByBillingProfileCreateRequest creates the CreateOrUpdateByBillingProfile request. -func (client *PoliciesClient) createOrUpdateByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters ProfilePolicy, options *PoliciesClientBeginCreateOrUpdateByBillingProfileOptions) (*policy.Request, error) { +func (client *PoliciesClient) createOrUpdateByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters ProfilePolicy, _ *PoliciesClientBeginCreateOrUpdateByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -248,7 +244,7 @@ func (client *PoliciesClient) createOrUpdateByCustomer(ctx context.Context, bill } // createOrUpdateByCustomerCreateRequest creates the CreateOrUpdateByCustomer request. -func (client *PoliciesClient) createOrUpdateByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, parameters CustomerPolicy, options *PoliciesClientBeginCreateOrUpdateByCustomerOptions) (*policy.Request, error) { +func (client *PoliciesClient) createOrUpdateByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, parameters CustomerPolicy, _ *PoliciesClientBeginCreateOrUpdateByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -330,7 +326,7 @@ func (client *PoliciesClient) createOrUpdateByCustomerAtBillingAccount(ctx conte } // createOrUpdateByCustomerAtBillingAccountCreateRequest creates the CreateOrUpdateByCustomerAtBillingAccount request. -func (client *PoliciesClient) createOrUpdateByCustomerAtBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, parameters CustomerPolicy, options *PoliciesClientBeginCreateOrUpdateByCustomerAtBillingAccountOptions) (*policy.Request, error) { +func (client *PoliciesClient) createOrUpdateByCustomerAtBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, parameters CustomerPolicy, _ *PoliciesClientBeginCreateOrUpdateByCustomerAtBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -384,7 +380,7 @@ func (client *PoliciesClient) GetByBillingAccount(ctx context.Context, billingAc } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *PoliciesClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, options *PoliciesClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *PoliciesClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, _ *PoliciesClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -442,7 +438,7 @@ func (client *PoliciesClient) GetByBillingProfile(ctx context.Context, billingAc } // getByBillingProfileCreateRequest creates the GetByBillingProfile request. -func (client *PoliciesClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *PoliciesClientGetByBillingProfileOptions) (*policy.Request, error) { +func (client *PoliciesClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *PoliciesClientGetByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -505,7 +501,7 @@ func (client *PoliciesClient) GetByCustomer(ctx context.Context, billingAccountN } // getByCustomerCreateRequest creates the GetByCustomer request. -func (client *PoliciesClient) getByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, policyName ServiceDefinedResourceName, options *PoliciesClientGetByCustomerOptions) (*policy.Request, error) { +func (client *PoliciesClient) getByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, policyName ServiceDefinedResourceName, _ *PoliciesClientGetByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/policies/{policyName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -575,7 +571,7 @@ func (client *PoliciesClient) GetByCustomerAtBillingAccount(ctx context.Context, } // getByCustomerAtBillingAccountCreateRequest creates the GetByCustomerAtBillingAccount request. -func (client *PoliciesClient) getByCustomerAtBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, options *PoliciesClientGetByCustomerAtBillingAccountOptions) (*policy.Request, error) { +func (client *PoliciesClient) getByCustomerAtBillingAccountCreateRequest(ctx context.Context, billingAccountName string, customerName string, _ *PoliciesClientGetByCustomerAtBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -636,7 +632,7 @@ func (client *PoliciesClient) GetBySubscription(ctx context.Context, options *Po } // getBySubscriptionCreateRequest creates the GetBySubscription request. -func (client *PoliciesClient) getBySubscriptionCreateRequest(ctx context.Context, options *PoliciesClientGetBySubscriptionOptions) (*policy.Request, error) { +func (client *PoliciesClient) getBySubscriptionCreateRequest(ctx context.Context, _ *PoliciesClientGetBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/policies/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") 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..763207f0a6a6 100644 --- a/sdk/resourcemanager/billing/armbilling/products_client.go +++ b/sdk/resourcemanager/billing/armbilling/products_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -73,7 +69,7 @@ func (client *ProductsClient) Get(ctx context.Context, billingAccountName string } // getCreateRequest creates the Get request. -func (client *ProductsClient) getCreateRequest(ctx context.Context, billingAccountName string, productName string, options *ProductsClientGetOptions) (*policy.Request, error) { +func (client *ProductsClient) getCreateRequest(ctx context.Context, billingAccountName string, productName string, _ *ProductsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -481,7 +477,7 @@ func (client *ProductsClient) move(ctx context.Context, billingAccountName strin } // moveCreateRequest creates the Move request. -func (client *ProductsClient) moveCreateRequest(ctx context.Context, billingAccountName string, productName string, parameters MoveProductRequest, options *ProductsClientBeginMoveOptions) (*policy.Request, error) { +func (client *ProductsClient) moveCreateRequest(ctx context.Context, billingAccountName string, productName string, parameters MoveProductRequest, _ *ProductsClientBeginMoveOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -537,7 +533,7 @@ func (client *ProductsClient) Update(ctx context.Context, billingAccountName str } // updateCreateRequest creates the Update request. -func (client *ProductsClient) updateCreateRequest(ctx context.Context, billingAccountName string, productName string, parameters ProductPatch, options *ProductsClientUpdateOptions) (*policy.Request, error) { +func (client *ProductsClient) updateCreateRequest(ctx context.Context, billingAccountName string, productName string, parameters ProductPatch, _ *ProductsClientUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -604,7 +600,7 @@ func (client *ProductsClient) ValidateMoveEligibility(ctx context.Context, billi } // validateMoveEligibilityCreateRequest creates the ValidateMoveEligibility request. -func (client *ProductsClient) validateMoveEligibilityCreateRequest(ctx context.Context, billingAccountName string, productName string, parameters MoveProductRequest, options *ProductsClientValidateMoveEligibilityOptions) (*policy.Request, error) { +func (client *ProductsClient) validateMoveEligibilityCreateRequest(ctx context.Context, billingAccountName string, productName string, parameters MoveProductRequest, _ *ProductsClientValidateMoveEligibilityOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..50f1438884b8 100644 --- a/sdk/resourcemanager/billing/armbilling/profiles_client.go +++ b/sdk/resourcemanager/billing/armbilling/profiles_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -99,7 +95,7 @@ func (client *ProfilesClient) createOrUpdate(ctx context.Context, billingAccount } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProfilesClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters Profile, options *ProfilesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ProfilesClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters Profile, _ *ProfilesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -176,7 +172,7 @@ func (client *ProfilesClient) deleteOperation(ctx context.Context, billingAccoun } // deleteCreateRequest creates the Delete request. -func (client *ProfilesClient) deleteCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *ProfilesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ProfilesClient) deleteCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *ProfilesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -228,7 +224,7 @@ func (client *ProfilesClient) Get(ctx context.Context, billingAccountName string } // getCreateRequest creates the Get request. -func (client *ProfilesClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *ProfilesClientGetOptions) (*policy.Request, error) { +func (client *ProfilesClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *ProfilesClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -368,7 +364,7 @@ func (client *ProfilesClient) ValidateDeleteEligibility(ctx context.Context, bil } // validateDeleteEligibilityCreateRequest creates the ValidateDeleteEligibility request. -func (client *ProfilesClient) validateDeleteEligibilityCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *ProfilesClientValidateDeleteEligibilityOptions) (*policy.Request, error) { +func (client *ProfilesClient) validateDeleteEligibilityCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *ProfilesClientValidateDeleteEligibilityOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/validateDeleteEligibility" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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 index e0d87ac2ab57..9ae9ce5a89d4 100644 --- a/sdk/resourcemanager/billing/armbilling/property_client.go +++ b/sdk/resourcemanager/billing/armbilling/property_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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" ) // PropertyClient contains the methods for the BillingProperty group. @@ -136,7 +132,7 @@ func (client *PropertyClient) Update(ctx context.Context, parameters Property, o } // updateCreateRequest creates the Update request. -func (client *PropertyClient) updateCreateRequest(ctx context.Context, parameters Property, options *PropertyClientUpdateOptions) (*policy.Request, error) { +func (client *PropertyClient) updateCreateRequest(ctx context.Context, parameters Property, _ *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") 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..f2d0d3c4dfa8 100644 --- a/sdk/resourcemanager/billing/armbilling/recipienttransfers_client.go +++ b/sdk/resourcemanager/billing/armbilling/recipienttransfers_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -72,7 +68,7 @@ func (client *RecipientTransfersClient) Accept(ctx context.Context, transferName } // acceptCreateRequest creates the Accept request. -func (client *RecipientTransfersClient) acceptCreateRequest(ctx context.Context, transferName string, parameters AcceptTransferRequest, options *RecipientTransfersClientAcceptOptions) (*policy.Request, error) { +func (client *RecipientTransfersClient) acceptCreateRequest(ctx context.Context, transferName string, parameters AcceptTransferRequest, _ *RecipientTransfersClientAcceptOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/transfers/{transferName}/accept" if transferName == "" { return nil, errors.New("parameter transferName cannot be empty") @@ -131,7 +127,7 @@ func (client *RecipientTransfersClient) Decline(ctx context.Context, transferNam } // declineCreateRequest creates the Decline request. -func (client *RecipientTransfersClient) declineCreateRequest(ctx context.Context, transferName string, options *RecipientTransfersClientDeclineOptions) (*policy.Request, error) { +func (client *RecipientTransfersClient) declineCreateRequest(ctx context.Context, transferName string, _ *RecipientTransfersClientDeclineOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/transfers/{transferName}/decline" if transferName == "" { return nil, errors.New("parameter transferName cannot be empty") @@ -186,7 +182,7 @@ func (client *RecipientTransfersClient) Get(ctx context.Context, transferName st } // getCreateRequest creates the Get request. -func (client *RecipientTransfersClient) getCreateRequest(ctx context.Context, transferName string, options *RecipientTransfersClientGetOptions) (*policy.Request, error) { +func (client *RecipientTransfersClient) getCreateRequest(ctx context.Context, transferName string, _ *RecipientTransfersClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/transfers/{transferName}" if transferName == "" { return nil, errors.New("parameter transferName cannot be empty") @@ -241,7 +237,7 @@ func (client *RecipientTransfersClient) NewListPager(options *RecipientTransfers } // listCreateRequest creates the List request. -func (client *RecipientTransfersClient) listCreateRequest(ctx context.Context, options *RecipientTransfersClientListOptions) (*policy.Request, error) { +func (client *RecipientTransfersClient) listCreateRequest(ctx context.Context, _ *RecipientTransfersClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/transfers" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -295,7 +291,7 @@ func (client *RecipientTransfersClient) Validate(ctx context.Context, transferNa } // validateCreateRequest creates the Validate request. -func (client *RecipientTransfersClient) validateCreateRequest(ctx context.Context, transferName string, parameters AcceptTransferRequest, options *RecipientTransfersClientValidateOptions) (*policy.Request, error) { +func (client *RecipientTransfersClient) validateCreateRequest(ctx context.Context, transferName string, parameters AcceptTransferRequest, _ *RecipientTransfersClientValidateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/transfers/{transferName}/validate" if transferName == "" { return nil, errors.New("parameter transferName cannot be empty") 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..b38c3411a267 100644 --- a/sdk/resourcemanager/billing/armbilling/requests_client.go +++ b/sdk/resourcemanager/billing/armbilling/requests_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -95,7 +91,7 @@ func (client *RequestsClient) createOrUpdate(ctx context.Context, billingRequest } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RequestsClient) createOrUpdateCreateRequest(ctx context.Context, billingRequestName string, parameters Request, options *RequestsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *RequestsClient) createOrUpdateCreateRequest(ctx context.Context, billingRequestName string, parameters Request, _ *RequestsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingRequests/{billingRequestName}" if billingRequestName == "" { return nil, errors.New("parameter billingRequestName cannot be empty") @@ -144,7 +140,7 @@ func (client *RequestsClient) Get(ctx context.Context, billingRequestName string } // getCreateRequest creates the Get request. -func (client *RequestsClient) getCreateRequest(ctx context.Context, billingRequestName string, options *RequestsClientGetOptions) (*policy.Request, error) { +func (client *RequestsClient) getCreateRequest(ctx context.Context, billingRequestName string, _ *RequestsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingRequests/{billingRequestName}" if billingRequestName == "" { return nil, errors.New("parameter billingRequestName cannot be empty") 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..87d554c879f6 100644 --- a/sdk/resourcemanager/billing/armbilling/reservationorders_client.go +++ b/sdk/resourcemanager/billing/armbilling/reservationorders_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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..3cdeb32044fe 100644 --- a/sdk/resourcemanager/billing/armbilling/reservations_client.go +++ b/sdk/resourcemanager/billing/armbilling/reservations_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -297,7 +293,7 @@ func (client *ReservationsClient) NewListByReservationOrderPager(billingAccountN } // listByReservationOrderCreateRequest creates the ListByReservationOrder request. -func (client *ReservationsClient) listByReservationOrderCreateRequest(ctx context.Context, billingAccountName string, reservationOrderID string, options *ReservationsClientListByReservationOrderOptions) (*policy.Request, error) { +func (client *ReservationsClient) listByReservationOrderCreateRequest(ctx context.Context, billingAccountName string, reservationOrderID string, _ *ReservationsClientListByReservationOrderOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -381,7 +377,7 @@ func (client *ReservationsClient) updateByBillingAccount(ctx context.Context, bi } // updateByBillingAccountCreateRequest creates the UpdateByBillingAccount request. -func (client *ReservationsClient) updateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, reservationOrderID string, reservationID string, body Patch, options *ReservationsClientBeginUpdateByBillingAccountOptions) (*policy.Request, error) { +func (client *ReservationsClient) updateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, reservationOrderID string, reservationID string, body Patch, _ *ReservationsClientBeginUpdateByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations/{reservationId}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..af7101c3b308 100644 --- a/sdk/resourcemanager/billing/armbilling/responses.go +++ b/sdk/resourcemanager/billing/armbilling/responses.go @@ -1,6 +1,3 @@ -//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. diff --git a/sdk/resourcemanager/billing/armbilling/roleassignments_client.go b/sdk/resourcemanager/billing/armbilling/roleassignments_client.go index 721ca6a6f522..f0e647ced434 100644 --- a/sdk/resourcemanager/billing/armbilling/roleassignments_client.go +++ b/sdk/resourcemanager/billing/armbilling/roleassignments_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -96,7 +92,7 @@ func (client *RoleAssignmentsClient) createByBillingAccount(ctx context.Context, } // createByBillingAccountCreateRequest creates the CreateByBillingAccount request. -func (client *RoleAssignmentsClient) createByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters RoleAssignmentProperties, options *RoleAssignmentsClientBeginCreateByBillingAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, parameters RoleAssignmentProperties, _ *RoleAssignmentsClientBeginCreateByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -171,7 +167,7 @@ func (client *RoleAssignmentsClient) createByBillingProfile(ctx context.Context, } // createByBillingProfileCreateRequest creates the CreateByBillingProfile request. -func (client *RoleAssignmentsClient) createByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters RoleAssignmentProperties, options *RoleAssignmentsClientBeginCreateByBillingProfileOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, parameters RoleAssignmentProperties, _ *RoleAssignmentsClientBeginCreateByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -251,7 +247,7 @@ func (client *RoleAssignmentsClient) createByCustomer(ctx context.Context, billi } // createByCustomerCreateRequest creates the CreateByCustomer request. -func (client *RoleAssignmentsClient) createByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, parameters RoleAssignmentProperties, options *RoleAssignmentsClientBeginCreateByCustomerOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, parameters RoleAssignmentProperties, _ *RoleAssignmentsClientBeginCreateByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/createBillingRoleAssignment" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -335,7 +331,7 @@ func (client *RoleAssignmentsClient) createByInvoiceSection(ctx context.Context, } // createByInvoiceSectionCreateRequest creates the CreateByInvoiceSection request. -func (client *RoleAssignmentsClient) createByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters RoleAssignmentProperties, options *RoleAssignmentsClientBeginCreateByInvoiceSectionOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, parameters RoleAssignmentProperties, _ *RoleAssignmentsClientBeginCreateByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -417,7 +413,7 @@ func (client *RoleAssignmentsClient) createOrUpdateByBillingAccount(ctx context. } // createOrUpdateByBillingAccountCreateRequest creates the CreateOrUpdateByBillingAccount request. -func (client *RoleAssignmentsClient) createOrUpdateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, billingRoleAssignmentName string, parameters RoleAssignment, options *RoleAssignmentsClientBeginCreateOrUpdateByBillingAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createOrUpdateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, billingRoleAssignmentName string, parameters RoleAssignment, _ *RoleAssignmentsClientBeginCreateOrUpdateByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -496,7 +492,7 @@ func (client *RoleAssignmentsClient) createOrUpdateByDepartment(ctx context.Cont } // createOrUpdateByDepartmentCreateRequest creates the CreateOrUpdateByDepartment request. -func (client *RoleAssignmentsClient) createOrUpdateByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, billingRoleAssignmentName string, parameters RoleAssignment, options *RoleAssignmentsClientBeginCreateOrUpdateByDepartmentOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createOrUpdateByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, billingRoleAssignmentName string, parameters RoleAssignment, _ *RoleAssignmentsClientBeginCreateOrUpdateByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -579,7 +575,7 @@ func (client *RoleAssignmentsClient) createOrUpdateByEnrollmentAccount(ctx conte } // createOrUpdateByEnrollmentAccountCreateRequest creates the CreateOrUpdateByEnrollmentAccount request. -func (client *RoleAssignmentsClient) createOrUpdateByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, billingRoleAssignmentName string, parameters RoleAssignment, options *RoleAssignmentsClientBeginCreateOrUpdateByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) createOrUpdateByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, billingRoleAssignmentName string, parameters RoleAssignment, _ *RoleAssignmentsClientBeginCreateOrUpdateByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -638,7 +634,7 @@ func (client *RoleAssignmentsClient) DeleteByBillingAccount(ctx context.Context, } // deleteByBillingAccountCreateRequest creates the DeleteByBillingAccount request. -func (client *RoleAssignmentsClient) deleteByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, billingRoleAssignmentName string, options *RoleAssignmentsClientDeleteByBillingAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) deleteByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientDeleteByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -691,7 +687,7 @@ func (client *RoleAssignmentsClient) DeleteByBillingProfile(ctx context.Context, } // deleteByBillingProfileCreateRequest creates the DeleteByBillingProfile request. -func (client *RoleAssignmentsClient) deleteByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string, options *RoleAssignmentsClientDeleteByBillingProfileOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) deleteByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientDeleteByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -749,7 +745,7 @@ func (client *RoleAssignmentsClient) DeleteByCustomer(ctx context.Context, billi } // deleteByCustomerCreateRequest creates the DeleteByCustomer request. -func (client *RoleAssignmentsClient) deleteByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, billingRoleAssignmentName string, options *RoleAssignmentsClientDeleteByCustomerOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) deleteByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientDeleteByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -810,7 +806,7 @@ func (client *RoleAssignmentsClient) DeleteByDepartment(ctx context.Context, bil } // deleteByDepartmentCreateRequest creates the DeleteByDepartment request. -func (client *RoleAssignmentsClient) deleteByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, billingRoleAssignmentName string, options *RoleAssignmentsClientDeleteByDepartmentOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) deleteByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientDeleteByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -867,7 +863,7 @@ func (client *RoleAssignmentsClient) DeleteByEnrollmentAccount(ctx context.Conte } // deleteByEnrollmentAccountCreateRequest creates the DeleteByEnrollmentAccount request. -func (client *RoleAssignmentsClient) deleteByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, billingRoleAssignmentName string, options *RoleAssignmentsClientDeleteByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) deleteByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientDeleteByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -925,7 +921,7 @@ func (client *RoleAssignmentsClient) DeleteByInvoiceSection(ctx context.Context, } // deleteByInvoiceSectionCreateRequest creates the DeleteByInvoiceSection request. -func (client *RoleAssignmentsClient) deleteByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, billingRoleAssignmentName string, options *RoleAssignmentsClientDeleteByInvoiceSectionOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) deleteByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientDeleteByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -987,7 +983,7 @@ func (client *RoleAssignmentsClient) GetByBillingAccount(ctx context.Context, bi } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *RoleAssignmentsClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, billingRoleAssignmentName string, options *RoleAssignmentsClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1050,7 +1046,7 @@ func (client *RoleAssignmentsClient) GetByBillingProfile(ctx context.Context, bi } // getByBillingProfileCreateRequest creates the GetByBillingProfile request. -func (client *RoleAssignmentsClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string, options *RoleAssignmentsClientGetByBillingProfileOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientGetByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1118,7 +1114,7 @@ func (client *RoleAssignmentsClient) GetByCustomer(ctx context.Context, billingA } // getByCustomerCreateRequest creates the GetByCustomer request. -func (client *RoleAssignmentsClient) getByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, billingRoleAssignmentName string, options *RoleAssignmentsClientGetByCustomerOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) getByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientGetByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1189,7 +1185,7 @@ func (client *RoleAssignmentsClient) GetByDepartment(ctx context.Context, billin } // getByDepartmentCreateRequest creates the GetByDepartment request. -func (client *RoleAssignmentsClient) getByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, billingRoleAssignmentName string, options *RoleAssignmentsClientGetByDepartmentOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) getByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientGetByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1256,7 +1252,7 @@ func (client *RoleAssignmentsClient) GetByEnrollmentAccount(ctx context.Context, } // getByEnrollmentAccountCreateRequest creates the GetByEnrollmentAccount request. -func (client *RoleAssignmentsClient) getByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, billingRoleAssignmentName string, options *RoleAssignmentsClientGetByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) getByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientGetByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1324,7 +1320,7 @@ func (client *RoleAssignmentsClient) GetByInvoiceSection(ctx context.Context, bi } // getByInvoiceSectionCreateRequest creates the GetByInvoiceSection request. -func (client *RoleAssignmentsClient) getByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, billingRoleAssignmentName string, options *RoleAssignmentsClientGetByInvoiceSectionOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) getByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, billingRoleAssignmentName string, _ *RoleAssignmentsClientGetByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1608,7 +1604,7 @@ func (client *RoleAssignmentsClient) NewListByDepartmentPager(billingAccountName } // listByDepartmentCreateRequest creates the ListByDepartment request. -func (client *RoleAssignmentsClient) listByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, options *RoleAssignmentsClientListByDepartmentOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) listByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, _ *RoleAssignmentsClientListByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1670,7 +1666,7 @@ func (client *RoleAssignmentsClient) NewListByEnrollmentAccountPager(billingAcco } // listByEnrollmentAccountCreateRequest creates the ListByEnrollmentAccount request. -func (client *RoleAssignmentsClient) listByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, options *RoleAssignmentsClientListByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *RoleAssignmentsClient) listByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, _ *RoleAssignmentsClientListByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..b231c561bf6c 100644 --- a/sdk/resourcemanager/billing/armbilling/roledefinition_client.go +++ b/sdk/resourcemanager/billing/armbilling/roledefinition_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -74,7 +70,7 @@ func (client *RoleDefinitionClient) GetByBillingAccount(ctx context.Context, bil } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. -func (client *RoleDefinitionClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, roleDefinitionName string, options *RoleDefinitionClientGetByBillingAccountOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) getByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, roleDefinitionName string, _ *RoleDefinitionClientGetByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{roleDefinitionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -137,7 +133,7 @@ func (client *RoleDefinitionClient) GetByBillingProfile(ctx context.Context, bil } // getByBillingProfileCreateRequest creates the GetByBillingProfile request. -func (client *RoleDefinitionClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, roleDefinitionName string, options *RoleDefinitionClientGetByBillingProfileOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) getByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, roleDefinitionName string, _ *RoleDefinitionClientGetByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -205,7 +201,7 @@ func (client *RoleDefinitionClient) GetByCustomer(ctx context.Context, billingAc } // getByCustomerCreateRequest creates the GetByCustomer request. -func (client *RoleDefinitionClient) getByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, roleDefinitionName string, options *RoleDefinitionClientGetByCustomerOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) getByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, roleDefinitionName string, _ *RoleDefinitionClientGetByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleDefinitions/{roleDefinitionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -276,7 +272,7 @@ func (client *RoleDefinitionClient) GetByDepartment(ctx context.Context, billing } // getByDepartmentCreateRequest creates the GetByDepartment request. -func (client *RoleDefinitionClient) getByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, roleDefinitionName string, options *RoleDefinitionClientGetByDepartmentOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) getByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, roleDefinitionName string, _ *RoleDefinitionClientGetByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions/{roleDefinitionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -343,7 +339,7 @@ func (client *RoleDefinitionClient) GetByEnrollmentAccount(ctx context.Context, } // getByEnrollmentAccountCreateRequest creates the GetByEnrollmentAccount request. -func (client *RoleDefinitionClient) getByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, roleDefinitionName string, options *RoleDefinitionClientGetByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) getByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, roleDefinitionName string, _ *RoleDefinitionClientGetByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions/{roleDefinitionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -411,7 +407,7 @@ func (client *RoleDefinitionClient) GetByInvoiceSection(ctx context.Context, bil } // getByInvoiceSectionCreateRequest creates the GetByInvoiceSection request. -func (client *RoleDefinitionClient) getByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, roleDefinitionName string, options *RoleDefinitionClientGetByInvoiceSectionOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) getByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, roleDefinitionName string, _ *RoleDefinitionClientGetByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{roleDefinitionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -480,7 +476,7 @@ func (client *RoleDefinitionClient) NewListByBillingAccountPager(billingAccountN } // listByBillingAccountCreateRequest creates the ListByBillingAccount request. -func (client *RoleDefinitionClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, options *RoleDefinitionClientListByBillingAccountOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) listByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, _ *RoleDefinitionClientListByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -538,7 +534,7 @@ func (client *RoleDefinitionClient) NewListByBillingProfilePager(billingAccountN } // listByBillingProfileCreateRequest creates the ListByBillingProfile request. -func (client *RoleDefinitionClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, options *RoleDefinitionClientListByBillingProfileOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) listByBillingProfileCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, _ *RoleDefinitionClientListByBillingProfileOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -601,7 +597,7 @@ func (client *RoleDefinitionClient) NewListByCustomerPager(billingAccountName st } // listByCustomerCreateRequest creates the ListByCustomer request. -func (client *RoleDefinitionClient) listByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, options *RoleDefinitionClientListByCustomerOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) listByCustomerCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, customerName string, _ *RoleDefinitionClientListByCustomerOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleDefinitions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -667,7 +663,7 @@ func (client *RoleDefinitionClient) NewListByDepartmentPager(billingAccountName } // listByDepartmentCreateRequest creates the ListByDepartment request. -func (client *RoleDefinitionClient) listByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, options *RoleDefinitionClientListByDepartmentOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) listByDepartmentCreateRequest(ctx context.Context, billingAccountName string, departmentName string, _ *RoleDefinitionClientListByDepartmentOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -729,7 +725,7 @@ func (client *RoleDefinitionClient) NewListByEnrollmentAccountPager(billingAccou } // listByEnrollmentAccountCreateRequest creates the ListByEnrollmentAccount request. -func (client *RoleDefinitionClient) listByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, options *RoleDefinitionClientListByEnrollmentAccountOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) listByEnrollmentAccountCreateRequest(ctx context.Context, billingAccountName string, enrollmentAccountName string, _ *RoleDefinitionClientListByEnrollmentAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -792,7 +788,7 @@ func (client *RoleDefinitionClient) NewListByInvoiceSectionPager(billingAccountN } // listByInvoiceSectionCreateRequest creates the ListByInvoiceSection request. -func (client *RoleDefinitionClient) listByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *RoleDefinitionClientListByInvoiceSectionOptions) (*policy.Request, error) { +func (client *RoleDefinitionClient) listByInvoiceSectionCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, _ *RoleDefinitionClientListByInvoiceSectionOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..01d7ee618d4e 100644 --- a/sdk/resourcemanager/billing/armbilling/savingsplanorders_client.go +++ b/sdk/resourcemanager/billing/armbilling/savingsplanorders_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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..6dfffa96ae3a 100644 --- a/sdk/resourcemanager/billing/armbilling/savingsplans_client.go +++ b/sdk/resourcemanager/billing/armbilling/savingsplans_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -216,7 +212,7 @@ func (client *SavingsPlansClient) NewListBySavingsPlanOrderPager(billingAccountN } // listBySavingsPlanOrderCreateRequest creates the ListBySavingsPlanOrder request. -func (client *SavingsPlansClient) listBySavingsPlanOrderCreateRequest(ctx context.Context, billingAccountName string, savingsPlanOrderID string, options *SavingsPlansClientListBySavingsPlanOrderOptions) (*policy.Request, error) { +func (client *SavingsPlansClient) listBySavingsPlanOrderCreateRequest(ctx context.Context, billingAccountName string, savingsPlanOrderID string, _ *SavingsPlansClientListBySavingsPlanOrderOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -300,7 +296,7 @@ func (client *SavingsPlansClient) updateByBillingAccount(ctx context.Context, bi } // updateByBillingAccountCreateRequest creates the UpdateByBillingAccount request. -func (client *SavingsPlansClient) updateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, savingsPlanOrderID string, savingsPlanID string, body SavingsPlanUpdateRequest, options *SavingsPlansClientBeginUpdateByBillingAccountOptions) (*policy.Request, error) { +func (client *SavingsPlansClient) updateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, savingsPlanOrderID string, savingsPlanID string, body SavingsPlanUpdateRequest, _ *SavingsPlansClientBeginUpdateByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -361,7 +357,7 @@ func (client *SavingsPlansClient) ValidateUpdateByBillingAccount(ctx context.Con } // validateUpdateByBillingAccountCreateRequest creates the ValidateUpdateByBillingAccount request. -func (client *SavingsPlansClient) validateUpdateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, savingsPlanOrderID string, savingsPlanID string, body SavingsPlanUpdateValidateRequest, options *SavingsPlansClientValidateUpdateByBillingAccountOptions) (*policy.Request, error) { +func (client *SavingsPlansClient) validateUpdateByBillingAccountCreateRequest(ctx context.Context, billingAccountName string, savingsPlanOrderID string, savingsPlanID string, body SavingsPlanUpdateValidateRequest, _ *SavingsPlansClientValidateUpdateByBillingAccountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/validate" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..1c5bd140e1dc 100644 --- a/sdk/resourcemanager/billing/armbilling/subscriptions_client.go +++ b/sdk/resourcemanager/billing/armbilling/subscriptions_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -97,7 +93,7 @@ func (client *SubscriptionsClient) cancel(ctx context.Context, billingAccountNam } // cancelCreateRequest creates the Cancel request. -func (client *SubscriptionsClient) cancelCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters CancelSubscriptionRequest, options *SubscriptionsClientBeginCancelOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) cancelCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters CancelSubscriptionRequest, _ *SubscriptionsClientBeginCancelOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/cancel" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -175,7 +171,7 @@ func (client *SubscriptionsClient) deleteOperation(ctx context.Context, billingA } // deleteCreateRequest creates the Delete request. -func (client *SubscriptionsClient) deleteCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, options *SubscriptionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) deleteCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, _ *SubscriptionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -903,7 +899,7 @@ func (client *SubscriptionsClient) merge(ctx context.Context, billingAccountName } // mergeCreateRequest creates the Merge request. -func (client *SubscriptionsClient) mergeCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters SubscriptionMergeRequest, options *SubscriptionsClientBeginMergeOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) mergeCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters SubscriptionMergeRequest, _ *SubscriptionsClientBeginMergeOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/merge" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -983,7 +979,7 @@ func (client *SubscriptionsClient) move(ctx context.Context, billingAccountName } // moveCreateRequest creates the Move request. -func (client *SubscriptionsClient) moveCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters MoveBillingSubscriptionRequest, options *SubscriptionsClientBeginMoveOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) moveCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters MoveBillingSubscriptionRequest, _ *SubscriptionsClientBeginMoveOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/move" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1062,7 +1058,7 @@ func (client *SubscriptionsClient) split(ctx context.Context, billingAccountName } // splitCreateRequest creates the Split request. -func (client *SubscriptionsClient) splitCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters SubscriptionSplitRequest, options *SubscriptionsClientBeginSplitOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) splitCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters SubscriptionSplitRequest, _ *SubscriptionsClientBeginSplitOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/split" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1139,7 +1135,7 @@ func (client *SubscriptionsClient) update(ctx context.Context, billingAccountNam } // updateCreateRequest creates the Update request. -func (client *SubscriptionsClient) updateCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters SubscriptionPatch, options *SubscriptionsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) updateCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters SubscriptionPatch, _ *SubscriptionsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -1196,7 +1192,7 @@ func (client *SubscriptionsClient) ValidateMoveEligibility(ctx context.Context, } // validateMoveEligibilityCreateRequest creates the ValidateMoveEligibility request. -func (client *SubscriptionsClient) validateMoveEligibilityCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters MoveBillingSubscriptionRequest, options *SubscriptionsClientValidateMoveEligibilityOptions) (*policy.Request, error) { +func (client *SubscriptionsClient) validateMoveEligibilityCreateRequest(ctx context.Context, billingAccountName string, billingSubscriptionName string, parameters MoveBillingSubscriptionRequest, _ *SubscriptionsClientValidateMoveEligibilityOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/validateMoveEligibility" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..745a8eeee793 100644 --- a/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client.go +++ b/sdk/resourcemanager/billing/armbilling/subscriptionsaliases_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,15 +8,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. @@ -97,7 +93,7 @@ func (client *SubscriptionsAliasesClient) createOrUpdate(ctx context.Context, bi } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SubscriptionsAliasesClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, aliasName string, parameters SubscriptionAlias, options *SubscriptionsAliasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SubscriptionsAliasesClient) createOrUpdateCreateRequest(ctx context.Context, billingAccountName string, aliasName string, parameters SubscriptionAlias, _ *SubscriptionsAliasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -152,7 +148,7 @@ func (client *SubscriptionsAliasesClient) Get(ctx context.Context, billingAccoun } // getCreateRequest creates the Get request. -func (client *SubscriptionsAliasesClient) getCreateRequest(ctx context.Context, billingAccountName string, aliasName string, options *SubscriptionsAliasesClientGetOptions) (*policy.Request, error) { +func (client *SubscriptionsAliasesClient) getCreateRequest(ctx context.Context, billingAccountName string, aliasName string, _ *SubscriptionsAliasesClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..f3ff858f43f2 100644 --- a/sdk/resourcemanager/billing/armbilling/time_rfc3339.go +++ b/sdk/resourcemanager/billing/armbilling/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -11,12 +8,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. @@ -61,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/billing/armbilling/transactions_client.go b/sdk/resourcemanager/billing/armbilling/transactions_client.go index 397ac3f24097..34c2c36186ec 100644 --- a/sdk/resourcemanager/billing/armbilling/transactions_client.go +++ b/sdk/resourcemanager/billing/armbilling/transactions_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,16 +8,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. @@ -516,7 +512,7 @@ func (client *TransactionsClient) transactionsDownloadByInvoice(ctx context.Cont } // transactionsDownloadByInvoiceCreateRequest creates the TransactionsDownloadByInvoice request. -func (client *TransactionsClient) transactionsDownloadByInvoiceCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, options *TransactionsClientBeginTransactionsDownloadByInvoiceOptions) (*policy.Request, error) { +func (client *TransactionsClient) transactionsDownloadByInvoiceCreateRequest(ctx context.Context, billingAccountName string, invoiceName string, _ *TransactionsClientBeginTransactionsDownloadByInvoiceOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactionsDownload" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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..855974ea2b9a 100644 --- a/sdk/resourcemanager/billing/armbilling/transfers_client.go +++ b/sdk/resourcemanager/billing/armbilling/transfers_client.go @@ -1,6 +1,3 @@ -//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. @@ -11,14 +8,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. @@ -74,7 +70,7 @@ func (client *TransfersClient) Cancel(ctx context.Context, billingAccountName st } // cancelCreateRequest creates the Cancel request. -func (client *TransfersClient) cancelCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, transferName string, options *TransfersClientCancelOptions) (*policy.Request, error) { +func (client *TransfersClient) cancelCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, transferName string, _ *TransfersClientCancelOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}/cancel" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -145,7 +141,7 @@ func (client *TransfersClient) Get(ctx context.Context, billingAccountName strin } // getCreateRequest creates the Get request. -func (client *TransfersClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, transferName string, options *TransfersClientGetOptions) (*policy.Request, error) { +func (client *TransfersClient) getCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, transferName string, _ *TransfersClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -218,7 +214,7 @@ func (client *TransfersClient) Initiate(ctx context.Context, billingAccountName } // initiateCreateRequest creates the Initiate request. -func (client *TransfersClient) initiateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, transferName string, parameters InitiateTransferRequest, options *TransfersClientInitiateOptions) (*policy.Request, error) { +func (client *TransfersClient) initiateCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, transferName string, parameters InitiateTransferRequest, _ *TransfersClientInitiateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") @@ -291,7 +287,7 @@ func (client *TransfersClient) NewListPager(billingAccountName string, billingPr } // listCreateRequest creates the List request. -func (client *TransfersClient) listCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, options *TransfersClientListOptions) (*policy.Request, error) { +func (client *TransfersClient) listCreateRequest(ctx context.Context, billingAccountName string, billingProfileName string, invoiceSectionName string, _ *TransfersClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers" if billingAccountName == "" { return nil, errors.New("parameter billingAccountName cannot be empty") 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), - // }, - // }}, - // } - } -}