diff --git a/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md b/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md index 6b341c99bbd8..52453962a3a3 100644 --- a/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md +++ b/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md @@ -1,5 +1,27 @@ # Release History +## 0.4.0 (2022-04-08) +### Breaking Changes + +- Struct `DownloadProperties` has been removed +- Struct `ErrorDetails` has been removed +- Struct `ErrorResponse` has been removed +- Struct `HighCasedErrorDetails` has been removed +- Struct `HighCasedErrorResponse` has been removed +- Field `Not` of struct `BudgetFilter` has been removed + +### Features Added + +- New function `*LotsClientListByCustomerPager.Err() error` +- New function `*LotsClientListByCustomerPager.NextPage(context.Context) bool` +- New function `*LotsClient.ListByCustomer(string, string, *LotsClientListByCustomerOptions) *LotsClientListByCustomerPager` +- New function `*LotsClientListByCustomerPager.PageResponse() LotsClientListByCustomerResponse` +- New struct `LotsClientListByCustomerOptions` +- New struct `LotsClientListByCustomerPager` +- New struct `LotsClientListByCustomerResponse` +- New struct `LotsClientListByCustomerResult` + + ## 0.3.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/consumption/armconsumption/autorest.md b/sdk/resourcemanager/consumption/armconsumption/autorest.md index fe6af1303f34..59e308be9a49 100644 --- a/sdk/resourcemanager/consumption/armconsumption/autorest.md +++ b/sdk/resourcemanager/consumption/armconsumption/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/consumption/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/consumption/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/consumption/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/consumption/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.3.1 +module-version: 0.4.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/consumption/armconsumption/go.mod b/sdk/resourcemanager/consumption/armconsumption/go.mod index 1d7185baeed0..16719c9ad020 100644 --- a/sdk/resourcemanager/consumption/armconsumption/go.mod +++ b/sdk/resourcemanager/consumption/armconsumption/go.mod @@ -2,7 +2,4 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armcons go 1.16 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 diff --git a/sdk/resourcemanager/consumption/armconsumption/go.sum b/sdk/resourcemanager/consumption/armconsumption/go.sum index 2ce51d3b8174..e0ad585956d9 100644 --- a/sdk/resourcemanager/consumption/armconsumption/go.sum +++ b/sdk/resourcemanager/consumption/armconsumption/go.sum @@ -1,26 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -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/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -28,32 +13,23 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_aggregatedcost_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_aggregatedcost_client_test.go deleted file mode 100644 index 0558ef3046ac..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_aggregatedcost_client_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostByManagementGroup.json -func ExampleAggregatedCostClient_GetByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewAggregatedCostClient(cred, nil) - res, err := client.GetByManagementGroup(ctx, - "", - &armconsumption.AggregatedCostClientGetByManagementGroupOptions{Filter: nil}) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.AggregatedCostClientGetByManagementGroupResult) -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostForBillingPeriodByManagementGroup.json -func ExampleAggregatedCostClient_GetForBillingPeriodByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewAggregatedCostClient(cred, nil) - res, err := client.GetForBillingPeriodByManagementGroup(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.AggregatedCostClientGetForBillingPeriodByManagementGroupResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_balances_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_balances_client_test.go deleted file mode 100644 index 94365b567811..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_balances_client_test.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BalancesByBillingAccount.json -func ExampleBalancesClient_GetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewBalancesClient(cred, nil) - res, err := client.GetByBillingAccount(ctx, - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BalancesClientGetByBillingAccountResult) -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BalancesByBillingAccountForBillingPeriod.json -func ExampleBalancesClient_GetForBillingPeriodByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewBalancesClient(cred, nil) - res, err := client.GetForBillingPeriodByBillingAccount(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BalancesClientGetForBillingPeriodByBillingAccountResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_budgets_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_budgets_client_test.go deleted file mode 100644 index 9ca6fd2cec9e..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_budgets_client_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_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/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BudgetsList.json -func ExampleBudgetsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewBudgetsClient(cred, nil) - pager := client.List("", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/Budget.json -func ExampleBudgetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewBudgetsClient(cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BudgetsClientGetResult) -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/CreateOrUpdateBudget.json -func ExampleBudgetsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewBudgetsClient(cred, nil) - res, err := client.CreateOrUpdate(ctx, - "", - "", - armconsumption.Budget{ - ETag: to.StringPtr(""), - Properties: &armconsumption.BudgetProperties{ - Amount: to.Float64Ptr(100.65), - Category: armconsumption.CategoryType("Cost").ToPtr(), - Filter: &armconsumption.BudgetFilter{ - And: []*armconsumption.BudgetFilterProperties{ - { - Dimensions: &armconsumption.BudgetComparisonExpression{ - Name: to.StringPtr(""), - Operator: armconsumption.BudgetOperatorType("In").ToPtr(), - Values: []*string{ - to.StringPtr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), - to.StringPtr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, - }, - }, - { - Tags: &armconsumption.BudgetComparisonExpression{ - Name: to.StringPtr(""), - Operator: armconsumption.BudgetOperatorType("In").ToPtr(), - Values: []*string{ - to.StringPtr("Dev"), - to.StringPtr("Prod")}, - }, - }, - { - Tags: &armconsumption.BudgetComparisonExpression{ - Name: to.StringPtr(""), - Operator: armconsumption.BudgetOperatorType("In").ToPtr(), - Values: []*string{ - to.StringPtr("engineering"), - to.StringPtr("sales")}, - }, - }}, - }, - Notifications: map[string]*armconsumption.Notification{ - "Actual_GreaterThan_80_Percent": { - ContactEmails: []*string{ - to.StringPtr("johndoe@contoso.com"), - to.StringPtr("janesmith@contoso.com")}, - ContactGroups: []*string{ - to.StringPtr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, - ContactRoles: []*string{ - to.StringPtr("Contributor"), - to.StringPtr("Reader")}, - Enabled: to.BoolPtr(true), - Locale: armconsumption.CultureCode("en-us").ToPtr(), - Operator: armconsumption.OperatorType("GreaterThan").ToPtr(), - Threshold: to.Float64Ptr(80), - ThresholdType: armconsumption.ThresholdType("Actual").ToPtr(), - }, - }, - TimeGrain: armconsumption.TimeGrainType("Monthly").ToPtr(), - TimePeriod: &armconsumption.BudgetTimePeriod{ - EndDate: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00Z"); return t }()), - StartDate: to.TimePtr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t }()), - }, - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.BudgetsClientCreateOrUpdateResult) -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/DeleteBudget.json -func ExampleBudgetsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewBudgetsClient(cred, nil) - _, err = client.Delete(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_charges_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_charges_client_test.go deleted file mode 100644 index 731d9a1ffc53..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_charges_client_test.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesForBillingPeriodByDepartment.json -func ExampleChargesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewChargesClient(cred, nil) - res, err := client.List(ctx, - "", - &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: nil, - }) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ChargesClientListResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_credits_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_credits_client_test.go deleted file mode 100644 index 0b5769162a4a..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_credits_client_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/CreditSummaryByBillingProfile.json -func ExampleCreditsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewCreditsClient(cred, nil) - res, err := client.Get(ctx, - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.CreditsClientGetResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_events_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_events_client_test.go deleted file mode 100644 index b7aba0ff4992..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_events_client_test.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsListByBillingProfile.json -func ExampleEventsClient_ListByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewEventsClient(cred, nil) - pager := client.ListByBillingProfile("", - "", - "", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsGetByBillingAccount.json -func ExampleEventsClient_ListByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewEventsClient(cred, nil) - pager := client.ListByBillingAccount("", - &armconsumption.EventsClientListByBillingAccountOptions{Filter: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_lots_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_lots_client_test.go deleted file mode 100644 index aec7eae6f6c8..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_lots_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingProfile.json -func ExampleLotsClient_ListByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewLotsClient(cred, nil) - pager := client.ListByBillingProfile("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingAccount.json -func ExampleLotsClient_ListByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewLotsClient(cred, nil) - pager := client.ListByBillingAccount("", - &armconsumption.LotsClientListByBillingAccountOptions{Filter: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_marketplaces_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_marketplaces_client_test.go deleted file mode 100644 index c129002413a3..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_marketplaces_client_test.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByBillingAccountList.json -func ExampleMarketplacesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewMarketplacesClient(cred, nil) - pager := client.List("", - &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: nil, - Skiptoken: nil, - }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_pricesheet_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_pricesheet_client_test.go deleted file mode 100644 index 35021fd53c6b..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_pricesheet_client_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_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/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheet.json -func ExamplePriceSheetClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewPriceSheetClient("", cred, nil) - res, err := client.Get(ctx, - &armconsumption.PriceSheetClientGetOptions{Expand: nil, - Skiptoken: nil, - Top: nil, - }) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PriceSheetClientGetResult) -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheetExpand.json -func ExamplePriceSheetClient_GetByBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewPriceSheetClient("", cred, nil) - res, err := client.GetByBillingPeriod(ctx, - "", - &armconsumption.PriceSheetClientGetByBillingPeriodOptions{Expand: to.StringPtr(""), - Skiptoken: nil, - Top: nil, - }) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.PriceSheetClientGetByBillingPeriodResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationrecommendationdetails_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationrecommendationdetails_client_test.go deleted file mode 100644 index cfc87b916e13..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationrecommendationdetails_client_test.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByBillingAccount.json -func ExampleReservationRecommendationDetailsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationRecommendationDetailsClient(cred, nil) - res, err := client.Get(ctx, - "", - "", - armconsumption.Term("P1Y"), - armconsumption.LookBackPeriod("Last60Days"), - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ReservationRecommendationDetailsClientGetResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationrecommendations_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationrecommendations_client_test.go deleted file mode 100644 index f0d7b82e956d..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationrecommendations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByBillingAccount.json -func ExampleReservationRecommendationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationRecommendationsClient(cred, nil) - pager := client.List("", - &armconsumption.ReservationRecommendationsClientListOptions{Filter: nil}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationsdetails_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationsdetails_client_test.go deleted file mode 100644 index 457b6f305509..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationsdetails_client_test.go +++ /dev/null @@ -1,98 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_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/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetails.json -func ExampleReservationsDetailsClient_ListByReservationOrder() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationsDetailsClient(cred, nil) - pager := client.ListByReservationOrder("", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsWithReservationId.json -func ExampleReservationsDetailsClient_ListByReservationOrderAndReservation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationsDetailsClient(cred, nil) - pager := client.ListByReservationOrderAndReservation("", - "", - "", - nil) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingAccountId.json -func ExampleReservationsDetailsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationsDetailsClient(cred, nil) - pager := client.List("", - &armconsumption.ReservationsDetailsClientListOptions{StartDate: nil, - EndDate: nil, - Filter: to.StringPtr(""), - ReservationID: nil, - ReservationOrderID: nil, - }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationssummaries_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationssummaries_client_test.go deleted file mode 100644 index 84c45443c354..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationssummaries_client_test.go +++ /dev/null @@ -1,99 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_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/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDaily.json -func ExampleReservationsSummariesClient_ListByReservationOrder() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationsSummariesClient(cred, nil) - pager := client.ListByReservationOrder("", - armconsumption.Datagrain("daily"), - &armconsumption.ReservationsSummariesClientListByReservationOrderOptions{Filter: to.StringPtr("")}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithReservationId.json -func ExampleReservationsSummariesClient_ListByReservationOrderAndReservation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationsSummariesClient(cred, nil) - pager := client.ListByReservationOrderAndReservation("", - "", - armconsumption.Datagrain("daily"), - &armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationOptions{Filter: to.StringPtr("")}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithBillingAccountId.json -func ExampleReservationsSummariesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationsSummariesClient(cred, nil) - pager := client.List("", - armconsumption.Datagrain("daily"), - &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: to.StringPtr(""), - ReservationID: nil, - ReservationOrderID: nil, - }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationtransactions_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationtransactions_client_test.go deleted file mode 100644 index e7aa46fca775..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_reservationtransactions_client_test.go +++ /dev/null @@ -1,67 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_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/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationTransactionsListByEnrollmentNumber.json -func ExampleReservationTransactionsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationTransactionsClient(cred, nil) - pager := client.List("", - &armconsumption.ReservationTransactionsClientListOptions{Filter: to.StringPtr("")}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationTransactionsListByBillingProfileId.json -func ExampleReservationTransactionsClient_ListByBillingProfile() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewReservationTransactionsClient(cred, nil) - pager := client.ListByBillingProfile("", - "", - &armconsumption.ReservationTransactionsClientListByBillingProfileOptions{Filter: to.StringPtr("")}) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_tags_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_tags_client_test.go deleted file mode 100644 index d20425eb11c8..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_tags_client_test.go +++ /dev/null @@ -1,34 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/Tags.json -func ExampleTagsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewTagsClient(cred, nil) - res, err := client.Get(ctx, - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.TagsClientGetResult) -} diff --git a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_usagedetails_client_test.go b/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_usagedetails_client_test.go deleted file mode 100644 index f4c259e8fbca..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/ze_generated_example_usagedetails_client_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armconsumption_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption" -) - -// x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByBillingAccount.json -func ExampleUsageDetailsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armconsumption.NewUsageDetailsClient(cred, nil) - pager := client.List("", - &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: nil, - }) - for { - nextResult := pager.NextPage(ctx) - if err := pager.Err(); err != nil { - log.Fatalf("failed to advance page: %v", err) - } - if !nextResult { - break - } - for _, v := range pager.PageResponse().Value { - log.Printf("Pager result: %#v\n", v) - } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go index 9c9c7c7a3545..f18fb4cd0026 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go @@ -32,16 +32,16 @@ type AggregatedCostClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewAggregatedCostClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AggregatedCostClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &AggregatedCostClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go index 8bcb25be7f14..bc01549923f7 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go @@ -32,16 +32,16 @@ type BalancesClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewBalancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *BalancesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &BalancesClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go index 68f0845cb0b2..6dc122b0fdf4 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go @@ -32,16 +32,16 @@ type BudgetsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewBudgetsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *BudgetsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &BudgetsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go index bde737177333..690085f97b55 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go @@ -30,16 +30,16 @@ type ChargesClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewChargesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ChargesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ChargesClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go index 2428f2054604..a87dd0200304 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go @@ -10,7 +10,7 @@ package armconsumption const ( moduleName = "armconsumption" - moduleVersion = "v0.3.1" + moduleVersion = "v0.4.0" ) // BillingFrequency - The billing frequency. diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go index 0614bff0b5dd..6be52086d178 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go @@ -32,16 +32,16 @@ type CreditsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewCreditsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *CreditsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &CreditsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go index df025d48e00e..03f5d10c9835 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go @@ -32,16 +32,16 @@ type EventsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewEventsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EventsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &EventsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go index f01b6dca9325..1383f633cdac 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go @@ -32,23 +32,22 @@ type LotsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewLotsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *LotsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &LotsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } -// ListByBillingAccount - Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a billing -// profile. Microsoft Azure consumption commitments are only supported for the billing account -// scope. +// ListByBillingAccount - Lists all Microsoft Azure consumption commitments for a billing account. The API is only supported +// for Microsoft Customer Agreements (MCA) and Direct Enterprise Agreement (EA) billing accounts. // If the operation fails it returns an *azcore.ResponseError type. // billingAccountID - BillingAccount ID // options - LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.ListByBillingAccount @@ -95,9 +94,8 @@ func (client *LotsClient) listByBillingAccountHandleResponse(resp *http.Response return result, nil } -// ListByBillingProfile - Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a billing -// profile. Microsoft Azure consumption commitments are only supported for the billing account -// scope. +// ListByBillingProfile - Lists all Azure credits for a billing account or a billing profile. The API is only supported for +// Microsoft Customer Agreements (MCA) billing accounts. // If the operation fails it returns an *azcore.ResponseError type. // billingAccountID - BillingAccount ID // billingProfileID - Azure Billing Profile ID. @@ -145,3 +143,55 @@ func (client *LotsClient) listByBillingProfileHandleResponse(resp *http.Response } return result, nil } + +// ListByCustomer - Lists all Azure credits for a customer. The API is only supported for Microsoft Partner Agreements (MPA) +// billing accounts. +// If the operation fails it returns an *azcore.ResponseError type. +// billingAccountID - BillingAccount ID +// customerID - Customer ID +// options - LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.ListByCustomer method. +func (client *LotsClient) ListByCustomer(billingAccountID string, customerID string, options *LotsClientListByCustomerOptions) *LotsClientListByCustomerPager { + return &LotsClientListByCustomerPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByCustomerCreateRequest(ctx, billingAccountID, customerID, options) + }, + advancer: func(ctx context.Context, resp LotsClientListByCustomerResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.Lots.NextLink) + }, + } +} + +// listByCustomerCreateRequest creates the ListByCustomer request. +func (client *LotsClient) listByCustomerCreateRequest(ctx context.Context, billingAccountID string, customerID string, options *LotsClientListByCustomerOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}/providers/Microsoft.Consumption/lots" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + if customerID == "" { + return nil, errors.New("parameter customerID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customerId}", url.PathEscape(customerID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByCustomerHandleResponse handles the ListByCustomer response. +func (client *LotsClient) listByCustomerHandleResponse(resp *http.Response) (LotsClientListByCustomerResponse, error) { + result := LotsClientListByCustomerResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Lots); err != nil { + return LotsClientListByCustomerResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go index 444977dda91d..22b65eebace0 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go @@ -31,16 +31,16 @@ type MarketplacesClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewMarketplacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MarketplacesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &MarketplacesClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go index bbfbceecae2d..5d71702cbc68 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go @@ -231,9 +231,6 @@ type BudgetFilter struct { // Has comparison expression for a dimension Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"` - // The logical "NOT" expression. - Not *BudgetFilterProperties `json:"not,omitempty"` - // Has comparison expression for a tag Tags *BudgetComparisonExpression `json:"tags,omitempty"` } @@ -243,7 +240,6 @@ func (b BudgetFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "and", b.And) populate(objectMap, "dimensions", b.Dimensions) - populate(objectMap, "not", b.Not) populate(objectMap, "tags", b.Tags) return json.Marshal(objectMap) } @@ -545,38 +541,6 @@ type CurrentSpend struct { Unit *string `json:"unit,omitempty" azure:"ro"` } -// DownloadProperties - The properties of the price sheet download. -type DownloadProperties struct { - // READ-ONLY; The link (url) to download the pricesheet. - DownloadURL *string `json:"downloadUrl,omitempty" azure:"ro"` - - // READ-ONLY; Download link validity. - ValidTill *string `json:"validTill,omitempty" azure:"ro"` -} - -// ErrorDetails - The details of the error. -type ErrorDetails struct { - // READ-ONLY; Error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty" azure:"ro"` -} - -// ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided -// in the error message. -// Some Error responses: -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" -// header. -// -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" -// header. -type ErrorResponse struct { - // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` -} - // EventProperties - The event properties. type EventProperties struct { // Identifies the type of the event. @@ -826,29 +790,6 @@ type ForecastSpend struct { Unit *string `json:"unit,omitempty" azure:"ro"` } -// HighCasedErrorDetails - The details of the error. -type HighCasedErrorDetails struct { - // READ-ONLY; Error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty" azure:"ro"` -} - -// HighCasedErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason -// is provided in the error message. -// Some Error responses: -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" -// header. -// -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" -// header. -type HighCasedErrorResponse struct { - // The details of the error. - Error *HighCasedErrorDetails `json:"error,omitempty"` -} - // LegacyChargeSummary - Legacy charge summary. type LegacyChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. @@ -2352,6 +2293,14 @@ type LotsClientListByBillingProfileOptions struct { // placeholder for future optional parameters } +// LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.ListByCustomer method. +type LotsClientListByCustomerOptions struct { + // May be used to filter the lots by Status, Source etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. Tag + // filter is a key value pair string where key and value is separated by a colon + // (:). + Filter *string +} + // ManagementGroupAggregatedCostProperties - The properties of the Management Group Aggregated Cost. type ManagementGroupAggregatedCostProperties struct { // Children of a management group diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go index 9a596b1c6d91..14e6ce343494 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go @@ -29,16 +29,16 @@ type OperationsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go index a851f02a390d..46d0d3488ce7 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go @@ -286,6 +286,60 @@ func (p *LotsClientListByBillingProfilePager) PageResponse() LotsClientListByBil return p.current } +// LotsClientListByCustomerPager provides operations for iterating over paged responses. +type LotsClientListByCustomerPager struct { + client *LotsClient + current LotsClientListByCustomerResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, LotsClientListByCustomerResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *LotsClientListByCustomerPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *LotsClientListByCustomerPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.Lots.NextLink == nil || len(*p.current.Lots.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByCustomerHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current LotsClientListByCustomerResponse page. +func (p *LotsClientListByCustomerPager) PageResponse() LotsClientListByCustomerResponse { + return p.current +} + // MarketplacesClientListPager provides operations for iterating over paged responses. type MarketplacesClientListPager struct { client *MarketplacesClient diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go index 72ec9b0c9668..c04209e13727 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go @@ -35,17 +35,17 @@ type PriceSheetClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewPriceSheetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PriceSheetClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &PriceSheetClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go index e5dd9eac657c..e1bc970ec52a 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go @@ -30,16 +30,16 @@ type ReservationRecommendationDetailsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewReservationRecommendationDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationRecommendationDetailsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ReservationRecommendationDetailsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go index 9a757691607c..13db8503e573 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go @@ -30,16 +30,16 @@ type ReservationRecommendationsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewReservationRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationRecommendationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ReservationRecommendationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go index 48612c3de43d..aa0b6e1ff9a0 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go @@ -32,16 +32,16 @@ type ReservationsDetailsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewReservationsDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationsDetailsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ReservationsDetailsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go index f2a6caff12f8..01945b8ad4dd 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go @@ -32,16 +32,16 @@ type ReservationsSummariesClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewReservationsSummariesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationsSummariesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ReservationsSummariesClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go index 63f6c957c688..f0cfe33de803 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go @@ -32,16 +32,16 @@ type ReservationTransactionsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewReservationTransactionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationTransactionsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ReservationTransactionsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_response_types.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_response_types.go index b67a1c0de9ae..7813dbda9240 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_response_types.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_response_types.go @@ -172,6 +172,18 @@ type LotsClientListByBillingProfileResult struct { Lots } +// LotsClientListByCustomerResponse contains the response from method LotsClient.ListByCustomer. +type LotsClientListByCustomerResponse struct { + LotsClientListByCustomerResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LotsClientListByCustomerResult contains the result from method LotsClient.ListByCustomer. +type LotsClientListByCustomerResult struct { + Lots +} + // MarketplacesClientListResponse contains the response from method MarketplacesClient.List. type MarketplacesClientListResponse struct { MarketplacesClientListResult diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go index 7c9516a26afe..9dbc58340628 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go @@ -30,16 +30,16 @@ type TagsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewTagsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *TagsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &TagsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go index fdd5694928c0..70dc77cfff9a 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go @@ -31,16 +31,16 @@ type UsageDetailsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewUsageDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *UsageDetailsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &UsageDetailsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client }