From 5af0247fac8cdb3f244b188d7007ae0cb73e1eb0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 10 Oct 2023 00:09:16 +0000 Subject: [PATCH] CodeGen from PR 25751 in Azure/azure-rest-api-specs Merge a2a20cf7ffe93f39ddf58906cb23537b492353dc into c1af3ab8e803da2f40fc90217a6d023bc13b677f --- .../consumption/armconsumption/CHANGELOG.md | 33 + .../armconsumption/aggregatedcost_client.go | 33 +- .../aggregatedcost_client_example_test.go | 182 -- .../consumption/armconsumption/autorest.md | 6 +- .../armconsumption/balances_client.go | 33 +- .../balances_client_example_test.go | 126 -- .../armconsumption/budgets_client.go | 62 +- .../budgets_client_example_test.go | 448 ---- .../armconsumption/charges_client.go | 22 +- .../charges_client_example_test.go | 802 ------- .../armconsumption/client_factory.go | 67 +- .../consumption/armconsumption/constants.go | 59 +- .../armconsumption/credits_client.go | 18 +- .../credits_client_example_test.go | 73 - .../armconsumption/events_client.go | 11 +- .../events_client_example_test.go | 416 ---- .../consumption/armconsumption/go.mod | 22 +- .../consumption/armconsumption/go.sum | 38 +- .../consumption/armconsumption/interfaces.go | 54 + .../consumption/armconsumption/lots_client.go | 15 +- .../lots_client_example_test.go | 342 --- .../armconsumption/marketplaces_client.go | 7 +- .../marketplaces_client_example_test.go | 746 ------ .../consumption/armconsumption/models.go | 2005 ++++++++--------- .../armconsumption/models_serde.go | 352 ++- .../armconsumption/operations_client.go | 7 +- .../operations_client_example_test.go | 55 - .../consumption/armconsumption/options.go | 320 +++ .../armconsumption/polymorphic_helpers.go | 46 +- .../armconsumption/pricesheet_client.go | 101 +- .../pricesheet_client_example_test.go | 150 -- ...reservationrecommendationdetails_client.go | 21 +- ...commendationdetails_client_example_test.go | 345 --- .../reservationrecommendations_client.go | 7 +- ...tionrecommendations_client_example_test.go | 443 ---- .../reservationsdetails_client.go | 34 +- ...reservationsdetails_client_example_test.go | 268 --- .../reservationssummaries_client.go | 28 +- ...servationssummaries_client_example_test.go | 480 ---- .../reservationtransactions_client.go | 32 +- ...rvationtransactions_client_example_test.go | 166 -- .../armconsumption/response_types.go | 41 +- .../consumption/armconsumption/tags_client.go | 18 +- .../tags_client_example_test.go | 75 - .../armconsumption/time_rfc3339.go | 3 +- .../armconsumption/usagedetails_client.go | 16 +- .../usagedetails_client_example_test.go | 1662 -------------- 47 files changed, 2198 insertions(+), 8092 deletions(-) delete mode 100644 sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/balances_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/budgets_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/charges_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/credits_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/events_client_example_test.go create mode 100644 sdk/resourcemanager/consumption/armconsumption/interfaces.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/lots_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/marketplaces_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/operations_client_example_test.go create mode 100644 sdk/resourcemanager/consumption/armconsumption/options.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/pricesheet_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/tags_client_example_test.go delete mode 100644 sdk/resourcemanager/consumption/armconsumption/usagedetails_client_example_test.go diff --git a/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md b/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md index 7811671ba4e4..6d9c8ebbf040 100644 --- a/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md +++ b/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md @@ -1,5 +1,38 @@ # Release History +## 2.0.0 (2023-10-10) +### Breaking Changes + +- Type of `ModernReservationRecommendation.Properties` has been changed from `*ModernReservationRecommendationProperties` to `ModernReservationRecommendationPropertiesClassification` +- Field `Etag`, `Tags` of struct `CreditSummary` has been removed +- Field `MarketplaceCharges` of struct `LegacyChargeSummaryProperties` has been removed + +### Features Added + +- New value `EventTypeCreditExpired` added to enum type `EventType` +- New enum type `OperationStatusType` with values `OperationStatusTypeCompleted`, `OperationStatusTypeFailed`, `OperationStatusTypeRunning` +- New enum type `OrganizationType` with values `OrganizationTypeContributorOrganizationType`, `OrganizationTypePrimaryOrganizationType` +- New function `*ModernReservationRecommendationProperties.GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties` +- New function `*ModernSharedScopeReservationRecommendationProperties.GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties` +- New function `*ModernSingleScopeReservationRecommendationProperties.GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties` +- New function `*PriceSheetClient.BeginDownloadByBillingAccountPeriod(context.Context, string, string, *PriceSheetClientBeginDownloadByBillingAccountPeriodOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingAccountPeriodResponse], error)` +- New struct `ModernSharedScopeReservationRecommendationProperties` +- New struct `ModernSingleScopeReservationRecommendationProperties` +- New struct `OperationStatus` +- New struct `PricesheetDownloadProperties` +- New struct `SavingsPlan` +- New field `OverageRefund` in struct `BalanceProperties` +- New field `ETag` in struct `CreditSummary` +- New field `IsEstimatedBalance` in struct `CreditSummaryProperties` +- New field `BillingAccountDisplayName`, `BillingAccountID`, `IsEstimatedBalance` in struct `EventProperties` +- New field `AzureMarketplaceCharges` in struct `LegacyChargeSummaryProperties` +- New field `IsEstimatedBalance`, `OrganizationType`, `UsedAmount` in struct `LotProperties` +- New field `SubscriptionID` in struct `ModernChargeSummaryProperties` +- New field `SavingsPlan` in struct `PriceSheetProperties` +- New field `Filter` in struct `ReservationRecommendationDetailsClientGetOptions` +- New field `PreviewMarkupPercentage`, `UseMarkupIfPartner` in struct `ReservationTransactionsClientListOptions` + + ## 1.1.0 (2023-03-28) ### Features Added diff --git a/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client.go b/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client.go index bc73f9bb46cd..b2efc1ed8467 100644 --- a/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -45,23 +44,26 @@ func NewAggregatedCostClient(credential azcore.TokenCredential, options *arm.Cli // period. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - managementGroupID - Azure Management Group ID. // - options - AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup // method. func (client *AggregatedCostClient) GetByManagementGroup(ctx context.Context, managementGroupID string, options *AggregatedCostClientGetByManagementGroupOptions) (AggregatedCostClientGetByManagementGroupResponse, error) { + var err error req, err := client.getByManagementGroupCreateRequest(ctx, managementGroupID, options) if err != nil { return AggregatedCostClientGetByManagementGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AggregatedCostClientGetByManagementGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AggregatedCostClientGetByManagementGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AggregatedCostClientGetByManagementGroupResponse{}, err } - return client.getByManagementGroupHandleResponse(resp) + resp, err := client.getByManagementGroupHandleResponse(httpResp) + return resp, err } // getByManagementGroupCreateRequest creates the GetByManagementGroup request. @@ -76,7 +78,7 @@ func (client *AggregatedCostClient) getByManagementGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -98,24 +100,27 @@ func (client *AggregatedCostClient) getByManagementGroupHandleResponse(resp *htt // by specified billing period // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - managementGroupID - Azure Management Group ID. // - billingPeriodName - Billing Period Name. // - options - AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup // method. func (client *AggregatedCostClient) GetForBillingPeriodByManagementGroup(ctx context.Context, managementGroupID string, billingPeriodName string, options *AggregatedCostClientGetForBillingPeriodByManagementGroupOptions) (AggregatedCostClientGetForBillingPeriodByManagementGroupResponse, error) { + var err error req, err := client.getForBillingPeriodByManagementGroupCreateRequest(ctx, managementGroupID, billingPeriodName, options) if err != nil { return AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AggregatedCostClientGetForBillingPeriodByManagementGroupResponse{}, err } - return client.getForBillingPeriodByManagementGroupHandleResponse(resp) + resp, err := client.getForBillingPeriodByManagementGroupHandleResponse(httpResp) + return resp, err } // getForBillingPeriodByManagementGroupCreateRequest creates the GetForBillingPeriodByManagementGroup request. @@ -134,7 +139,7 @@ func (client *AggregatedCostClient) getForBillingPeriodByManagementGroupCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client_example_test.go deleted file mode 100644 index f1c04ba39d90..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/aggregatedcost_client_example_test.go +++ /dev/null @@ -1,182 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostByManagementGroup.json -func ExampleAggregatedCostClient_GetByManagementGroup_aggregatedCostByManagementGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAggregatedCostClient().GetByManagementGroup(ctx, "managementGroupForTest", &armconsumption.AggregatedCostClientGetByManagementGroupOptions{Filter: 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.ManagementGroupAggregatedCostResult = armconsumption.ManagementGroupAggregatedCostResult{ - // Name: to.Ptr("aggregatedcostId1"), - // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupForTest/providers/Microsoft.Consumption/aggregatedcostId1"), - // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ - // AzureCharges: to.Ptr[float64](250.9876), - // ChargesBilledSeparately: to.Ptr[float64](120.345), - // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ - // { - // Name: to.Ptr("aggregatedcostId2"), - // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupChildForTest/providers/Microsoft.Consumption/aggregatedcostId2"), - // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ - // AzureCharges: to.Ptr[float64](150), - // ChargesBilledSeparately: to.Ptr[float64](30.345), - // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ - // }, - // Currency: to.Ptr("USD"), - // ExcludedSubscriptions: []*string{ - // }, - // IncludedSubscriptions: []*string{ - // to.Ptr("c349567d-c83a-48c9-ab0e-578c69dc97a4")}, - // MarketplaceCharges: to.Ptr[float64](50.786), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.0000000Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.0000000Z"); return t}()), - // }, - // }}, - // Currency: to.Ptr("USD"), - // ExcludedSubscriptions: []*string{ - // }, - // IncludedSubscriptions: []*string{ - // to.Ptr("1caaa5a3-2b66-438e-8ab4-bce37d518c5d")}, - // MarketplaceCharges: to.Ptr[float64](150.786), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00.0000000Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.0000000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/AggregatedCostByManagementGroupFilterByDate.json -func ExampleAggregatedCostClient_GetByManagementGroup_aggregatedCostByManagementGroupFilterByDate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAggregatedCostClient().GetByManagementGroup(ctx, "managementGroupForTest", &armconsumption.AggregatedCostClientGetByManagementGroupOptions{Filter: to.Ptr("usageStart ge '2018-08-15' and properties/usageStart le '2018-08-31'")}) - 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.ManagementGroupAggregatedCostResult = armconsumption.ManagementGroupAggregatedCostResult{ - // Name: to.Ptr("aggregatedcostId1"), - // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupForTest/providers/Microsoft.Consumption/aggregatedcostId1"), - // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ - // AzureCharges: to.Ptr[float64](150.9876), - // ChargesBilledSeparately: to.Ptr[float64](90.345), - // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ - // { - // Name: to.Ptr("aggregatedcostId2"), - // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupChildForTest/providers/Microsoft.Consumption/aggregatedcostId2"), - // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ - // AzureCharges: to.Ptr[float64](50), - // ChargesBilledSeparately: to.Ptr[float64](30.345), - // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ - // }, - // Currency: to.Ptr("USD"), - // ExcludedSubscriptions: []*string{ - // }, - // IncludedSubscriptions: []*string{ - // to.Ptr("c349567d-c83a-48c9-ab0e-578c69dc97a4")}, - // MarketplaceCharges: to.Ptr[float64](10.786), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-31T00:00:00.0000000Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.0000000Z"); return t}()), - // }, - // }}, - // Currency: to.Ptr("USD"), - // ExcludedSubscriptions: []*string{ - // }, - // IncludedSubscriptions: []*string{ - // to.Ptr("1caaa5a3-2b66-438e-8ab4-bce37d518c5d")}, - // MarketplaceCharges: to.Ptr[float64](80.786), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-31T00:00:00.0000000Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.0000000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAggregatedCostClient().GetForBillingPeriodByManagementGroup(ctx, "managementGroupForTest", "201807", 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.ManagementGroupAggregatedCostResult = armconsumption.ManagementGroupAggregatedCostResult{ - // Name: to.Ptr("aggregatedcostId1"), - // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupForTest/providers/Microsoft.Consumption/aggregatedcostId1"), - // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ - // AzureCharges: to.Ptr[float64](250.9876), - // ChargesBilledSeparately: to.Ptr[float64](120.345), - // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ - // { - // Name: to.Ptr("aggregatedcostId2"), - // Type: to.Ptr("Microsoft.Consumption/aggregatedcost"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/managementGroupChildForTest/providers/Microsoft.Consumption/aggregatedcostId2"), - // Properties: &armconsumption.ManagementGroupAggregatedCostProperties{ - // AzureCharges: to.Ptr[float64](150), - // ChargesBilledSeparately: to.Ptr[float64](30.345), - // Children: []*armconsumption.ManagementGroupAggregatedCostResult{ - // }, - // Currency: to.Ptr("USD"), - // MarketplaceCharges: to.Ptr[float64](50.786), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-31T00:00:00.0000000Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-01T00:00:00.0000000Z"); return t}()), - // }, - // }}, - // Currency: to.Ptr("USD"), - // MarketplaceCharges: to.Ptr[float64](150.786), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-31T00:00:00.0000000Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-07-01T00:00:00.0000000Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/autorest.md b/sdk/resourcemanager/consumption/armconsumption/autorest.md index f7c849a76377..acc8c3dfe68b 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/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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: 1.1.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/consumption/armconsumption/balances_client.go b/sdk/resourcemanager/consumption/armconsumption/balances_client.go index f66588c43eb5..e36ebc41c905 100644 --- a/sdk/resourcemanager/consumption/armconsumption/balances_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/balances_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -45,23 +44,26 @@ func NewBalancesClient(credential azcore.TokenCredential, options *arm.ClientOpt // 1, 2014 or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - options - BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount // method. func (client *BalancesClient) GetByBillingAccount(ctx context.Context, billingAccountID string, options *BalancesClientGetByBillingAccountOptions) (BalancesClientGetByBillingAccountResponse, error) { + var err error req, err := client.getByBillingAccountCreateRequest(ctx, billingAccountID, options) if err != nil { return BalancesClientGetByBillingAccountResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BalancesClientGetByBillingAccountResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BalancesClientGetByBillingAccountResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BalancesClientGetByBillingAccountResponse{}, err } - return client.getByBillingAccountHandleResponse(resp) + resp, err := client.getByBillingAccountHandleResponse(httpResp) + return resp, err } // getByBillingAccountCreateRequest creates the GetByBillingAccount request. @@ -76,7 +78,7 @@ func (client *BalancesClient) getByBillingAccountCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -95,24 +97,27 @@ func (client *BalancesClient) getByBillingAccountHandleResponse(resp *http.Respo // available via this API only for May 1, 2014 or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - billingPeriodName - Billing Period Name. // - options - BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount // method. func (client *BalancesClient) GetForBillingPeriodByBillingAccount(ctx context.Context, billingAccountID string, billingPeriodName string, options *BalancesClientGetForBillingPeriodByBillingAccountOptions) (BalancesClientGetForBillingPeriodByBillingAccountResponse, error) { + var err error req, err := client.getForBillingPeriodByBillingAccountCreateRequest(ctx, billingAccountID, billingPeriodName, options) if err != nil { return BalancesClientGetForBillingPeriodByBillingAccountResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BalancesClientGetForBillingPeriodByBillingAccountResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BalancesClientGetForBillingPeriodByBillingAccountResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BalancesClientGetForBillingPeriodByBillingAccountResponse{}, err } - return client.getForBillingPeriodByBillingAccountHandleResponse(resp) + resp, err := client.getForBillingPeriodByBillingAccountHandleResponse(httpResp) + return resp, err } // getForBillingPeriodByBillingAccountCreateRequest creates the GetForBillingPeriodByBillingAccount request. @@ -131,7 +136,7 @@ func (client *BalancesClient) getForBillingPeriodByBillingAccountCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/balances_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/balances_client_example_test.go deleted file mode 100644 index fc9aad9bb97c..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/balances_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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBalancesClient().GetByBillingAccount(ctx, "123456", 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.Balance = armconsumption.Balance{ - // Name: to.Ptr("balanceId1"), - // Type: to.Ptr("Microsoft.Consumption/balances"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/balances/balanceId1"), - // Properties: &armconsumption.BalanceProperties{ - // AdjustmentDetails: []*armconsumption.BalancePropertiesAdjustmentDetailsItem{ - // { - // Name: to.Ptr("Promo Credit"), - // Value: to.Ptr[float64](1.1), - // }, - // { - // Name: to.Ptr("SIE Credit"), - // Value: to.Ptr[float64](1), - // }}, - // Adjustments: to.Ptr[float64](0), - // AzureMarketplaceServiceCharges: to.Ptr[float64](609.82), - // BeginningBalance: to.Ptr[float64](3396469.19), - // BillingFrequency: to.Ptr(armconsumption.BillingFrequencyMonth), - // ChargesBilledSeparately: to.Ptr[float64](0), - // Currency: to.Ptr("USD "), - // EndingBalance: to.Ptr[float64](2922371.02), - // NewPurchases: to.Ptr[float64](0), - // NewPurchasesDetails: []*armconsumption.BalancePropertiesNewPurchasesDetailsItem{ - // { - // Name: to.Ptr("Promo Purchase"), - // Value: to.Ptr[float64](1), - // }}, - // PriceHidden: to.Ptr(false), - // ServiceOverage: to.Ptr[float64](0), - // TotalOverage: to.Ptr[float64](0), - // TotalUsage: to.Ptr[float64](474098.17), - // Utilized: to.Ptr[float64](474098.17), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBalancesClient().GetForBillingPeriodByBillingAccount(ctx, "123456", "201702", 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.Balance = armconsumption.Balance{ - // Name: to.Ptr("balanceId1"), - // Type: to.Ptr("Microsoft.Consumption/balances"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/balances/balanceId1"), - // Properties: &armconsumption.BalanceProperties{ - // AdjustmentDetails: []*armconsumption.BalancePropertiesAdjustmentDetailsItem{ - // { - // Name: to.Ptr("Promo Credit"), - // Value: to.Ptr[float64](1.1), - // }, - // { - // Name: to.Ptr("SIE Credit"), - // Value: to.Ptr[float64](1), - // }}, - // Adjustments: to.Ptr[float64](0), - // AzureMarketplaceServiceCharges: to.Ptr[float64](609.82), - // BeginningBalance: to.Ptr[float64](3396469.19), - // BillingFrequency: to.Ptr(armconsumption.BillingFrequencyMonth), - // ChargesBilledSeparately: to.Ptr[float64](0), - // Currency: to.Ptr("USD "), - // EndingBalance: to.Ptr[float64](2922371.02), - // NewPurchases: to.Ptr[float64](0), - // NewPurchasesDetails: []*armconsumption.BalancePropertiesNewPurchasesDetailsItem{ - // { - // Name: to.Ptr("Promo Purchase"), - // Value: to.Ptr[float64](1), - // }}, - // PriceHidden: to.Ptr(false), - // ServiceOverage: to.Ptr[float64](0), - // TotalOverage: to.Ptr[float64](0), - // TotalUsage: to.Ptr[float64](474098.17), - // Utilized: to.Ptr[float64](474098.17), - // }, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/budgets_client.go b/sdk/resourcemanager/consumption/armconsumption/budgets_client.go index a78736acf3d3..c9c48d68b0fb 100644 --- a/sdk/resourcemanager/consumption/armconsumption/budgets_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/budgets_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -46,7 +45,7 @@ func NewBudgetsClient(credential azcore.TokenCredential, options *arm.ClientOpti // to your put operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, @@ -54,24 +53,27 @@ func NewBudgetsClient(credential azcore.TokenCredential, options *arm.ClientOpti // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount // scope, // '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' // for invoiceSection scope. // - budgetName - Budget Name. // - parameters - Parameters supplied to the Create Budget operation. // - options - BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method. func (client *BudgetsClient) CreateOrUpdate(ctx context.Context, scope string, budgetName string, parameters Budget, options *BudgetsClientCreateOrUpdateOptions) (BudgetsClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, scope, budgetName, parameters, options) if err != nil { return BudgetsClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BudgetsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return BudgetsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return BudgetsClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -87,10 +89,13 @@ func (client *BudgetsClient) createOrUpdateCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -105,7 +110,7 @@ func (client *BudgetsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - The operation to delete a budget. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, @@ -113,21 +118,23 @@ func (client *BudgetsClient) createOrUpdateHandleResponse(resp *http.Response) ( // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount // scope, // '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' // for invoiceSection scope. // - budgetName - Budget Name. // - options - BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method. func (client *BudgetsClient) Delete(ctx context.Context, scope string, budgetName string, options *BudgetsClientDeleteOptions) (BudgetsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, scope, budgetName, options) if err != nil { return BudgetsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BudgetsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BudgetsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BudgetsClientDeleteResponse{}, err } return BudgetsClientDeleteResponse{}, nil } @@ -145,7 +152,7 @@ func (client *BudgetsClient) deleteCreateRequest(ctx context.Context, scope stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -154,7 +161,7 @@ func (client *BudgetsClient) deleteCreateRequest(ctx context.Context, scope stri // Get - Gets the budget for the scope by budget name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, @@ -162,23 +169,26 @@ func (client *BudgetsClient) deleteCreateRequest(ctx context.Context, scope stri // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount // scope, // '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' // for invoiceSection scope. // - budgetName - Budget Name. // - options - BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method. func (client *BudgetsClient) Get(ctx context.Context, scope string, budgetName string, options *BudgetsClientGetOptions) (BudgetsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, scope, budgetName, options) if err != nil { return BudgetsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BudgetsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BudgetsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BudgetsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -194,7 +204,7 @@ func (client *BudgetsClient) getCreateRequest(ctx context.Context, scope string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +221,7 @@ func (client *BudgetsClient) getHandleResponse(resp *http.Response) (BudgetsClie // NewListPager - Lists all budgets for the defined scope. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with budget operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, @@ -219,7 +229,7 @@ func (client *BudgetsClient) getHandleResponse(resp *http.Response) (BudgetsClie // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount // scope, // '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' -// for billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' +// for billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' // for invoiceSection scope. // - options - BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method. func (client *BudgetsClient) NewListPager(scope string, options *BudgetsClientListOptions) *runtime.Pager[BudgetsClientListResponse] { @@ -259,7 +269,7 @@ func (client *BudgetsClient) listCreateRequest(ctx context.Context, scope string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/budgets_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/budgets_client_example_test.go deleted file mode 100644 index faa8e161116f..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/budgets_client_example_test.go +++ /dev/null @@ -1,448 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/BudgetsList.json -func ExampleBudgetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBudgetsClient().NewListPager("subscriptions/00000000-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.BudgetsListResult = armconsumption.BudgetsListResult{ - // Value: []*armconsumption.Budget{ - // { - // Name: to.Ptr("TestBudget"), - // Type: to.Ptr("Microsoft.Consumption/budgets"), - // ETag: to.Ptr("\"1d34d012214157f\""), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/TestBudget"), - // Properties: &armconsumption.BudgetProperties{ - // Amount: to.Ptr[float64](100.65), - // Category: to.Ptr(armconsumption.CategoryTypeCost), - // CurrentSpend: &armconsumption.CurrentSpend{ - // Amount: to.Ptr[float64](80.89), - // Unit: to.Ptr("USD"), - // }, - // Filter: &armconsumption.BudgetFilter{ - // And: []*armconsumption.BudgetFilterProperties{ - // { - // Dimensions: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("ResourceId"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("category"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("Dev"), - // to.Ptr("Prod")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("department"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("engineering"), - // to.Ptr("sales")}, - // }, - // }}, - // }, - // Notifications: map[string]*armconsumption.Notification{ - // "Actual_GreaterThanOrEqualTo_90_Percent": &armconsumption.Notification{ - // ContactEmails: []*string{ - // to.Ptr("johndoe@contoso.com"), - // to.Ptr("janesmith@contoso.com")}, - // ContactGroups: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, - // ContactRoles: []*string{ - // to.Ptr("Contributor"), - // to.Ptr("Reader")}, - // Enabled: to.Ptr(true), - // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThanOrEqualTo), - // Threshold: to.Ptr[float64](90), - // }, - // "Actual_GreaterThan_80_Percent": &armconsumption.Notification{ - // ContactEmails: []*string{ - // to.Ptr("johndoe@contoso.com"), - // to.Ptr("janesmith@contoso.com")}, - // ContactRoles: []*string{ - // to.Ptr("Contributor"), - // to.Ptr("Reader")}, - // Enabled: to.Ptr(true), - // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), - // Threshold: to.Ptr[float64](80), - // }, - // "thresholdType": &armconsumption.Notification{ - // }, - // }, - // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), - // TimePeriod: &armconsumption.BudgetTimePeriod{ - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // }, - // }, - // }, - // { - // Name: to.Ptr("TestBudget"), - // Type: to.Ptr("Microsoft.Consumption/budgets"), - // ETag: to.Ptr("\"1d34d012214157f\""), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget"), - // Properties: &armconsumption.BudgetProperties{ - // Amount: to.Ptr[float64](600.65), - // Category: to.Ptr(armconsumption.CategoryTypeCost), - // CurrentSpend: &armconsumption.CurrentSpend{ - // Amount: to.Ptr[float64](120.89), - // Unit: to.Ptr("USD"), - // }, - // Filter: &armconsumption.BudgetFilter{ - // And: []*armconsumption.BudgetFilterProperties{ - // { - // Dimensions: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("ResourceId"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("category"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("Dev"), - // to.Ptr("Prod")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("department"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("engineering"), - // to.Ptr("sales")}, - // }, - // }}, - // }, - // Notifications: map[string]*armconsumption.Notification{ - // "Actual_GreaterThanOrEqualTo_60_Percent": &armconsumption.Notification{ - // ContactEmails: []*string{ - // to.Ptr("johndoe@contoso.com"), - // to.Ptr("janesmith@contoso.com")}, - // ContactGroups: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, - // ContactRoles: []*string{ - // to.Ptr("Contributor"), - // to.Ptr("Reader")}, - // Enabled: to.Ptr(true), - // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThanOrEqualTo), - // Threshold: to.Ptr[float64](60), - // ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), - // }, - // "Actual_GreaterThan_40_Percent": &armconsumption.Notification{ - // ContactEmails: []*string{ - // to.Ptr("johndoe@contoso.com"), - // to.Ptr("janesmith@contoso.com")}, - // ContactRoles: []*string{ - // to.Ptr("Contributor"), - // to.Ptr("Reader")}, - // Enabled: to.Ptr(true), - // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), - // Threshold: to.Ptr[float64](40), - // }, - // }, - // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), - // TimePeriod: &armconsumption.BudgetTimePeriod{ - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBudgetsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget", 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.Budget = armconsumption.Budget{ - // Name: to.Ptr("TestBudget"), - // Type: to.Ptr("Microsoft.Consumption/budgets"), - // ETag: to.Ptr("\"1d34d012214157f\""), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/TestBudget"), - // Properties: &armconsumption.BudgetProperties{ - // Amount: to.Ptr[float64](100.65), - // Category: to.Ptr(armconsumption.CategoryTypeCost), - // CurrentSpend: &armconsumption.CurrentSpend{ - // Amount: to.Ptr[float64](80.89), - // Unit: to.Ptr("USD"), - // }, - // Filter: &armconsumption.BudgetFilter{ - // And: []*armconsumption.BudgetFilterProperties{ - // { - // Dimensions: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("ResourceId"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("category"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("Dev"), - // to.Ptr("Prod")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("department"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("engineering"), - // to.Ptr("sales")}, - // }, - // }}, - // }, - // Notifications: map[string]*armconsumption.Notification{ - // "Actual_GreaterThan_80_Percent": &armconsumption.Notification{ - // ContactEmails: []*string{ - // to.Ptr("johndoe@contoso.com"), - // to.Ptr("janesmith@contoso.com")}, - // ContactGroups: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, - // ContactRoles: []*string{ - // to.Ptr("Contributor"), - // to.Ptr("Reader")}, - // Enabled: to.Ptr(true), - // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), - // Threshold: to.Ptr[float64](80), - // ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), - // }, - // }, - // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), - // TimePeriod: &armconsumption.BudgetTimePeriod{ - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBudgetsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget", armconsumption.Budget{ - ETag: to.Ptr("\"1d34d016a593709\""), - Properties: &armconsumption.BudgetProperties{ - Amount: to.Ptr[float64](100.65), - Category: to.Ptr(armconsumption.CategoryTypeCost), - Filter: &armconsumption.BudgetFilter{ - And: []*armconsumption.BudgetFilterProperties{ - { - Dimensions: &armconsumption.BudgetComparisonExpression{ - Name: to.Ptr("ResourceId"), - Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - Values: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, - }, - }, - { - Tags: &armconsumption.BudgetComparisonExpression{ - Name: to.Ptr("category"), - Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - Values: []*string{ - to.Ptr("Dev"), - to.Ptr("Prod")}, - }, - }, - { - Tags: &armconsumption.BudgetComparisonExpression{ - Name: to.Ptr("department"), - Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - Values: []*string{ - to.Ptr("engineering"), - to.Ptr("sales")}, - }, - }}, - }, - Notifications: map[string]*armconsumption.Notification{ - "Actual_GreaterThan_80_Percent": { - ContactEmails: []*string{ - to.Ptr("johndoe@contoso.com"), - to.Ptr("janesmith@contoso.com")}, - ContactGroups: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, - ContactRoles: []*string{ - to.Ptr("Contributor"), - to.Ptr("Reader")}, - Enabled: to.Ptr(true), - Locale: to.Ptr(armconsumption.CultureCodeEnUs), - Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), - Threshold: to.Ptr[float64](80), - ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), - }, - }, - TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), - TimePeriod: &armconsumption.BudgetTimePeriod{ - EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00Z"); return t }()), - StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t }()), - }, - }, - }, 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.Budget = armconsumption.Budget{ - // Name: to.Ptr("TestBudget"), - // Type: to.Ptr("Microsoft.Consumption/budgets"), - // ETag: to.Ptr("\"1d34d012214157f\""), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/budgets/TestBudget"), - // Properties: &armconsumption.BudgetProperties{ - // Amount: to.Ptr[float64](100.65), - // Category: to.Ptr(armconsumption.CategoryTypeCost), - // CurrentSpend: &armconsumption.CurrentSpend{ - // Amount: to.Ptr[float64](80.89), - // Unit: to.Ptr("USD"), - // }, - // Filter: &armconsumption.BudgetFilter{ - // And: []*armconsumption.BudgetFilterProperties{ - // { - // Dimensions: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("ResourceId"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("category"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("Dev"), - // to.Ptr("Prod")}, - // }, - // }, - // { - // Tags: &armconsumption.BudgetComparisonExpression{ - // Name: to.Ptr("department"), - // Operator: to.Ptr(armconsumption.BudgetOperatorTypeIn), - // Values: []*string{ - // to.Ptr("engineering"), - // to.Ptr("sales")}, - // }, - // }}, - // }, - // Notifications: map[string]*armconsumption.Notification{ - // "Actual_GreaterThan_80_Percent": &armconsumption.Notification{ - // ContactEmails: []*string{ - // to.Ptr("johndoe@contoso.com"), - // to.Ptr("janesmith@contoso.com")}, - // ContactGroups: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup")}, - // ContactRoles: []*string{ - // to.Ptr("Contributor"), - // to.Ptr("Reader")}, - // Enabled: to.Ptr(true), - // Locale: to.Ptr(armconsumption.CultureCodeEnUs), - // Operator: to.Ptr(armconsumption.OperatorTypeGreaterThan), - // Threshold: to.Ptr[float64](80), - // ThresholdType: to.Ptr(armconsumption.ThresholdTypeActual), - // }, - // }, - // TimeGrain: to.Ptr(armconsumption.TimeGrainTypeMonthly), - // TimePeriod: &armconsumption.BudgetTimePeriod{ - // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-31T00:00:00Z"); return t}()), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBudgetsClient().Delete(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "TestBudget", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/charges_client.go b/sdk/resourcemanager/consumption/armconsumption/charges_client.go index 097a4153ca2a..b1886ca88225 100644 --- a/sdk/resourcemanager/consumption/armconsumption/charges_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/charges_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -42,7 +41,7 @@ func NewChargesClient(credential azcore.TokenCredential, options *arm.ClientOpti // List - Lists the charges based for the defined scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with charges operations. This includes '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' // for Department scope, and // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount @@ -53,23 +52,26 @@ func NewChargesClient(credential azcore.TokenCredential, options *arm.ClientOpti // Also, Modern Commerce Account scopes are // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' // for -// billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' // for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. // - options - ChargesClientListOptions contains the optional parameters for the ChargesClient.List method. func (client *ChargesClient) List(ctx context.Context, scope string, options *ChargesClientListOptions) (ChargesClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, scope, options) if err != nil { return ChargesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ChargesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ChargesClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChargesClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -81,7 +83,7 @@ func (client *ChargesClient) listCreateRequest(ctx context.Context, scope string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.StartDate != nil { reqQP.Set("startDate", *options.StartDate) } diff --git a/sdk/resourcemanager/consumption/armconsumption/charges_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/charges_client_example_test.go deleted file mode 100644 index 24b1ae4f4e98..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/charges_client_example_test.go +++ /dev/null @@ -1,802 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesForBillingPeriodByDepartment.json -func ExampleChargesClient_List_changesForBillingPeriodByDepartmentLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/departments/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.LegacyChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), - // Properties: &armconsumption.LegacyChargeSummaryProperties{ - // AzureCharges: to.Ptr[float64](5000), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), - // ChargesBilledSeparately: to.Ptr[float64](60.9), - // Currency: to.Ptr("USD"), - // MarketplaceCharges: to.Ptr[float64](100), - // UsageEnd: to.Ptr("2018-04-30"), - // UsageStart: to.Ptr("2018-04-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesForBillingPeriodByEnrollmentAccount.json -func ExampleChargesClient_List_changesForBillingPeriodByEnrollmentAccountLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.LegacyChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), - // Properties: &armconsumption.LegacyChargeSummaryProperties{ - // AzureCharges: to.Ptr[float64](5000), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), - // ChargesBilledSeparately: to.Ptr[float64](60.9), - // Currency: to.Ptr("USD"), - // MarketplaceCharges: to.Ptr[float64](100), - // UsageEnd: to.Ptr("2018-04-30"), - // UsageStart: to.Ptr("2018-04-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccount.json -func ExampleChargesClient_List_chargesListByBillingAccountModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-10-31"), - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](265.09), - // }, - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // UsageEnd: to.Ptr("2019-10-31"), - // UsageStart: to.Ptr("2021-10-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccountGroupByBillingProfileId.json -func ExampleChargesClient_List_chargesListByBillingAccountGroupByBillingProfileIdModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-09-30"), - Filter: nil, - Apply: to.Ptr("groupby((properties/billingProfileId))"), - }) - 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/123456"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }, - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId2"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/42425/providers/Microsoft.Consumption/charges/chargeSummaryId2"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccountGroupByCustomerId.json -func ExampleChargesClient_List_chargesListByBillingAccountGroupByCustomerIdModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-09-30"), - Filter: nil, - Apply: to.Ptr("groupby((properties/customerId))"), - }) - 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }, - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId2"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/123456/providers/Microsoft.Consumption/charges/chargeSummaryId2"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // CustomerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/123456"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingAccountGroupByInvoiceSectionId.json -func ExampleChargesClient_List_chargesListByBillingAccountGroupByInvoiceSectionIdModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-09-30"), - Filter: nil, - Apply: to.Ptr("groupby((properties/invoiceSectionId))"), - }) - 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }, - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId2"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingProfile.json -func ExampleChargesClient_List_chargesListByBillingProfileModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2460", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](265.09), - // }, - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // UsageEnd: to.Ptr("2019-10-31"), - // UsageStart: to.Ptr("2021-10-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingProfileGroupByInvoiceSectionId.json -func ExampleChargesClient_List_chargesListByBillingProfileGroupByInvoiceSectionIdModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-09-30"), - Filter: nil, - Apply: to.Ptr("groupby((properties/invoiceSectionId))"), - }) - 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/4567"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }, - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId2"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789//billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/invoiceSections/67890"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernBillingProfileInvoiceSection.json -func ExampleChargesClient_List_chargesListByBillingProfileInvoiceSectionModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890", &armconsumption.ChargesClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-10-31"), - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201909"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-09-30"), - // UsageStart: to.Ptr("2019-09-01"), - // }, - // }, - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId2"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/67890/providers/Microsoft.Consumption/charges/chargeSummaryId2"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/42425/invoiceSections/4567"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // UsageEnd: to.Ptr("2019-10-31"), - // UsageStart: to.Ptr("2021-10-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernCustomer.json -func ExampleChargesClient_List_chargesListByCustomerModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/67890", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/customers/67890/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](265.09), - // }, - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // UsageEnd: to.Ptr("2019-10-31"), - // UsageStart: to.Ptr("2021-10-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListForDepartmentFilterByStartEndDate.json -func ExampleChargesClient_List_chargesListByDepartmentLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/departments/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: to.Ptr("usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'"), - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.LegacyChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/departments/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), - // Properties: &armconsumption.LegacyChargeSummaryProperties{ - // AzureCharges: to.Ptr[float64](5000), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), - // ChargesBilledSeparately: to.Ptr[float64](60.9), - // Currency: to.Ptr("USD"), - // MarketplaceCharges: to.Ptr[float64](100), - // UsageEnd: to.Ptr("2018-04-30"), - // UsageStart: to.Ptr("2018-04-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListByModernInvoiceSectionId.json -func ExampleChargesClient_List_chargesListByInvoiceSectionIdModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/97531", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.ModernChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindModern), - // Properties: &armconsumption.ModernChargeSummaryProperties{ - // AzureCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](12), - // }, - // BillingAccountID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Billing/billingPeriods/201910"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460"), - // ChargesBilledSeparately: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/billingProfiles/2460/invoiceSections/97531"), - // IsInvoiced: to.Ptr(false), - // MarketplaceCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // UsageEnd: to.Ptr("2019-10-31"), - // UsageStart: to.Ptr("2021-10-01"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ChargesListForEnrollmentAccountFilterByStartEndDate.json -func ExampleChargesClient_List_chargesListForEnrollmentAccountLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewChargesClient().List(ctx, "providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425", &armconsumption.ChargesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - Apply: 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.ChargesListResult = armconsumption.ChargesListResult{ - // Value: []armconsumption.ChargeSummaryClassification{ - // &armconsumption.LegacyChargeSummary{ - // Name: to.Ptr("chargeSummaryId1"), - // Type: to.Ptr("Microsoft.Consumption/charges"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/enrollmentAccounts/42425/providers/Microsoft.Consumption/charges/chargeSummaryId1"), - // Kind: to.Ptr(armconsumption.ChargeSummaryKindLegacy), - // Properties: &armconsumption.LegacyChargeSummaryProperties{ - // AzureCharges: to.Ptr[float64](5000), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201804"), - // ChargesBilledSeparately: to.Ptr[float64](60.9), - // Currency: to.Ptr("USD"), - // MarketplaceCharges: to.Ptr[float64](100), - // UsageEnd: to.Ptr("2018-04-30"), - // UsageStart: to.Ptr("2018-04-01"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/client_factory.go b/sdk/resourcemanager/consumption/armconsumption/client_factory.go index 097a2b2f2a1d..fe0311591df5 100644 --- a/sdk/resourcemanager/consumption/armconsumption/client_factory.go +++ b/sdk/resourcemanager/consumption/armconsumption/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -38,13 +37,13 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewUsageDetailsClient() *UsageDetailsClient { - subClient, _ := NewUsageDetailsClient(c.credential, c.options) +func (c *ClientFactory) NewAggregatedCostClient() *AggregatedCostClient { + subClient, _ := NewAggregatedCostClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewMarketplacesClient() *MarketplacesClient { - subClient, _ := NewMarketplacesClient(c.credential, c.options) +func (c *ClientFactory) NewBalancesClient() *BalancesClient { + subClient, _ := NewBalancesClient(c.credential, c.options) return subClient } @@ -53,72 +52,72 @@ func (c *ClientFactory) NewBudgetsClient() *BudgetsClient { return subClient } -func (c *ClientFactory) NewTagsClient() *TagsClient { - subClient, _ := NewTagsClient(c.credential, c.options) +func (c *ClientFactory) NewChargesClient() *ChargesClient { + subClient, _ := NewChargesClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewChargesClient() *ChargesClient { - subClient, _ := NewChargesClient(c.credential, c.options) +func (c *ClientFactory) NewCreditsClient() *CreditsClient { + subClient, _ := NewCreditsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewBalancesClient() *BalancesClient { - subClient, _ := NewBalancesClient(c.credential, c.options) +func (c *ClientFactory) NewEventsClient() *EventsClient { + subClient, _ := NewEventsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewReservationsSummariesClient() *ReservationsSummariesClient { - subClient, _ := NewReservationsSummariesClient(c.credential, c.options) +func (c *ClientFactory) NewLotsClient() *LotsClient { + subClient, _ := NewLotsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewReservationsDetailsClient() *ReservationsDetailsClient { - subClient, _ := NewReservationsDetailsClient(c.credential, c.options) +func (c *ClientFactory) NewMarketplacesClient() *MarketplacesClient { + subClient, _ := NewMarketplacesClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewReservationRecommendationsClient() *ReservationRecommendationsClient { - subClient, _ := NewReservationRecommendationsClient(c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewReservationRecommendationDetailsClient() *ReservationRecommendationDetailsClient { - subClient, _ := NewReservationRecommendationDetailsClient(c.credential, c.options) +func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient { + subClient, _ := NewPriceSheetClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewReservationTransactionsClient() *ReservationTransactionsClient { - subClient, _ := NewReservationTransactionsClient(c.credential, c.options) +func (c *ClientFactory) NewReservationRecommendationDetailsClient() *ReservationRecommendationDetailsClient { + subClient, _ := NewReservationRecommendationDetailsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewPriceSheetClient() *PriceSheetClient { - subClient, _ := NewPriceSheetClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewReservationRecommendationsClient() *ReservationRecommendationsClient { + subClient, _ := NewReservationRecommendationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewReservationTransactionsClient() *ReservationTransactionsClient { + subClient, _ := NewReservationTransactionsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewAggregatedCostClient() *AggregatedCostClient { - subClient, _ := NewAggregatedCostClient(c.credential, c.options) +func (c *ClientFactory) NewReservationsDetailsClient() *ReservationsDetailsClient { + subClient, _ := NewReservationsDetailsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewEventsClient() *EventsClient { - subClient, _ := NewEventsClient(c.credential, c.options) +func (c *ClientFactory) NewReservationsSummariesClient() *ReservationsSummariesClient { + subClient, _ := NewReservationsSummariesClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewLotsClient() *LotsClient { - subClient, _ := NewLotsClient(c.credential, c.options) +func (c *ClientFactory) NewTagsClient() *TagsClient { + subClient, _ := NewTagsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewCreditsClient() *CreditsClient { - subClient, _ := NewCreditsClient(c.credential, c.options) +func (c *ClientFactory) NewUsageDetailsClient() *UsageDetailsClient { + subClient, _ := NewUsageDetailsClient(c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/consumption/armconsumption/constants.go b/sdk/resourcemanager/consumption/armconsumption/constants.go index 3cb53b245625..a2eb2c94e0bd 100644 --- a/sdk/resourcemanager/consumption/armconsumption/constants.go +++ b/sdk/resourcemanager/consumption/armconsumption/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption const ( moduleName = "armconsumption" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) // BillingFrequency - The billing frequency. @@ -151,6 +150,7 @@ func PossibleDatagrainValues() []Datagrain { type EventType string const ( + EventTypeCreditExpired EventType = "CreditExpired" EventTypeNewCredit EventType = "NewCredit" EventTypePendingAdjustments EventType = "PendingAdjustments" EventTypePendingCharges EventType = "PendingCharges" @@ -163,6 +163,7 @@ const ( // PossibleEventTypeValues returns the possible values for the EventType const type. func PossibleEventTypeValues() []EventType { return []EventType{ + EventTypeCreditExpired, EventTypeNewCredit, EventTypePendingAdjustments, EventTypePendingCharges, @@ -231,12 +232,37 @@ func PossibleMetrictypeValues() []Metrictype { } } +// OperationStatusType - The status of the long running operation. +type OperationStatusType string + +const ( + OperationStatusTypeCompleted OperationStatusType = "Completed" + OperationStatusTypeFailed OperationStatusType = "Failed" + OperationStatusTypeRunning OperationStatusType = "Running" +) + +// PossibleOperationStatusTypeValues returns the possible values for the OperationStatusType const type. +func PossibleOperationStatusTypeValues() []OperationStatusType { + return []OperationStatusType{ + OperationStatusTypeCompleted, + OperationStatusTypeFailed, + OperationStatusTypeRunning, + } +} + // OperatorType - The comparison operator. type OperatorType string const ( - OperatorTypeEqualTo OperatorType = "EqualTo" - OperatorTypeGreaterThan OperatorType = "GreaterThan" + // OperatorTypeEqualTo - Alert will be triggered if the evaluated cost is the same as threshold value. Note: It’s not recommended + // to use this OperatorType as there’s low chance of cost being exactly the same as threshold value, leading to missing of + // your alert. This OperatorType will be deprecated in future. + OperatorTypeEqualTo OperatorType = "EqualTo" + // OperatorTypeGreaterThan - Alert will be triggered if the evaluated cost is greater than the threshold value. Note: This + // is the recommended OperatorType while configuring Budget Alert. + OperatorTypeGreaterThan OperatorType = "GreaterThan" + // OperatorTypeGreaterThanOrEqualTo - Alert will be triggered if the evaluated cost is greater than or equal to the threshold + // value. OperatorTypeGreaterThanOrEqualTo OperatorType = "GreaterThanOrEqualTo" ) @@ -249,6 +275,24 @@ func PossibleOperatorTypeValues() []OperatorType { } } +// OrganizationType - The organization type of the lot. +type OrganizationType string + +const ( + // OrganizationTypeContributorOrganizationType - Contributor organization type for Multi-Entity consumption commitment. + OrganizationTypeContributorOrganizationType OrganizationType = "Contributor" + // OrganizationTypePrimaryOrganizationType - Primary organization type for Multi-Entity consumption commitment. + OrganizationTypePrimaryOrganizationType OrganizationType = "Primary" +) + +// PossibleOrganizationTypeValues returns the possible values for the OrganizationType const type. +func PossibleOrganizationTypeValues() []OrganizationType { + return []OrganizationType{ + OrganizationTypeContributorOrganizationType, + OrganizationTypePrimaryOrganizationType, + } +} + // PricingModelType - Identifier that indicates how the meter is priced. type PricingModelType string @@ -343,7 +387,10 @@ func PossibleTermValues() []Term { type ThresholdType string const ( - ThresholdTypeActual ThresholdType = "Actual" + // ThresholdTypeActual - Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget . + ThresholdTypeActual ThresholdType = "Actual" + // ThresholdTypeForecasted - Forecasted costs budget alerts provide advanced notification that your spending trends are likely + // to exceed your allocated budget, as it relies on forecasted cost predictions. ThresholdTypeForecasted ThresholdType = "Forecasted" ) diff --git a/sdk/resourcemanager/consumption/armconsumption/credits_client.go b/sdk/resourcemanager/consumption/armconsumption/credits_client.go index 8c9e701a86a4..147cb1eccd24 100644 --- a/sdk/resourcemanager/consumption/armconsumption/credits_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/credits_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -44,23 +43,26 @@ func NewCreditsClient(credential azcore.TokenCredential, options *arm.ClientOpti // Get - The credit summary by billingAccountId and billingProfileId. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - billingProfileID - Azure Billing Profile ID. // - options - CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method. func (client *CreditsClient) Get(ctx context.Context, billingAccountID string, billingProfileID string, options *CreditsClientGetOptions) (CreditsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, billingAccountID, billingProfileID, options) if err != nil { return CreditsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CreditsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return CreditsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CreditsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -79,7 +81,7 @@ func (client *CreditsClient) getCreateRequest(ctx context.Context, billingAccoun return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/credits_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/credits_client_example_test.go deleted file mode 100644 index 06206ea75eb4..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/credits_client_example_test.go +++ /dev/null @@ -1,73 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCreditsClient().Get(ctx, "1234:5678", "2468", 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.CreditSummary = armconsumption.CreditSummary{ - // Name: to.Ptr("balanceSummary1"), - // Type: to.Ptr("Microsoft.Consumption/credits/balanceSummary"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/credits/balanceSummary1"), - // Properties: &armconsumption.CreditSummaryProperties{ - // BalanceSummary: &armconsumption.CreditBalanceSummary{ - // CurrentBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // EstimatedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](600), - // }, - // }, - // BillingCurrency: to.Ptr("USD"), - // CreditCurrency: to.Ptr("USD"), - // ExpiredCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // PendingCreditAdjustments: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // PendingEligibleCharges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information."), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/events_client.go b/sdk/resourcemanager/consumption/armconsumption/events_client.go index 6d9e22bd4a6c..d58b8ee8c075 100644 --- a/sdk/resourcemanager/consumption/armconsumption/events_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/events_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -44,7 +43,7 @@ func NewEventsClient(credential azcore.TokenCredential, options *arm.ClientOptio // NewListByBillingAccountPager - Lists the events that decrements Azure credits or Microsoft Azure consumption commitment // for a billing account or a billing profile for a given start and end date. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - options - EventsClientListByBillingAccountOptions contains the optional parameters for the EventsClient.NewListByBillingAccountPager // method. @@ -88,7 +87,7 @@ func (client *EventsClient) listByBillingAccountCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -109,7 +108,7 @@ func (client *EventsClient) listByBillingAccountHandleResponse(resp *http.Respon // NewListByBillingProfilePager - Lists the events that decrements Azure credits or Microsoft Azure consumption commitment // for a billing account or a billing profile for a given start and end date. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - billingProfileID - Azure Billing Profile ID. // - startDate - Start date @@ -160,7 +159,7 @@ func (client *EventsClient) listByBillingProfileCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") reqQP.Set("startDate", startDate) reqQP.Set("endDate", endDate) req.Raw().URL.RawQuery = reqQP.Encode() diff --git a/sdk/resourcemanager/consumption/armconsumption/events_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/events_client_example_test.go deleted file mode 100644 index 00e4f0dd5719..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/events_client_example_test.go +++ /dev/null @@ -1,416 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsListByBillingProfile.json -func ExampleEventsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventsClient().NewListByBillingProfilePager("1234:5678", "4268", "2019-09-01", "2019-10-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.Events = armconsumption.Events{ - // Value: []*armconsumption.EventSummary{ - // { - // Name: to.Ptr("event1"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event1"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("Settled invoice #312033"), - // Adjustments: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // BillingCurrency: to.Ptr("USD"), - // Charges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // CreditCurrency: to.Ptr("USD"), - // CreditExpired: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // EventType: to.Ptr(armconsumption.EventTypeSettledCharges), - // InvoiceNumber: to.Ptr("3301"), - // NewCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information"), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), - // }, - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("event2"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event2"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("New credits added"), - // Adjustments: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // BillingCurrency: to.Ptr("USD"), - // CanceledCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // Charges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](900), - // }, - // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // CreditCurrency: to.Ptr("USD"), - // CreditExpired: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // EventType: to.Ptr(armconsumption.EventTypeNewCredit), - // InvoiceNumber: to.Ptr("3302"), - // NewCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](400), - // }, - // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information"), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), - // }, - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-08-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("event3"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event3"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("Credits Expired"), - // Adjustments: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // BillingCurrency: to.Ptr("USD"), - // CanceledCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // Charges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](600), - // }, - // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // CreditCurrency: to.Ptr("USD"), - // CreditExpired: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](300), - // }, - // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // EventType: to.Ptr(armconsumption.EventType("ExpiredCredit")), - // InvoiceNumber: to.Ptr(""), - // NewCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0), - // }, - // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information"), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), - // }, - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("event4"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/4268/providers/Microsoft.Consumption/events/event4"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("Settled invoice #212033"), - // Adjustments: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](-200), - // }, - // AdjustmentsInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // BillingCurrency: to.Ptr("USD"), - // CanceledCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // Charges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](300), - // }, - // ChargesInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](700), - // }, - // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // CreditCurrency: to.Ptr("USD"), - // CreditExpired: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](100), - // }, - // CreditExpiredInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // EventType: to.Ptr(armconsumption.EventTypeSettledCharges), - // InvoiceNumber: to.Ptr("3303"), - // NewCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](300), - // }, - // NewCreditInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information"), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), - // }, - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsGetByBillingAccount.json -func ExampleEventsClient_NewListByBillingAccountPager_eventsGetByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.EventsClientListByBillingAccountOptions{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.Events = armconsumption.Events{ - // Value: []*armconsumption.EventSummary{ - // { - // Name: to.Ptr("eventId1"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/events/eventId1"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("New MACC Added"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/X3TD-KVTT-BG7-TGB"), - // Charges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // EventType: to.Ptr(armconsumption.EventTypeNewCredit), - // InvoiceNumber: to.Ptr("3304"), - // LotID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/Microsoft.Consumption/lots/G202001083926600XXXXX"), - // LotSource: to.Ptr("ConsumptionCommitment"), - // NewCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("eventId2"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/events/eventId2"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("Balance after invoice 3304"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/X3TD-KVTT-BG7-TGB"), - // Charges: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // EventType: to.Ptr(armconsumption.EventTypeSettledCharges), - // InvoiceNumber: to.Ptr("3304"), - // LotID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/Microsoft.Consumption/lots/7004bc39-974d-482e-8e45-caf91dba0870"), - // LotSource: to.Ptr("AzurePrepayment"), - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/EventsGetByBillingAccountWithFilters.json -func ExampleEventsClient_NewListByBillingAccountPager_eventsGetByBillingAccountWithFilters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.EventsClientListByBillingAccountOptions{Filter: to.Ptr("lotid eq 'G202001083926600XXXXX' AND lotsource eq 'consumptioncommitment'")}) - 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.Events = armconsumption.Events{ - // Value: []*armconsumption.EventSummary{ - // { - // Name: to.Ptr("eventId1"), - // Type: to.Ptr("Microsoft.Consumption/events"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:56789/providers/Microsoft.Consumption/events/eventId1"), - // Properties: &armconsumption.EventProperties{ - // Description: to.Ptr("MACC Canceled"), - // BillingProfileDisplayName: to.Ptr("Contoso Operations Billing"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/X3TD-KVTT-BG7-TGB"), - // CanceledCredit: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](200), - // }, - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](500), - // }, - // EventType: to.Ptr(armconsumption.EventType("CanceledCredit")), - // InvoiceNumber: to.Ptr("3304"), - // LotID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/Microsoft.Consumption/lots/G202001083926600XXXXX"), - // LotSource: to.Ptr("ConsumptionCommitment"), - // TransactionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/go.mod b/sdk/resourcemanager/consumption/armconsumption/go.mod index ef2bfc9c159d..336eed9eccb8 100644 --- a/sdk/resourcemanager/consumption/armconsumption/go.mod +++ b/sdk/resourcemanager/consumption/armconsumption/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armconsumption/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/consumption/armconsumption/go.sum b/sdk/resourcemanager/consumption/armconsumption/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/consumption/armconsumption/go.sum +++ b/sdk/resourcemanager/consumption/armconsumption/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/consumption/armconsumption/interfaces.go b/sdk/resourcemanager/consumption/armconsumption/interfaces.go new file mode 100644 index 000000000000..91537339b3e7 --- /dev/null +++ b/sdk/resourcemanager/consumption/armconsumption/interfaces.go @@ -0,0 +1,54 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armconsumption + +// ChargeSummaryClassification provides polymorphic access to related types. +// Call the interface's GetChargeSummary() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ChargeSummary, *LegacyChargeSummary, *ModernChargeSummary +type ChargeSummaryClassification interface { + // GetChargeSummary returns the ChargeSummary content of the underlying type. + GetChargeSummary() *ChargeSummary +} + +// LegacyReservationRecommendationPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetLegacyReservationRecommendationProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *LegacyReservationRecommendationProperties, *LegacySharedScopeReservationRecommendationProperties, *LegacySingleScopeReservationRecommendationProperties +type LegacyReservationRecommendationPropertiesClassification interface { + // GetLegacyReservationRecommendationProperties returns the LegacyReservationRecommendationProperties content of the underlying type. + GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties +} + +// ModernReservationRecommendationPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetModernReservationRecommendationProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ModernReservationRecommendationProperties, *ModernSharedScopeReservationRecommendationProperties, *ModernSingleScopeReservationRecommendationProperties +type ModernReservationRecommendationPropertiesClassification interface { + // GetModernReservationRecommendationProperties returns the ModernReservationRecommendationProperties content of the underlying type. + GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties +} + +// ReservationRecommendationClassification provides polymorphic access to related types. +// Call the interface's GetReservationRecommendation() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *LegacyReservationRecommendation, *ModernReservationRecommendation, *ReservationRecommendation +type ReservationRecommendationClassification interface { + // GetReservationRecommendation returns the ReservationRecommendation content of the underlying type. + GetReservationRecommendation() *ReservationRecommendation +} + +// UsageDetailClassification provides polymorphic access to related types. +// Call the interface's GetUsageDetail() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *LegacyUsageDetail, *ModernUsageDetail, *UsageDetail +type UsageDetailClassification interface { + // GetUsageDetail returns the UsageDetail content of the underlying type. + GetUsageDetail() *UsageDetail +} diff --git a/sdk/resourcemanager/consumption/armconsumption/lots_client.go b/sdk/resourcemanager/consumption/armconsumption/lots_client.go index d7abac53bd4a..bfc3e861c1e3 100644 --- a/sdk/resourcemanager/consumption/armconsumption/lots_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/lots_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -44,7 +43,7 @@ func NewLotsClient(credential azcore.TokenCredential, options *arm.ClientOptions // NewListByBillingAccountPager - 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. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - options - LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.NewListByBillingAccountPager // method. @@ -88,7 +87,7 @@ func (client *LotsClient) listByBillingAccountCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -109,7 +108,7 @@ func (client *LotsClient) listByBillingAccountHandleResponse(resp *http.Response // NewListByBillingProfilePager - Lists all Azure credits for a billing account or a billing profile. The API is only supported // for Microsoft Customer Agreements (MCA) billing accounts. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - billingProfileID - Azure Billing Profile ID. // - options - LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager @@ -158,7 +157,7 @@ func (client *LotsClient) listByBillingProfileCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +175,7 @@ func (client *LotsClient) listByBillingProfileHandleResponse(resp *http.Response // NewListByCustomerPager - Lists all Azure credits for a customer. The API is only supported for Microsoft Partner Agreements // (MPA) billing accounts. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - customerID - Customer ID // - options - LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.NewListByCustomerPager method. @@ -224,7 +223,7 @@ func (client *LotsClient) listByCustomerCreateRequest(ctx context.Context, billi return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/consumption/armconsumption/lots_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/lots_client_example_test.go deleted file mode 100644 index cbb039806724..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/lots_client_example_test.go +++ /dev/null @@ -1,342 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingProfile.json -func ExampleLotsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLotsClient().NewListByBillingProfilePager("1234:5678", "2468", 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.Lots = armconsumption.Lots{ - // Value: []*armconsumption.LotSummary{ - // { - // Name: to.Ptr("lot1"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot1"), - // Properties: &armconsumption.LotProperties{ - // BillingCurrency: to.Ptr("USD"), - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // CreditCurrency: to.Ptr("USD"), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // OriginalAmountInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // PoNumber: to.Ptr("3524"), - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information."), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller1"), - // }, - // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("lot2"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot2"), - // Properties: &armconsumption.LotProperties{ - // BillingCurrency: to.Ptr("USD"), - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](80.9), - // }, - // ClosedBalanceInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // CreditCurrency: to.Ptr("USD"), - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](6000), - // }, - // OriginalAmountInBillingCurrency: &armconsumption.AmountWithExchangeRate{ - // ExchangeRate: to.Ptr[float64](5000), - // ExchangeRateMonth: to.Ptr[int32](1), - // }, - // PoNumber: to.Ptr("31224"), - // Reseller: &armconsumption.Reseller{ - // ResellerDescription: to.Ptr("Reseller information."), - // ResellerID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/reseller/reseller2"), - // }, - // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingAccount.json -func ExampleLotsClient_NewListByBillingAccountPager_lotsListByBillingAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.LotsClientListByBillingAccountOptions{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.Lots = armconsumption.Lots{ - // Value: []*armconsumption.LotSummary{ - // { - // Name: to.Ptr("lot1"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot1"), - // Properties: &armconsumption.LotProperties{ - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()), - // Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()), - // Status: to.Ptr(armconsumption.StatusActive), - // }, - // }, - // { - // Name: to.Ptr("lot2"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot2"), - // Properties: &armconsumption.LotProperties{ - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](80.9), - // }, - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](6000), - // }, - // PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()), - // Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00Z"); return t}()), - // Status: to.Ptr(armconsumption.StatusExpired), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByBillingAccountWithFilters.json -func ExampleLotsClient_NewListByBillingAccountPager_lotsListByBillingAccountWithStatusFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLotsClient().NewListByBillingAccountPager("1234:5678", &armconsumption.LotsClientListByBillingAccountOptions{Filter: to.Ptr("status eq 'active' AND source eq 'consumptioncommitment'")}) - 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.Lots = armconsumption.Lots{ - // Value: []*armconsumption.LotSummary{ - // { - // Name: to.Ptr("lot1"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234:5678/billingProfiles/2468/providers/Microsoft.Consumption/lots/lot1"), - // Properties: &armconsumption.LotProperties{ - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-01T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // PurchasedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-01T00:00:00Z"); return t}()), - // Source: to.Ptr(armconsumption.LotSourceConsumptionCommitment), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-01T00:00:00Z"); return t}()), - // Status: to.Ptr(armconsumption.StatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByCustomer.json -func ExampleLotsClient_NewListByCustomerPager_lotsListByCustomer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLotsClient().NewListByCustomerPager("1234:5678", "1234:5678", &armconsumption.LotsClientListByCustomerOptions{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.Lots = armconsumption.Lots{ - // Value: []*armconsumption.LotSummary{ - // { - // Name: to.Ptr("lot1"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234/customers/456/providers/Microsoft.Consumption/lots/lot1"), - // Properties: &armconsumption.LotProperties{ - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // PoNumber: to.Ptr("3524"), - // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("lot2"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234/customers/456/providers/Microsoft.Consumption/lots/lot2"), - // Properties: &armconsumption.LotProperties{ - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](80.9), - // }, - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-31T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](6000), - // }, - // PoNumber: to.Ptr("31224"), - // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/LotsListByCustomerWithFilters.json -func ExampleLotsClient_NewListByCustomerPager_lotsListByCustomerWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLotsClient().NewListByCustomerPager("1234:5678", "1234:5678", &armconsumption.LotsClientListByCustomerOptions{Filter: to.Ptr("status eq 'active' AND source eq 'consumptioncommitment'")}) - 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.Lots = armconsumption.Lots{ - // Value: []*armconsumption.LotSummary{ - // { - // Name: to.Ptr("lot1"), - // Type: to.Ptr("Microsoft.Consumption/lots"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/1234/customers/456/providers/Microsoft.Consumption/lots/lot1"), - // Properties: &armconsumption.LotProperties{ - // ClosedBalance: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](60.9), - // }, - // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00Z"); return t}()), - // OriginalAmount: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](5000), - // }, - // PoNumber: to.Ptr("3524"), - // Source: to.Ptr(armconsumption.LotSourcePurchasedCredit), - // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/marketplaces_client.go b/sdk/resourcemanager/consumption/armconsumption/marketplaces_client.go index 695d3faea9f5..f7128c068222 100644 --- a/sdk/resourcemanager/consumption/armconsumption/marketplaces_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/marketplaces_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -43,7 +42,7 @@ func NewMarketplacesClient(credential azcore.TokenCredential, options *arm.Clien // NewListPager - Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for // May 1, 2014 or later. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with marketplace operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing // Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' @@ -100,7 +99,7 @@ func (client *MarketplacesClient) listCreateRequest(ctx context.Context, scope s if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/marketplaces_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/marketplaces_client_example_test.go deleted file mode 100644 index dc66ad2d6305..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/marketplaces_client_example_test.go +++ /dev/null @@ -1,746 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByBillingAccountList.json -func ExampleMarketplacesClient_NewListPager_billingAccountMarketplacesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplaceId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan1"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByBillingAccountListForBillingPeriod.json -func ExampleMarketplacesClient_NewListPager_billingAccountMarketplacesListForBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByDepartmentList.json -func ExampleMarketplacesClient_NewListPager_departmentMarketplacesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/departments/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByDepartment_ListByBillingPeriod.json -func ExampleMarketplacesClient_NewListPager_departmentMarketplacesListForBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/departments/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/departments/123456/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByEnrollmentAccountList.json -func ExampleMarketplacesClient_NewListPager_enrollmentAccountMarketplacesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/enrollmentAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByEnrollmentAccounts_ListByBillingPeriod.json -func ExampleMarketplacesClient_NewListPager_enrollmentAccountMarketplacesListForBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("providers/Microsoft.Billing/enrollmentAccounts/123456", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/providers/Microsoft.Billing/enrollmentAccounts/123456/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByManagementGroupList.json -func ExampleMarketplacesClient_NewListPager_managementGroupMarketplacesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201810/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201810"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("marketplacesId2"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201810/providers/Microsoft.Consumption/marketplaces/marketplaceId2"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account2"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201810"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center2"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department2"), - // InstanceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared2"), - // InstanceName: to.Ptr("shared2"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesByManagementGroup_ListForBillingPeriod.json -func ExampleMarketplacesClient_NewListPager_managementGroupMarketplacesListForBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201808/providers/Microsoft.Consumption/marketplaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201808"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T00:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("marketplacesId2"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201808/providers/Microsoft.Consumption/marketplaces/marketplaceId2"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account2"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/providers/Microsoft.Billing/billingPeriods/201810"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center2"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department2"), - // InstanceID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared2"), - // InstanceName: to.Ptr("shared2"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesList.json -func ExampleMarketplacesClient_NewListPager_subscriptionMarketplacesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplaceId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketPlaces/marketplaceId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan1"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/MarketplacesListForBillingPeriod.json -func ExampleMarketplacesClient_NewListPager_subscriptionMarketplacesListForBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMarketplacesClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.MarketplacesClientListOptions{Filter: nil, - Top: 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.MarketplacesListResult = armconsumption.MarketplacesListResult{ - // Value: []*armconsumption.Marketplace{ - // { - // Name: to.Ptr("marketplacesId1"), - // Type: to.Ptr("Microsoft.Consumption/marketPlaces"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/marketPlaces/marketplacesId1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.MarketplaceProperties{ - // AccountName: to.Ptr("Account1"), - // AdditionalProperties: to.Ptr("additionalProperties"), - // BillingPeriodID: to.Ptr("/subscriptions/subid/providers/Microsoft.Billing/billingPeriods/201702"), - // ConsumedQuantity: to.Ptr[float64](0.00328), - // CostCenter: to.Ptr("Center1"), - // Currency: to.Ptr("USD"), - // DepartmentName: to.Ptr("Department1"), - // InstanceID: to.Ptr("/subscriptions/subid/resourceGroups/Default-Web-eastasia/providers/Microsoft.Web/sites/shared1"), - // InstanceName: to.Ptr("shared1"), - // IsEstimated: to.Ptr(false), - // IsRecurringCharge: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferName: to.Ptr("offer1"), - // OrderNumber: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PlanName: to.Ptr("plan2"), - // PretaxCost: to.Ptr[float64](0.67), - // PublisherName: to.Ptr("xyz"), - // ResourceGroup: to.Ptr("TEST"), - // ResourceRate: to.Ptr[float64](0.24), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("azure subscription"), - // UnitOfMeasure: to.Ptr("10 Hours"), - // UsageEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T23:59:59Z"); return t}()), - // UsageStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-13T00:00:00Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/models.go b/sdk/resourcemanager/consumption/armconsumption/models.go index d2b403b16e0a..0b2cc7e9f05f 100644 --- a/sdk/resourcemanager/consumption/armconsumption/models.go +++ b/sdk/resourcemanager/consumption/armconsumption/models.go @@ -3,413 +3,340 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption import "time" -// AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup -// method. -type AggregatedCostClientGetByManagementGroupOptions struct { - // May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports - // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support - // 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). - Filter *string -} - -// AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup -// method. -type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions struct { - // placeholder for future optional parameters -} - // Amount - The amount plus currency . type Amount struct { // READ-ONLY; Amount currency. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; Amount. - Value *float64 `json:"value,omitempty" azure:"ro"` + Value *float64 } // AmountWithExchangeRate - The amount with exchange rate. type AmountWithExchangeRate struct { // READ-ONLY; Amount currency. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; The exchange rate. - ExchangeRate *float64 `json:"exchangeRate,omitempty" azure:"ro"` + ExchangeRate *float64 // READ-ONLY; The exchange rate month. - ExchangeRateMonth *int32 `json:"exchangeRateMonth,omitempty" azure:"ro"` + ExchangeRateMonth *int32 // READ-ONLY; Amount. - Value *float64 `json:"value,omitempty" azure:"ro"` + Value *float64 } // Balance - A balance resource. type Balance struct { // The properties of the balance. - Properties *BalanceProperties `json:"properties,omitempty"` + Properties *BalanceProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // BalanceProperties - The properties of the balance. type BalanceProperties struct { // The billing frequency. - BillingFrequency *BillingFrequency `json:"billingFrequency,omitempty"` + BillingFrequency *BillingFrequency // READ-ONLY; List of Adjustments (Promo credit, SIE credit etc.). - AdjustmentDetails []*BalancePropertiesAdjustmentDetailsItem `json:"adjustmentDetails,omitempty" azure:"ro"` + AdjustmentDetails []*BalancePropertiesAdjustmentDetailsItem // READ-ONLY; Total adjustment amount. - Adjustments *float64 `json:"adjustments,omitempty" azure:"ro"` + Adjustments *float64 // READ-ONLY; Total charges for Azure Marketplace. - AzureMarketplaceServiceCharges *float64 `json:"azureMarketplaceServiceCharges,omitempty" azure:"ro"` + AzureMarketplaceServiceCharges *float64 // READ-ONLY; The beginning balance for the billing period. - BeginningBalance *float64 `json:"beginningBalance,omitempty" azure:"ro"` + BeginningBalance *float64 // READ-ONLY; Charges Billed separately. - ChargesBilledSeparately *float64 `json:"chargesBilledSeparately,omitempty" azure:"ro"` + ChargesBilledSeparately *float64 // READ-ONLY; The ISO currency in which the meter is charged, for example, USD. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; The ending balance for the billing period (for open periods this will be updated daily). - EndingBalance *float64 `json:"endingBalance,omitempty" azure:"ro"` + EndingBalance *float64 // READ-ONLY; Total new purchase amount. - NewPurchases *float64 `json:"newPurchases,omitempty" azure:"ro"` + NewPurchases *float64 // READ-ONLY; List of new purchases. - NewPurchasesDetails []*BalancePropertiesNewPurchasesDetailsItem `json:"newPurchasesDetails,omitempty" azure:"ro"` + NewPurchasesDetails []*BalancePropertiesNewPurchasesDetailsItem + + // READ-ONLY; Overage Refunds + OverageRefund *float64 // READ-ONLY; Price is hidden or not. - PriceHidden *bool `json:"priceHidden,omitempty" azure:"ro"` + PriceHidden *bool // READ-ONLY; Overage for Azure services. - ServiceOverage *float64 `json:"serviceOverage,omitempty" azure:"ro"` + ServiceOverage *float64 // READ-ONLY; serviceOverage + chargesBilledSeparately. - TotalOverage *float64 `json:"totalOverage,omitempty" azure:"ro"` + TotalOverage *float64 // READ-ONLY; Azure service commitment + total Overage. - TotalUsage *float64 `json:"totalUsage,omitempty" azure:"ro"` + TotalUsage *float64 // READ-ONLY; Total Commitment usage. - Utilized *float64 `json:"utilized,omitempty" azure:"ro"` + Utilized *float64 } type BalancePropertiesAdjustmentDetailsItem struct { // READ-ONLY; the name of new adjustment. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; the value of new adjustment. - Value *float64 `json:"value,omitempty" azure:"ro"` + Value *float64 } type BalancePropertiesNewPurchasesDetailsItem struct { // READ-ONLY; the name of new purchase. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; the value of new purchase. - Value *float64 `json:"value,omitempty" azure:"ro"` -} - -// BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount method. -type BalancesClientGetByBillingAccountOptions struct { - // placeholder for future optional parameters -} - -// BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount -// method. -type BalancesClientGetForBillingPeriodByBillingAccountOptions struct { - // placeholder for future optional parameters + Value *float64 } // Budget - A budget resource. type Budget struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // The properties of the budget. - Properties *BudgetProperties `json:"properties,omitempty"` + Properties *BudgetProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // BudgetComparisonExpression - The comparison expression to be used in the budgets. type BudgetComparisonExpression struct { // REQUIRED; The name of the column to use in comparison. - Name *string `json:"name,omitempty"` + Name *string // REQUIRED; The operator to use for comparison. - Operator *BudgetOperatorType `json:"operator,omitempty"` + Operator *BudgetOperatorType // REQUIRED; Array of values to use for comparison - Values []*string `json:"values,omitempty"` + Values []*string } // BudgetFilter - May be used to filter budgets by resource group, resource, or meter. type BudgetFilter struct { // The logical "AND" expression. Must have at least 2 items. - And []*BudgetFilterProperties `json:"and,omitempty"` + And []*BudgetFilterProperties // Has comparison expression for a dimension - Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"` + Dimensions *BudgetComparisonExpression // Has comparison expression for a tag - Tags *BudgetComparisonExpression `json:"tags,omitempty"` + Tags *BudgetComparisonExpression } // BudgetFilterProperties - The Dimensions or Tags to filter a budget by. type BudgetFilterProperties struct { // Has comparison expression for a dimension - Dimensions *BudgetComparisonExpression `json:"dimensions,omitempty"` + Dimensions *BudgetComparisonExpression // Has comparison expression for a tag - Tags *BudgetComparisonExpression `json:"tags,omitempty"` + Tags *BudgetComparisonExpression } // BudgetProperties - The properties of the budget. type BudgetProperties struct { // REQUIRED; The total amount of cost to track with the budget - Amount *float64 `json:"amount,omitempty"` + Amount *float64 // REQUIRED; The category of the budget, whether the budget tracks cost or usage. - Category *CategoryType `json:"category,omitempty"` + Category *CategoryType // REQUIRED; The time covered by a budget. Tracking of the amount will be reset based on the time grain. BillingMonth, BillingQuarter, // and BillingAnnual are only supported by WD customers - TimeGrain *TimeGrainType `json:"timeGrain,omitempty"` + TimeGrain *TimeGrainType // REQUIRED; Has start and end date of the budget. The start date must be first of the month and should be less than the end // date. Budget start date must be on or after June 1, 2017. Future start date should not // be more than twelve months. Past start date should be selected within the timegrain period. There are no restrictions on // the end date. - TimePeriod *BudgetTimePeriod `json:"timePeriod,omitempty"` + TimePeriod *BudgetTimePeriod // May be used to filter budgets by user-specified dimensions and/or tags. - Filter *BudgetFilter `json:"filter,omitempty"` + Filter *BudgetFilter // Dictionary of notifications associated with the budget. Budget can have up to five notifications. - Notifications map[string]*Notification `json:"notifications,omitempty"` + Notifications map[string]*Notification // READ-ONLY; The current amount of cost which is being tracked for a budget. - CurrentSpend *CurrentSpend `json:"currentSpend,omitempty" azure:"ro"` + CurrentSpend *CurrentSpend // READ-ONLY; The forecasted cost which is being tracked for a budget. - ForecastSpend *ForecastSpend `json:"forecastSpend,omitempty" azure:"ro"` + ForecastSpend *ForecastSpend } // BudgetTimePeriod - The start and end date for a budget. type BudgetTimePeriod struct { // REQUIRED; The start date for the budget. - StartDate *time.Time `json:"startDate,omitempty"` + StartDate *time.Time // The end date for the budget. If not provided, we default this to 10 years from the start date. - EndDate *time.Time `json:"endDate,omitempty"` -} - -// BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method. -type BudgetsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method. -type BudgetsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method. -type BudgetsClientGetOptions struct { - // placeholder for future optional parameters -} - -// BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method. -type BudgetsClientListOptions struct { - // placeholder for future optional parameters + EndDate *time.Time } // BudgetsListResult - Result of listing budgets. It contains a list of available budgets in the scope provided. type BudgetsListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of budgets. - Value []*Budget `json:"value,omitempty" azure:"ro"` -} - -// ChargeSummaryClassification provides polymorphic access to related types. -// Call the interface's GetChargeSummary() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ChargeSummary, *LegacyChargeSummary, *ModernChargeSummary -type ChargeSummaryClassification interface { - // GetChargeSummary returns the ChargeSummary content of the underlying type. - GetChargeSummary() *ChargeSummary + Value []*Budget } // ChargeSummary - A charge summary resource. type ChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. - Kind *ChargeSummaryKind `json:"kind,omitempty"` + Kind *ChargeSummaryKind // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetChargeSummary implements the ChargeSummaryClassification interface for type ChargeSummary. func (c *ChargeSummary) GetChargeSummary() *ChargeSummary { return c } -// ChargesClientListOptions contains the optional parameters for the ChargesClient.List method. -type ChargesClientListOptions struct { - // May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId - // (specific for Partner Led), or for billingProfile scope by - // properties/invoiceSectionId. - Apply *string - // End date - EndDate *string - // May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports - // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', - // 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). - Filter *string - // Start date - StartDate *string -} - // ChargesListResult - Result of listing charge summary. type ChargesListResult struct { // READ-ONLY; The list of charge summary - Value []ChargeSummaryClassification `json:"value,omitempty" azure:"ro"` + Value []ChargeSummaryClassification } // CreditBalanceSummary - Summary of credit balances. type CreditBalanceSummary struct { // READ-ONLY; Current balance. - CurrentBalance *Amount `json:"currentBalance,omitempty" azure:"ro"` + CurrentBalance *Amount // READ-ONLY; Estimated balance. - EstimatedBalance *Amount `json:"estimatedBalance,omitempty" azure:"ro"` + EstimatedBalance *Amount // READ-ONLY; Estimated balance in billing currency. - EstimatedBalanceInBillingCurrency *AmountWithExchangeRate `json:"estimatedBalanceInBillingCurrency,omitempty" azure:"ro"` + EstimatedBalanceInBillingCurrency *AmountWithExchangeRate } // CreditSummary - A credit summary resource. type CreditSummary struct { - // The properties of the credit summary. - Properties *CreditSummaryProperties `json:"properties,omitempty"` - - // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating + // the latest version or not. + ETag *string - // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + // The properties of the credit summary. + Properties *CreditSummaryProperties - // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Resource Id. + ID *string - // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + // READ-ONLY; Resource name. + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // CreditSummaryProperties - The properties of the credit summary. type CreditSummaryProperties struct { // READ-ONLY; Summary of balances associated with this credit summary. - BalanceSummary *CreditBalanceSummary `json:"balanceSummary,omitempty" azure:"ro"` + BalanceSummary *CreditBalanceSummary // READ-ONLY; The billing currency. - BillingCurrency *string `json:"billingCurrency,omitempty" azure:"ro"` + BillingCurrency *string // READ-ONLY; The credit currency. - CreditCurrency *string `json:"creditCurrency,omitempty" azure:"ro"` + CreditCurrency *string // READ-ONLY; The eTag for the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` + ETag *string // READ-ONLY; Expired credit. - ExpiredCredit *Amount `json:"expiredCredit,omitempty" azure:"ro"` + ExpiredCredit *Amount + + // READ-ONLY; If true, the listed details are based on an estimation and it will be subjected to change. + IsEstimatedBalance *bool // READ-ONLY; Pending credit adjustments. - PendingCreditAdjustments *Amount `json:"pendingCreditAdjustments,omitempty" azure:"ro"` + PendingCreditAdjustments *Amount // READ-ONLY; Pending eligible charges. - PendingEligibleCharges *Amount `json:"pendingEligibleCharges,omitempty" azure:"ro"` + PendingEligibleCharges *Amount // READ-ONLY; Credit's reseller. - Reseller *Reseller `json:"reseller,omitempty" azure:"ro"` -} - -// CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method. -type CreditsClientGetOptions struct { - // placeholder for future optional parameters + Reseller *Reseller } // CurrentSpend - The current amount of cost which is being tracked for a budget. type CurrentSpend struct { // READ-ONLY; The total amount of cost which is being tracked by the budget. - Amount *float64 `json:"amount,omitempty" azure:"ro"` + Amount *float64 // READ-ONLY; The unit of measure for the budget amount. - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string } // 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"` + DownloadURL *string // READ-ONLY; Download link validity. - ValidTill *string `json:"validTill,omitempty" azure:"ro"` + ValidTill *string } // ErrorDetails - The details of the error. type ErrorDetails struct { // READ-ONLY; Error code. - Code *string `json:"code,omitempty" azure:"ro"` + Code *string // READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string } // ErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason is provided @@ -422,144 +349,140 @@ type ErrorDetails struct { // header. type ErrorResponse struct { // The details of the error. - Error *ErrorDetails `json:"error,omitempty"` + Error *ErrorDetails } // EventProperties - The event properties. type EventProperties struct { // Identifies the type of the event. - EventType *EventType `json:"eventType,omitempty"` + EventType *EventType // READ-ONLY; The amount of balance adjustment. The property is not available for ConsumptionCommitment lots. - Adjustments *Amount `json:"adjustments,omitempty" azure:"ro"` + Adjustments *Amount // READ-ONLY; The amount of balance adjustment in billing currency. - AdjustmentsInBillingCurrency *AmountWithExchangeRate `json:"adjustmentsInBillingCurrency,omitempty" azure:"ro"` + AdjustmentsInBillingCurrency *AmountWithExchangeRate + + // READ-ONLY; Name of the billing account. + BillingAccountDisplayName *string + + // READ-ONLY; Identifier of the billing account. + BillingAccountID *string // READ-ONLY; The billing currency of the event. - BillingCurrency *string `json:"billingCurrency,omitempty" azure:"ro"` + BillingCurrency *string // READ-ONLY; The display name of the billing profile for which the event happened. The property is only available for billing // account of type MicrosoftCustomerAgreement. - BillingProfileDisplayName *string `json:"billingProfileDisplayName,omitempty" azure:"ro"` + BillingProfileDisplayName *string // READ-ONLY; The ID that uniquely identifies the billing profile for which the event happened. The property is only available // for billing account of type MicrosoftCustomerAgreement. - BillingProfileID *string `json:"billingProfileId,omitempty" azure:"ro"` + BillingProfileID *string // READ-ONLY; Amount of canceled credit. - CanceledCredit *Amount `json:"canceledCredit,omitempty" azure:"ro"` + CanceledCredit *Amount // READ-ONLY; The amount of charges for events of type SettleCharges and PendingEligibleCharges. - Charges *Amount `json:"charges,omitempty" azure:"ro"` + Charges *Amount // READ-ONLY; The amount of charges for events of type SettleCharges and PendingEligibleCharges in billing currency. - ChargesInBillingCurrency *AmountWithExchangeRate `json:"chargesInBillingCurrency,omitempty" azure:"ro"` + ChargesInBillingCurrency *AmountWithExchangeRate - // READ-ONLY; The balance after the event. - ClosedBalance *Amount `json:"closedBalance,omitempty" azure:"ro"` + // READ-ONLY; The balance after the event, Note: This will not be returned for Contributor Organization Type in Multi-Entity + // consumption commitment + ClosedBalance *Amount - // READ-ONLY; The balance in billing currency after the event. - ClosedBalanceInBillingCurrency *AmountWithExchangeRate `json:"closedBalanceInBillingCurrency,omitempty" azure:"ro"` + // READ-ONLY; The balance in billing currency after the event, Note: This will not be returned for Contributor Organization + // Type in Multi-Entity consumption commitment + ClosedBalanceInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The credit currency of the event. - CreditCurrency *string `json:"creditCurrency,omitempty" azure:"ro"` + CreditCurrency *string // READ-ONLY; The amount of expired credit or commitment for NewCredit or SettleCharges event. - CreditExpired *Amount `json:"creditExpired,omitempty" azure:"ro"` + CreditExpired *Amount // READ-ONLY; The amount of expired credit or commitment for NewCredit or SettleCharges event in billing currency. - CreditExpiredInBillingCurrency *AmountWithExchangeRate `json:"creditExpiredInBillingCurrency,omitempty" azure:"ro"` + CreditExpiredInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The description of the event. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The eTag for the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` + ETag *string // READ-ONLY; The number which uniquely identifies the invoice on which the event was billed. This will be empty for unbilled // events. - InvoiceNumber *string `json:"invoiceNumber,omitempty" azure:"ro"` + InvoiceNumber *string + + // READ-ONLY; If true, the listed details are based on an estimation and it will be subjected to change. + IsEstimatedBalance *bool // READ-ONLY; The ID that uniquely identifies the lot for which the event happened. - LotID *string `json:"lotId,omitempty" azure:"ro"` + LotID *string // READ-ONLY; Identifies the source of the lot for which the event happened. - LotSource *string `json:"lotSource,omitempty" azure:"ro"` + LotSource *string // READ-ONLY; The amount of new credit or commitment for NewCredit or SettleCharges event. - NewCredit *Amount `json:"newCredit,omitempty" azure:"ro"` + NewCredit *Amount // READ-ONLY; The amount of new credit or commitment for NewCredit or SettleCharges event in billing currency. - NewCreditInBillingCurrency *AmountWithExchangeRate `json:"newCreditInBillingCurrency,omitempty" azure:"ro"` + NewCreditInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The reseller of the event. - Reseller *Reseller `json:"reseller,omitempty" azure:"ro"` + Reseller *Reseller // READ-ONLY; The date of the event. - TransactionDate *time.Time `json:"transactionDate,omitempty" azure:"ro"` + TransactionDate *time.Time } // EventSummary - An event summary resource. type EventSummary struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // The event properties. - Properties *EventProperties `json:"properties,omitempty"` + Properties *EventProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Events - Result of listing event summary. type Events struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of event summary. - Value []*EventSummary `json:"value,omitempty" azure:"ro"` -} - -// EventsClientListByBillingAccountOptions contains the optional parameters for the EventsClient.NewListByBillingAccountPager -// method. -type EventsClientListByBillingAccountOptions struct { - // May be used to filter the events by lotId, lotSource etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. - // It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value - // pair string where key and value is separated by a colon (:). - Filter *string -} - -// EventsClientListByBillingProfileOptions contains the optional parameters for the EventsClient.NewListByBillingProfilePager -// method. -type EventsClientListByBillingProfileOptions struct { - // placeholder for future optional parameters + Value []*EventSummary } // ForecastSpend - The forecasted cost which is being tracked for a budget. type ForecastSpend struct { // READ-ONLY; The forecasted cost for the total time period which is being tracked by the budget. This value is only provided // if the budget contains a forecast alert type. - Amount *float64 `json:"amount,omitempty" azure:"ro"` + Amount *float64 // READ-ONLY; The unit of measure for the budget amount. - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string } // HighCasedErrorDetails - The details of the error. type HighCasedErrorDetails struct { // READ-ONLY; Error code. - Code *string `json:"code,omitempty" azure:"ro"` + Code *string // READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string } // HighCasedErrorResponse - Error response indicates that the service is not able to process the incoming request. The reason @@ -572,165 +495,156 @@ type HighCasedErrorDetails struct { // header. type HighCasedErrorResponse struct { // The details of the error. - Error *HighCasedErrorDetails `json:"error,omitempty"` + Error *HighCasedErrorDetails } // LegacyChargeSummary - Legacy charge summary. type LegacyChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. - Kind *ChargeSummaryKind `json:"kind,omitempty"` + Kind *ChargeSummaryKind // REQUIRED; Properties for legacy charge summary - Properties *LegacyChargeSummaryProperties `json:"properties,omitempty"` + Properties *LegacyChargeSummaryProperties // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetChargeSummary implements the ChargeSummaryClassification interface for type LegacyChargeSummary. func (l *LegacyChargeSummary) GetChargeSummary() *ChargeSummary { return &ChargeSummary{ - Kind: l.Kind, + ETag: l.ETag, ID: l.ID, + Kind: l.Kind, Name: l.Name, Type: l.Type, - ETag: l.ETag, } } // LegacyChargeSummaryProperties - The properties of legacy charge summary. type LegacyChargeSummaryProperties struct { // READ-ONLY; Azure Charges. - AzureCharges *float64 `json:"azureCharges,omitempty" azure:"ro"` + AzureCharges *float64 + + // READ-ONLY; Marketplace Charges. + AzureMarketplaceCharges *float64 // READ-ONLY; The id of the billing period resource that the charge belongs to. - BillingPeriodID *string `json:"billingPeriodId,omitempty" azure:"ro"` + BillingPeriodID *string // READ-ONLY; Charges Billed separately. - ChargesBilledSeparately *float64 `json:"chargesBilledSeparately,omitempty" azure:"ro"` + ChargesBilledSeparately *float64 // READ-ONLY; Currency Code - Currency *string `json:"currency,omitempty" azure:"ro"` - - // READ-ONLY; Marketplace Charges. - MarketplaceCharges *float64 `json:"marketplaceCharges,omitempty" azure:"ro"` + Currency *string // READ-ONLY; Usage end date. - UsageEnd *string `json:"usageEnd,omitempty" azure:"ro"` + UsageEnd *string // READ-ONLY; Usage start date. - UsageStart *string `json:"usageStart,omitempty" azure:"ro"` + UsageStart *string } // LegacyReservationRecommendation - Legacy reservation recommendation. type LegacyReservationRecommendation struct { // REQUIRED; Specifies the kind of reservation recommendation. - Kind *ReservationRecommendationKind `json:"kind,omitempty"` + Kind *ReservationRecommendationKind // REQUIRED; Properties for legacy reservation recommendation - Properties LegacyReservationRecommendationPropertiesClassification `json:"properties,omitempty"` + Properties LegacyReservationRecommendationPropertiesClassification // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource location - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource sku - SKU *string `json:"sku,omitempty" azure:"ro"` + SKU *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetReservationRecommendation implements the ReservationRecommendationClassification interface for type LegacyReservationRecommendation. func (l *LegacyReservationRecommendation) GetReservationRecommendation() *ReservationRecommendation { return &ReservationRecommendation{ - Kind: l.Kind, - ID: l.ID, - Name: l.Name, - Type: l.Type, Etag: l.Etag, - Tags: l.Tags, + ID: l.ID, + Kind: l.Kind, Location: l.Location, + Name: l.Name, SKU: l.SKU, + Tags: l.Tags, + Type: l.Type, } } -// LegacyReservationRecommendationPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetLegacyReservationRecommendationProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LegacyReservationRecommendationProperties, *LegacySharedScopeReservationRecommendationProperties, *LegacySingleScopeReservationRecommendationProperties -type LegacyReservationRecommendationPropertiesClassification interface { - // GetLegacyReservationRecommendationProperties returns the LegacyReservationRecommendationProperties content of the underlying type. - GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties -} - // LegacyReservationRecommendationProperties - The properties of the reservation recommendation. type LegacyReservationRecommendationProperties struct { // REQUIRED; Shared or single recommendation. - Scope *string `json:"scope,omitempty"` + Scope *string // READ-ONLY; The total amount of cost without reserved instances. - CostWithNoReservedInstances *float64 `json:"costWithNoReservedInstances,omitempty" azure:"ro"` + CostWithNoReservedInstances *float64 // READ-ONLY; The usage date for looking back. - FirstUsageDate *time.Time `json:"firstUsageDate,omitempty" azure:"ro"` + FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. - InstanceFlexibilityGroup *string `json:"instanceFlexibilityGroup,omitempty" azure:"ro"` + InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. - InstanceFlexibilityRatio *float32 `json:"instanceFlexibilityRatio,omitempty" azure:"ro"` + InstanceFlexibilityRatio *float32 // READ-ONLY; The number of days of usage to look back for recommendation. - LookBackPeriod *string `json:"lookBackPeriod,omitempty" azure:"ro"` + LookBackPeriod *string // READ-ONLY; The meter id (GUID) - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Total estimated savings with reserved instances. - NetSavings *float64 `json:"netSavings,omitempty" azure:"ro"` + NetSavings *float64 // READ-ONLY; The normalized Size. - NormalizedSize *string `json:"normalizedSize,omitempty" azure:"ro"` + NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. - RecommendedQuantity *float64 `json:"recommendedQuantity,omitempty" azure:"ro"` + RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. - RecommendedQuantityNormalized *float32 `json:"recommendedQuantityNormalized,omitempty" azure:"ro"` + RecommendedQuantityNormalized *float32 // READ-ONLY; The azure resource type. - ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + ResourceType *string // READ-ONLY; List of sku properties - SKUProperties []*SKUProperty `json:"skuProperties,omitempty" azure:"ro"` + SKUProperties []*SKUProperty // READ-ONLY; RI recommendations in one or three year terms. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string // READ-ONLY; The total amount of cost with reserved instances. - TotalCostWithReservedInstances *float64 `json:"totalCostWithReservedInstances,omitempty" azure:"ro"` + TotalCostWithReservedInstances *float64 } // GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface @@ -742,163 +656,163 @@ func (l *LegacyReservationRecommendationProperties) GetLegacyReservationRecommen // LegacyReservationTransaction - Legacy Reservation transaction resource. type LegacyReservationTransaction struct { // The properties of a legacy reservation transaction. - Properties *LegacyReservationTransactionProperties `json:"properties,omitempty"` + Properties *LegacyReservationTransactionProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags []*string `json:"tags,omitempty" azure:"ro"` + Tags []*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // LegacyReservationTransactionProperties - The properties of a legacy reservation transaction. type LegacyReservationTransactionProperties struct { // READ-ONLY; The name of the account that makes the transaction. - AccountName *string `json:"accountName,omitempty" azure:"ro"` + AccountName *string // READ-ONLY; The email of the account owner that makes the transaction. - AccountOwnerEmail *string `json:"accountOwnerEmail,omitempty" azure:"ro"` + AccountOwnerEmail *string // READ-ONLY; The charge of the transaction. - Amount *float64 `json:"amount,omitempty" azure:"ro"` + Amount *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. - ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + ArmSKUName *string // READ-ONLY; The billing frequency, which can be either one-time or recurring. - BillingFrequency *string `json:"billingFrequency,omitempty" azure:"ro"` + BillingFrequency *string // READ-ONLY; The billing month(yyyyMMdd), on which the event initiated. - BillingMonth *int32 `json:"billingMonth,omitempty" azure:"ro"` + BillingMonth *int32 // READ-ONLY; The cost center of this department if it is a department and a cost center is provided. - CostCenter *string `json:"costCenter,omitempty" azure:"ro"` + CostCenter *string // READ-ONLY; The ISO currency in which the transaction is charged, for example, USD. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; The current enrollment. - CurrentEnrollment *string `json:"currentEnrollment,omitempty" azure:"ro"` + CurrentEnrollment *string // READ-ONLY; The department name. - DepartmentName *string `json:"departmentName,omitempty" azure:"ro"` + DepartmentName *string // READ-ONLY; The description of the transaction. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The date of the transaction - EventDate *time.Time `json:"eventDate,omitempty" azure:"ro"` + EventDate *time.Time - // READ-ONLY; The type of the transaction (Purchase, Cancel, etc.) - EventType *string `json:"eventType,omitempty" azure:"ro"` + // READ-ONLY; The type of the transaction (Purchase, Cancel or Refund). + EventType *string // READ-ONLY; The monetary commitment amount at the enrollment scope. - MonetaryCommitment *float64 `json:"monetaryCommitment,omitempty" azure:"ro"` + MonetaryCommitment *float64 // READ-ONLY; The overage amount at the enrollment scope. - Overage *float64 `json:"overage,omitempty" azure:"ro"` + Overage *float64 // READ-ONLY; The purchasing enrollment. - PurchasingEnrollment *string `json:"purchasingEnrollment,omitempty" azure:"ro"` + PurchasingEnrollment *string // READ-ONLY; The subscription guid that makes the transaction. - PurchasingSubscriptionGUID *string `json:"purchasingSubscriptionGuid,omitempty" azure:"ro"` + PurchasingSubscriptionGUID *string // READ-ONLY; The subscription name that makes the transaction. - PurchasingSubscriptionName *string `json:"purchasingSubscriptionName,omitempty" azure:"ro"` + PurchasingSubscriptionName *string // READ-ONLY; The quantity of the transaction. - Quantity *float64 `json:"quantity,omitempty" azure:"ro"` + Quantity *float64 // READ-ONLY; The region of the transaction. - Region *string `json:"region,omitempty" azure:"ro"` + Region *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. - ReservationOrderID *string `json:"reservationOrderId,omitempty" azure:"ro"` + ReservationOrderID *string // READ-ONLY; The name of the reservation order. - ReservationOrderName *string `json:"reservationOrderName,omitempty" azure:"ro"` + ReservationOrderName *string // READ-ONLY; This is the term of the transaction. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string } // LegacySharedScopeReservationRecommendationProperties - The properties of the legacy reservation recommendation for shared // scope. type LegacySharedScopeReservationRecommendationProperties struct { // REQUIRED; Shared or single recommendation. - Scope *string `json:"scope,omitempty"` + Scope *string // READ-ONLY; The total amount of cost without reserved instances. - CostWithNoReservedInstances *float64 `json:"costWithNoReservedInstances,omitempty" azure:"ro"` + CostWithNoReservedInstances *float64 // READ-ONLY; The usage date for looking back. - FirstUsageDate *time.Time `json:"firstUsageDate,omitempty" azure:"ro"` + FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. - InstanceFlexibilityGroup *string `json:"instanceFlexibilityGroup,omitempty" azure:"ro"` + InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. - InstanceFlexibilityRatio *float32 `json:"instanceFlexibilityRatio,omitempty" azure:"ro"` + InstanceFlexibilityRatio *float32 // READ-ONLY; The number of days of usage to look back for recommendation. - LookBackPeriod *string `json:"lookBackPeriod,omitempty" azure:"ro"` + LookBackPeriod *string // READ-ONLY; The meter id (GUID) - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Total estimated savings with reserved instances. - NetSavings *float64 `json:"netSavings,omitempty" azure:"ro"` + NetSavings *float64 // READ-ONLY; The normalized Size. - NormalizedSize *string `json:"normalizedSize,omitempty" azure:"ro"` + NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. - RecommendedQuantity *float64 `json:"recommendedQuantity,omitempty" azure:"ro"` + RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. - RecommendedQuantityNormalized *float32 `json:"recommendedQuantityNormalized,omitempty" azure:"ro"` + RecommendedQuantityNormalized *float32 // READ-ONLY; The azure resource type. - ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + ResourceType *string // READ-ONLY; List of sku properties - SKUProperties []*SKUProperty `json:"skuProperties,omitempty" azure:"ro"` + SKUProperties []*SKUProperty // READ-ONLY; RI recommendations in one or three year terms. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string // READ-ONLY; The total amount of cost with reserved instances. - TotalCostWithReservedInstances *float64 `json:"totalCostWithReservedInstances,omitempty" azure:"ro"` + TotalCostWithReservedInstances *float64 } // GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface // for type LegacySharedScopeReservationRecommendationProperties. func (l *LegacySharedScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties { return &LegacyReservationRecommendationProperties{ - LookBackPeriod: l.LookBackPeriod, - InstanceFlexibilityRatio: l.InstanceFlexibilityRatio, + CostWithNoReservedInstances: l.CostWithNoReservedInstances, + FirstUsageDate: l.FirstUsageDate, InstanceFlexibilityGroup: l.InstanceFlexibilityGroup, + InstanceFlexibilityRatio: l.InstanceFlexibilityRatio, + LookBackPeriod: l.LookBackPeriod, + MeterID: l.MeterID, + NetSavings: l.NetSavings, NormalizedSize: l.NormalizedSize, + RecommendedQuantity: l.RecommendedQuantity, RecommendedQuantityNormalized: l.RecommendedQuantityNormalized, - MeterID: l.MeterID, ResourceType: l.ResourceType, + SKUProperties: l.SKUProperties, + Scope: l.Scope, Term: l.Term, - CostWithNoReservedInstances: l.CostWithNoReservedInstances, - RecommendedQuantity: l.RecommendedQuantity, TotalCostWithReservedInstances: l.TotalCostWithReservedInstances, - NetSavings: l.NetSavings, - FirstUsageDate: l.FirstUsageDate, - Scope: l.Scope, - SKUProperties: l.SKUProperties, } } @@ -906,875 +820,1022 @@ func (l *LegacySharedScopeReservationRecommendationProperties) GetLegacyReservat // scope. type LegacySingleScopeReservationRecommendationProperties struct { // REQUIRED; Shared or single recommendation. - Scope *string `json:"scope,omitempty"` + Scope *string // READ-ONLY; The total amount of cost without reserved instances. - CostWithNoReservedInstances *float64 `json:"costWithNoReservedInstances,omitempty" azure:"ro"` + CostWithNoReservedInstances *float64 // READ-ONLY; The usage date for looking back. - FirstUsageDate *time.Time `json:"firstUsageDate,omitempty" azure:"ro"` + FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. - InstanceFlexibilityGroup *string `json:"instanceFlexibilityGroup,omitempty" azure:"ro"` + InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. - InstanceFlexibilityRatio *float32 `json:"instanceFlexibilityRatio,omitempty" azure:"ro"` + InstanceFlexibilityRatio *float32 // READ-ONLY; The number of days of usage to look back for recommendation. - LookBackPeriod *string `json:"lookBackPeriod,omitempty" azure:"ro"` + LookBackPeriod *string // READ-ONLY; The meter id (GUID) - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Total estimated savings with reserved instances. - NetSavings *float64 `json:"netSavings,omitempty" azure:"ro"` + NetSavings *float64 // READ-ONLY; The normalized Size. - NormalizedSize *string `json:"normalizedSize,omitempty" azure:"ro"` + NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. - RecommendedQuantity *float64 `json:"recommendedQuantity,omitempty" azure:"ro"` + RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. - RecommendedQuantityNormalized *float32 `json:"recommendedQuantityNormalized,omitempty" azure:"ro"` + RecommendedQuantityNormalized *float32 // READ-ONLY; The azure resource type. - ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + ResourceType *string // READ-ONLY; List of sku properties - SKUProperties []*SKUProperty `json:"skuProperties,omitempty" azure:"ro"` + SKUProperties []*SKUProperty // READ-ONLY; Subscription id associated with single scoped recommendation. - SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"` + SubscriptionID *string // READ-ONLY; RI recommendations in one or three year terms. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string // READ-ONLY; The total amount of cost with reserved instances. - TotalCostWithReservedInstances *float64 `json:"totalCostWithReservedInstances,omitempty" azure:"ro"` + TotalCostWithReservedInstances *float64 } // GetLegacyReservationRecommendationProperties implements the LegacyReservationRecommendationPropertiesClassification interface // for type LegacySingleScopeReservationRecommendationProperties. func (l *LegacySingleScopeReservationRecommendationProperties) GetLegacyReservationRecommendationProperties() *LegacyReservationRecommendationProperties { return &LegacyReservationRecommendationProperties{ - LookBackPeriod: l.LookBackPeriod, - InstanceFlexibilityRatio: l.InstanceFlexibilityRatio, + CostWithNoReservedInstances: l.CostWithNoReservedInstances, + FirstUsageDate: l.FirstUsageDate, InstanceFlexibilityGroup: l.InstanceFlexibilityGroup, + InstanceFlexibilityRatio: l.InstanceFlexibilityRatio, + LookBackPeriod: l.LookBackPeriod, + MeterID: l.MeterID, + NetSavings: l.NetSavings, NormalizedSize: l.NormalizedSize, + RecommendedQuantity: l.RecommendedQuantity, RecommendedQuantityNormalized: l.RecommendedQuantityNormalized, - MeterID: l.MeterID, ResourceType: l.ResourceType, + SKUProperties: l.SKUProperties, + Scope: l.Scope, Term: l.Term, - CostWithNoReservedInstances: l.CostWithNoReservedInstances, - RecommendedQuantity: l.RecommendedQuantity, TotalCostWithReservedInstances: l.TotalCostWithReservedInstances, - NetSavings: l.NetSavings, - FirstUsageDate: l.FirstUsageDate, - Scope: l.Scope, - SKUProperties: l.SKUProperties, } } // LegacyUsageDetail - Legacy usage detail. type LegacyUsageDetail struct { // REQUIRED; Specifies the kind of usage details. - Kind *UsageDetailsKind `json:"kind,omitempty"` + Kind *UsageDetailsKind // REQUIRED; Properties for legacy usage details - Properties *LegacyUsageDetailProperties `json:"properties,omitempty"` + Properties *LegacyUsageDetailProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetUsageDetail implements the UsageDetailClassification interface for type LegacyUsageDetail. func (l *LegacyUsageDetail) GetUsageDetail() *UsageDetail { return &UsageDetail{ - Kind: l.Kind, + Etag: l.Etag, ID: l.ID, + Kind: l.Kind, Name: l.Name, - Type: l.Type, - Etag: l.Etag, Tags: l.Tags, + Type: l.Type, } } // LegacyUsageDetailProperties - The properties of the legacy usage detail. type LegacyUsageDetailProperties struct { // READ-ONLY; Account Name. - AccountName *string `json:"accountName,omitempty" azure:"ro"` + AccountName *string // READ-ONLY; Account Owner Id. - AccountOwnerID *string `json:"accountOwnerId,omitempty" azure:"ro"` + AccountOwnerID *string // READ-ONLY; Additional details of this usage item. By default this is not populated, unless it's specified in $expand. Use // this field to get usage line item specific details such as the actual VM Size // (ServiceType) or the ratio in which the reservation discount is applied. - AdditionalInfo *string `json:"additionalInfo,omitempty" azure:"ro"` + AdditionalInfo *string // READ-ONLY; Unique identifier for the applicable benefit. - BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + BenefitID *string // READ-ONLY; Name of the applicable benefit. - BenefitName *string `json:"benefitName,omitempty" azure:"ro"` + BenefitName *string // READ-ONLY; Billing Account identifier. - BillingAccountID *string `json:"billingAccountId,omitempty" azure:"ro"` + BillingAccountID *string // READ-ONLY; Billing Account Name. - BillingAccountName *string `json:"billingAccountName,omitempty" azure:"ro"` + BillingAccountName *string // READ-ONLY; Billing Currency. - BillingCurrency *string `json:"billingCurrency,omitempty" azure:"ro"` + BillingCurrency *string // READ-ONLY; The billing period end date. - BillingPeriodEndDate *time.Time `json:"billingPeriodEndDate,omitempty" azure:"ro"` + BillingPeriodEndDate *time.Time // READ-ONLY; The billing period start date. - BillingPeriodStartDate *time.Time `json:"billingPeriodStartDate,omitempty" azure:"ro"` + BillingPeriodStartDate *time.Time // READ-ONLY; Billing Profile identifier. - BillingProfileID *string `json:"billingProfileId,omitempty" azure:"ro"` + BillingProfileID *string // READ-ONLY; Billing Profile Name. - BillingProfileName *string `json:"billingProfileName,omitempty" azure:"ro"` + BillingProfileName *string // READ-ONLY; Indicates a charge represents credits, usage, a Marketplace purchase, a reservation fee, or a refund. - ChargeType *string `json:"chargeType,omitempty" azure:"ro"` + ChargeType *string // READ-ONLY; Consumed service name. Name of the azure resource provider that emits the usage or was purchased. This value // is not provided for marketplace usage. - ConsumedService *string `json:"consumedService,omitempty" azure:"ro"` + ConsumedService *string // READ-ONLY; The amount of cost before tax. - Cost *float64 `json:"cost,omitempty" azure:"ro"` + Cost *float64 // READ-ONLY; The cost center of this department if it is a department and a cost center is provided. - CostCenter *string `json:"costCenter,omitempty" azure:"ro"` + CostCenter *string // READ-ONLY; Date for the usage record. - Date *time.Time `json:"date,omitempty" azure:"ro"` + Date *time.Time // READ-ONLY; Effective Price that's charged for the usage. - EffectivePrice *float64 `json:"effectivePrice,omitempty" azure:"ro"` + EffectivePrice *float64 // READ-ONLY; Indicates how frequently this charge will occur. OneTime for purchases which only happen once, Monthly for fees // which recur every month, and UsageBased for charges based on how much a service is used. - Frequency *string `json:"frequency,omitempty" azure:"ro"` + Frequency *string // READ-ONLY; Invoice Section Name. - InvoiceSection *string `json:"invoiceSection,omitempty" azure:"ro"` + InvoiceSection *string // READ-ONLY; Is Azure Credit Eligible. - IsAzureCreditEligible *bool `json:"isAzureCreditEligible,omitempty" azure:"ro"` + IsAzureCreditEligible *bool // READ-ONLY; The details about the meter. By default this is not populated, unless it's specified in $expand. - MeterDetails *MeterDetailsResponse `json:"meterDetails,omitempty" azure:"ro"` + MeterDetails *MeterDetailsResponse // READ-ONLY; The meter id (GUID). Not available for marketplace. For reserved instance this represents the primary meter // for which the reservation was purchased. For the actual VM Size for which the reservation is // purchased see productOrderName. - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Offer Id. Ex: MS-AZR-0017P, MS-AZR-0148P. - OfferID *string `json:"offerId,omitempty" azure:"ro"` + OfferID *string // READ-ONLY; Part Number of the service used. Can be used to join with the price sheet. Not available for marketplace. - PartNumber *string `json:"partNumber,omitempty" azure:"ro"` + PartNumber *string // READ-ONLY; Retail price for the resource. - PayGPrice *float64 `json:"payGPrice,omitempty" azure:"ro"` + PayGPrice *float64 // READ-ONLY; Plan Name. - PlanName *string `json:"planName,omitempty" azure:"ro"` + PlanName *string // READ-ONLY; Identifier that indicates how the meter is priced. - PricingModel *PricingModelType `json:"pricingModel,omitempty" azure:"ro"` + PricingModel *PricingModelType // READ-ONLY; Product name for the consumed service or purchase. Not available for Marketplace. - Product *string `json:"product,omitempty" azure:"ro"` + Product *string // READ-ONLY; Product Order Id. For reservations this is the Reservation Order ID. - ProductOrderID *string `json:"productOrderId,omitempty" azure:"ro"` + ProductOrderID *string // READ-ONLY; Product Order Name. For reservations this is the SKU that was purchased. - ProductOrderName *string `json:"productOrderName,omitempty" azure:"ro"` + ProductOrderName *string // READ-ONLY; Publisher Name. - PublisherName *string `json:"publisherName,omitempty" azure:"ro"` + PublisherName *string // READ-ONLY; Publisher Type. - PublisherType *string `json:"publisherType,omitempty" azure:"ro"` + PublisherType *string // READ-ONLY; The usage quantity. - Quantity *float64 `json:"quantity,omitempty" azure:"ro"` + Quantity *float64 // READ-ONLY; ARM resource id of the reservation. Only applies to records relevant to reservations. - ReservationID *string `json:"reservationId,omitempty" azure:"ro"` + ReservationID *string // READ-ONLY; User provided display name of the reservation. Last known name for a particular day is populated in the daily // data. Only applies to records relevant to reservations. - ReservationName *string `json:"reservationName,omitempty" azure:"ro"` + ReservationName *string // READ-ONLY; Resource Group Name. - ResourceGroup *string `json:"resourceGroup,omitempty" azure:"ro"` + ResourceGroup *string // READ-ONLY; Unique identifier of the Azure Resource Manager usage detail resource. - ResourceID *string `json:"resourceId,omitempty" azure:"ro"` + ResourceID *string // READ-ONLY; Resource Location. - ResourceLocation *string `json:"resourceLocation,omitempty" azure:"ro"` + ResourceLocation *string // READ-ONLY; Resource Name. - ResourceName *string `json:"resourceName,omitempty" azure:"ro"` + ResourceName *string // READ-ONLY; Service-specific metadata. - ServiceInfo1 *string `json:"serviceInfo1,omitempty" azure:"ro"` + ServiceInfo1 *string // READ-ONLY; Legacy field with optional service-specific metadata. - ServiceInfo2 *string `json:"serviceInfo2,omitempty" azure:"ro"` + ServiceInfo2 *string // READ-ONLY; Subscription guid. - SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"` + SubscriptionID *string // READ-ONLY; Subscription name. - SubscriptionName *string `json:"subscriptionName,omitempty" azure:"ro"` + SubscriptionName *string // READ-ONLY; Term (in months). 1 month for monthly recurring purchase. 12 months for a 1 year reservation. 36 months for // a 3 year reservation. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string // READ-ONLY; Unit Price is the price applicable to you. (your EA or other contract price). - UnitPrice *float64 `json:"unitPrice,omitempty" azure:"ro"` + UnitPrice *float64 } // LotProperties - The lot properties. type LotProperties struct { // READ-ONLY; The billing currency of the lot. - BillingCurrency *string `json:"billingCurrency,omitempty" azure:"ro"` + BillingCurrency *string // READ-ONLY; The balance as of the last invoice. - ClosedBalance *Amount `json:"closedBalance,omitempty" azure:"ro"` + ClosedBalance *Amount // READ-ONLY; The balance as of the last invoice in billing currency. - ClosedBalanceInBillingCurrency *AmountWithExchangeRate `json:"closedBalanceInBillingCurrency,omitempty" azure:"ro"` + ClosedBalanceInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The currency of the lot. - CreditCurrency *string `json:"creditCurrency,omitempty" azure:"ro"` + CreditCurrency *string // READ-ONLY; The eTag for the resource. - ETag *string `json:"eTag,omitempty" azure:"ro"` + ETag *string // READ-ONLY; The expiration date of a lot. - ExpirationDate *time.Time `json:"expirationDate,omitempty" azure:"ro"` + ExpirationDate *time.Time + + // READ-ONLY; If true, the listed details are based on an estimation and it will be subjected to change. + IsEstimatedBalance *bool - // READ-ONLY; The original amount of a lot. - OriginalAmount *Amount `json:"originalAmount,omitempty" azure:"ro"` + // READ-ONLY; The organization type of the lot. + OrganizationType *OrganizationType - // READ-ONLY; The original amount of a lot in billing currency. - OriginalAmountInBillingCurrency *AmountWithExchangeRate `json:"originalAmountInBillingCurrency,omitempty" azure:"ro"` + // READ-ONLY; The original amount of a lot, Note: This will not be returned for Contributor Organization Type in Multi-Entity + // consumption commitment + OriginalAmount *Amount + + // READ-ONLY; The original amount of a lot in billing currency, Note: This will not be returned for Contributor Organization + // Type in Multi-Entity consumption commitment + OriginalAmountInBillingCurrency *AmountWithExchangeRate // READ-ONLY; The po number of the invoice on which the lot was added. This property is not available for ConsumptionCommitment // lots. - PoNumber *string `json:"poNumber,omitempty" azure:"ro"` + PoNumber *string // READ-ONLY; The date when the lot was added. - PurchasedDate *time.Time `json:"purchasedDate,omitempty" azure:"ro"` + PurchasedDate *time.Time // READ-ONLY; The reseller of the lot. - Reseller *Reseller `json:"reseller,omitempty" azure:"ro"` + Reseller *Reseller // READ-ONLY; The source of the lot. - Source *LotSource `json:"source,omitempty" azure:"ro"` + Source *LotSource // READ-ONLY; The date when the lot became effective. - StartDate *time.Time `json:"startDate,omitempty" azure:"ro"` + StartDate *time.Time // READ-ONLY; The status of the lot. - Status *Status `json:"status,omitempty" azure:"ro"` + Status *Status + + // READ-ONLY; Amount consumed from the commitment. + UsedAmount *Amount } // LotSummary - A lot summary resource. type LotSummary struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // The lot properties. - Properties *LotProperties `json:"properties,omitempty"` + Properties *LotProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Lots - Result of listing lot summary. type Lots struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of lot summary. - Value []*LotSummary `json:"value,omitempty" azure:"ro"` -} - -// LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.NewListByBillingAccountPager -// method. -type LotsClientListByBillingAccountOptions struct { - // May be used to filter the lots by Status, Source etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does - // not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair - // string where key and value is separated by a colon (:). - Filter *string -} - -// LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager -// method. -type LotsClientListByBillingProfileOptions struct { - // placeholder for future optional parameters -} - -// LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.NewListByCustomerPager 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 + Value []*LotSummary } // ManagementGroupAggregatedCostProperties - The properties of the Management Group Aggregated Cost. type ManagementGroupAggregatedCostProperties struct { // Children of a management group - Children []*ManagementGroupAggregatedCostResult `json:"children,omitempty"` + Children []*ManagementGroupAggregatedCostResult // List of subscription Guids excluded from the calculation of aggregated cost - ExcludedSubscriptions []*string `json:"excludedSubscriptions,omitempty"` + ExcludedSubscriptions []*string // List of subscription Guids included in the calculation of aggregated cost - IncludedSubscriptions []*string `json:"includedSubscriptions,omitempty"` + IncludedSubscriptions []*string // READ-ONLY; Azure Charges. - AzureCharges *float64 `json:"azureCharges,omitempty" azure:"ro"` + AzureCharges *float64 // READ-ONLY; The id of the billing period resource that the aggregated cost belongs to. - BillingPeriodID *string `json:"billingPeriodId,omitempty" azure:"ro"` + BillingPeriodID *string // READ-ONLY; Charges Billed Separately. - ChargesBilledSeparately *float64 `json:"chargesBilledSeparately,omitempty" azure:"ro"` + ChargesBilledSeparately *float64 // READ-ONLY; The ISO currency in which the meter is charged, for example, USD. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; Marketplace Charges. - MarketplaceCharges *float64 `json:"marketplaceCharges,omitempty" azure:"ro"` + MarketplaceCharges *float64 // READ-ONLY; The end of the date time range covered by the aggregated cost. - UsageEnd *time.Time `json:"usageEnd,omitempty" azure:"ro"` + UsageEnd *time.Time // READ-ONLY; The start of the date time range covered by aggregated cost. - UsageStart *time.Time `json:"usageStart,omitempty" azure:"ro"` + UsageStart *time.Time } // ManagementGroupAggregatedCostResult - A management group aggregated cost resource. type ManagementGroupAggregatedCostResult struct { // The properties of the Management Group Aggregated Cost. - Properties *ManagementGroupAggregatedCostProperties `json:"properties,omitempty"` + Properties *ManagementGroupAggregatedCostProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Marketplace - A marketplace resource. type Marketplace struct { // The properties of the marketplace usage detail. - Properties *MarketplaceProperties `json:"properties,omitempty"` + Properties *MarketplaceProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // MarketplaceProperties - The properties of the marketplace usage detail. type MarketplaceProperties struct { // READ-ONLY; Account name. - AccountName *string `json:"accountName,omitempty" azure:"ro"` + AccountName *string // READ-ONLY; Additional information. - AdditionalInfo *string `json:"additionalInfo,omitempty" azure:"ro"` + AdditionalInfo *string // READ-ONLY; Additional details of this usage item. By default this is not populated, unless it's specified in $expand. - AdditionalProperties *string `json:"additionalProperties,omitempty" azure:"ro"` + AdditionalProperties *string // READ-ONLY; The id of the billing period resource that the usage belongs to. - BillingPeriodID *string `json:"billingPeriodId,omitempty" azure:"ro"` + BillingPeriodID *string // READ-ONLY; The quantity of usage. - ConsumedQuantity *float64 `json:"consumedQuantity,omitempty" azure:"ro"` + ConsumedQuantity *float64 // READ-ONLY; Consumed service name. - ConsumedService *string `json:"consumedService,omitempty" azure:"ro"` + ConsumedService *string // READ-ONLY; The cost center of this department if it is a department and a costcenter exists - CostCenter *string `json:"costCenter,omitempty" azure:"ro"` + CostCenter *string // READ-ONLY; The ISO currency in which the meter is charged, for example, USD. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; Department name. - DepartmentName *string `json:"departmentName,omitempty" azure:"ro"` + DepartmentName *string // READ-ONLY; The uri of the resource instance that the usage is about. - InstanceID *string `json:"instanceId,omitempty" azure:"ro"` + InstanceID *string // READ-ONLY; The name of the resource instance that the usage is about. - InstanceName *string `json:"instanceName,omitempty" azure:"ro"` + InstanceName *string // READ-ONLY; The estimated usage is subject to change. - IsEstimated *bool `json:"isEstimated,omitempty" azure:"ro"` + IsEstimated *bool // READ-ONLY; Flag indicating whether this is a recurring charge or not. - IsRecurringCharge *bool `json:"isRecurringCharge,omitempty" azure:"ro"` + IsRecurringCharge *bool // READ-ONLY; The meter id (GUID). - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; The type of offer. - OfferName *string `json:"offerName,omitempty" azure:"ro"` + OfferName *string // READ-ONLY; The order number. - OrderNumber *string `json:"orderNumber,omitempty" azure:"ro"` + OrderNumber *string // READ-ONLY; The name of plan. - PlanName *string `json:"planName,omitempty" azure:"ro"` + PlanName *string // READ-ONLY; The amount of cost before tax. - PretaxCost *float64 `json:"pretaxCost,omitempty" azure:"ro"` + PretaxCost *float64 // READ-ONLY; The name of publisher. - PublisherName *string `json:"publisherName,omitempty" azure:"ro"` + PublisherName *string // READ-ONLY; The name of resource group. - ResourceGroup *string `json:"resourceGroup,omitempty" azure:"ro"` + ResourceGroup *string // READ-ONLY; The marketplace resource rate. - ResourceRate *float64 `json:"resourceRate,omitempty" azure:"ro"` + ResourceRate *float64 // READ-ONLY; Subscription guid. - SubscriptionGUID *string `json:"subscriptionGuid,omitempty" azure:"ro"` + SubscriptionGUID *string // READ-ONLY; Subscription name. - SubscriptionName *string `json:"subscriptionName,omitempty" azure:"ro"` + SubscriptionName *string // READ-ONLY; The unit of measure. - UnitOfMeasure *string `json:"unitOfMeasure,omitempty" azure:"ro"` + UnitOfMeasure *string // READ-ONLY; The end of the date time range covered by the usage detail. - UsageEnd *time.Time `json:"usageEnd,omitempty" azure:"ro"` + UsageEnd *time.Time // READ-ONLY; The start of the date time range covered by the usage detail. - UsageStart *time.Time `json:"usageStart,omitempty" azure:"ro"` -} - -// MarketplacesClientListOptions contains the optional parameters for the MarketplacesClient.NewListPager method. -type MarketplacesClientListOptions struct { - // May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, - // properties/instanceName or properties/instanceId. The filter supports - // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - Filter *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the most recent N marketplaces. - Top *int32 + UsageStart *time.Time } // MarketplacesListResult - Result of listing marketplaces. It contains a list of available marketplaces in reverse chronological // order by billing period. type MarketplacesListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of marketplaces. - Value []*Marketplace `json:"value,omitempty" azure:"ro"` + Value []*Marketplace } // MeterDetails - The properties of the meter detail. type MeterDetails struct { // READ-ONLY; The category of the meter, for example, 'Cloud services', 'Networking', etc.. - MeterCategory *string `json:"meterCategory,omitempty" azure:"ro"` + MeterCategory *string // READ-ONLY; The location in which the Azure service is available. - MeterLocation *string `json:"meterLocation,omitempty" azure:"ro"` + MeterLocation *string // READ-ONLY; The name of the meter, within the given meter category - MeterName *string `json:"meterName,omitempty" azure:"ro"` + MeterName *string // READ-ONLY; The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. - MeterSubCategory *string `json:"meterSubCategory,omitempty" azure:"ro"` + MeterSubCategory *string // READ-ONLY; The pretax listing price. - PretaxStandardRate *float64 `json:"pretaxStandardRate,omitempty" azure:"ro"` + PretaxStandardRate *float64 // READ-ONLY; The name of the service. - ServiceName *string `json:"serviceName,omitempty" azure:"ro"` + ServiceName *string // READ-ONLY; The service tier. - ServiceTier *string `json:"serviceTier,omitempty" azure:"ro"` + ServiceTier *string // READ-ONLY; The total included quantity associated with the offer. - TotalIncludedQuantity *float64 `json:"totalIncludedQuantity,omitempty" azure:"ro"` + TotalIncludedQuantity *float64 // READ-ONLY; The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. - Unit *string `json:"unit,omitempty" azure:"ro"` + Unit *string } // MeterDetailsResponse - The properties of the meter detail. type MeterDetailsResponse struct { // READ-ONLY; The category of the meter, for example, 'Cloud services', 'Networking', etc.. - MeterCategory *string `json:"meterCategory,omitempty" azure:"ro"` + MeterCategory *string // READ-ONLY; The name of the meter, within the given meter category - MeterName *string `json:"meterName,omitempty" azure:"ro"` + MeterName *string // READ-ONLY; The subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. - MeterSubCategory *string `json:"meterSubCategory,omitempty" azure:"ro"` + MeterSubCategory *string // READ-ONLY; The service family. - ServiceFamily *string `json:"serviceFamily,omitempty" azure:"ro"` + ServiceFamily *string // READ-ONLY; The unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. - UnitOfMeasure *string `json:"unitOfMeasure,omitempty" azure:"ro"` + UnitOfMeasure *string } // ModernChargeSummary - Modern charge summary. type ModernChargeSummary struct { // REQUIRED; Specifies the kind of charge summary. - Kind *ChargeSummaryKind `json:"kind,omitempty"` + Kind *ChargeSummaryKind // REQUIRED; Properties for modern charge summary - Properties *ModernChargeSummaryProperties `json:"properties,omitempty"` + Properties *ModernChargeSummaryProperties // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetChargeSummary implements the ChargeSummaryClassification interface for type ModernChargeSummary. func (m *ModernChargeSummary) GetChargeSummary() *ChargeSummary { return &ChargeSummary{ - Kind: m.Kind, + ETag: m.ETag, ID: m.ID, + Kind: m.Kind, Name: m.Name, Type: m.Type, - ETag: m.ETag, } } // ModernChargeSummaryProperties - The properties of modern charge summary. type ModernChargeSummaryProperties struct { // READ-ONLY; Azure Charges. - AzureCharges *Amount `json:"azureCharges,omitempty" azure:"ro"` + AzureCharges *Amount // READ-ONLY; Billing Account Id - BillingAccountID *string `json:"billingAccountId,omitempty" azure:"ro"` + BillingAccountID *string // READ-ONLY; The id of the billing period resource that the charge belongs to. - BillingPeriodID *string `json:"billingPeriodId,omitempty" azure:"ro"` + BillingPeriodID *string // READ-ONLY; Billing Profile Id - BillingProfileID *string `json:"billingProfileId,omitempty" azure:"ro"` + BillingProfileID *string // READ-ONLY; Charges Billed separately. - ChargesBilledSeparately *Amount `json:"chargesBilledSeparately,omitempty" azure:"ro"` + ChargesBilledSeparately *Amount // READ-ONLY; Customer Id - CustomerID *string `json:"customerId,omitempty" azure:"ro"` + CustomerID *string // READ-ONLY; Invoice Section Id - InvoiceSectionID *string `json:"invoiceSectionId,omitempty" azure:"ro"` + InvoiceSectionID *string // READ-ONLY; Is charge Invoiced - IsInvoiced *bool `json:"isInvoiced,omitempty" azure:"ro"` + IsInvoiced *bool // READ-ONLY; Marketplace Charges. - MarketplaceCharges *Amount `json:"marketplaceCharges,omitempty" azure:"ro"` + MarketplaceCharges *Amount + + // READ-ONLY; Subscription guid. + SubscriptionID *string // READ-ONLY; Usage end date. - UsageEnd *string `json:"usageEnd,omitempty" azure:"ro"` + UsageEnd *string // READ-ONLY; Usage start date. - UsageStart *string `json:"usageStart,omitempty" azure:"ro"` + UsageStart *string } // ModernReservationRecommendation - Modern reservation recommendation. type ModernReservationRecommendation struct { // REQUIRED; Specifies the kind of reservation recommendation. - Kind *ReservationRecommendationKind `json:"kind,omitempty"` + Kind *ReservationRecommendationKind // REQUIRED; Properties for modern reservation recommendation - Properties *ModernReservationRecommendationProperties `json:"properties,omitempty"` + Properties ModernReservationRecommendationPropertiesClassification // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource location - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource sku - SKU *string `json:"sku,omitempty" azure:"ro"` + SKU *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetReservationRecommendation implements the ReservationRecommendationClassification interface for type ModernReservationRecommendation. func (m *ModernReservationRecommendation) GetReservationRecommendation() *ReservationRecommendation { return &ReservationRecommendation{ - Kind: m.Kind, - ID: m.ID, - Name: m.Name, - Type: m.Type, Etag: m.Etag, - Tags: m.Tags, + ID: m.ID, + Kind: m.Kind, Location: m.Location, + Name: m.Name, SKU: m.SKU, + Tags: m.Tags, + Type: m.Type, } } // ModernReservationRecommendationProperties - The properties of the reservation recommendation. type ModernReservationRecommendationProperties struct { + // REQUIRED; Shared or single recommendation. + Scope *string + // READ-ONLY; The total amount of cost without reserved instances. - CostWithNoReservedInstances *Amount `json:"costWithNoReservedInstances,omitempty" azure:"ro"` + CostWithNoReservedInstances *Amount // READ-ONLY; The usage date for looking back. - FirstUsageDate *time.Time `json:"firstUsageDate,omitempty" azure:"ro"` + FirstUsageDate *time.Time // READ-ONLY; The instance Flexibility Group. - InstanceFlexibilityGroup *string `json:"instanceFlexibilityGroup,omitempty" azure:"ro"` + InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. - InstanceFlexibilityRatio *float32 `json:"instanceFlexibilityRatio,omitempty" azure:"ro"` + InstanceFlexibilityRatio *float32 // READ-ONLY; Resource Location. - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The number of days of usage to look back for recommendation. - LookBackPeriod *int32 `json:"lookBackPeriod,omitempty" azure:"ro"` + LookBackPeriod *int32 // READ-ONLY; The meter id (GUID) - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Total estimated savings with reserved instances. - NetSavings *Amount `json:"netSavings,omitempty" azure:"ro"` + NetSavings *Amount // READ-ONLY; The normalized Size. - NormalizedSize *string `json:"normalizedSize,omitempty" azure:"ro"` + NormalizedSize *string // READ-ONLY; Recommended quality for reserved instances. - RecommendedQuantity *float64 `json:"recommendedQuantity,omitempty" azure:"ro"` + RecommendedQuantity *float64 // READ-ONLY; The recommended Quantity Normalized. - RecommendedQuantityNormalized *float32 `json:"recommendedQuantityNormalized,omitempty" azure:"ro"` + RecommendedQuantityNormalized *float32 + + // READ-ONLY; Resource type. + ResourceType *string // READ-ONLY; This is the ARM Sku name. - SKUName *string `json:"skuName,omitempty" azure:"ro"` + SKUName *string // READ-ONLY; List of sku properties - SKUProperties []*SKUProperty `json:"skuProperties,omitempty" azure:"ro"` - - // READ-ONLY; Shared or single recommendation. - Scope *string `json:"scope,omitempty" azure:"ro"` + SKUProperties []*SKUProperty // READ-ONLY; RI recommendations in one or three year terms. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string // READ-ONLY; The total amount of cost with reserved instances. - TotalCostWithReservedInstances *Amount `json:"totalCostWithReservedInstances,omitempty" azure:"ro"` + TotalCostWithReservedInstances *Amount +} + +// GetModernReservationRecommendationProperties implements the ModernReservationRecommendationPropertiesClassification interface +// for type ModernReservationRecommendationProperties. +func (m *ModernReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties { + return m } // ModernReservationTransaction - Modern Reservation transaction resource. type ModernReservationTransaction struct { // REQUIRED; The properties of a modern reservation transaction. - Properties *ModernReservationTransactionProperties `json:"properties,omitempty"` + Properties *ModernReservationTransactionProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags []*string `json:"tags,omitempty" azure:"ro"` + Tags []*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ModernReservationTransactionProperties - The properties of a modern reservation transaction. type ModernReservationTransactionProperties struct { // READ-ONLY; The charge of the transaction. - Amount *float64 `json:"amount,omitempty" azure:"ro"` + Amount *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. - ArmSKUName *string `json:"armSkuName,omitempty" azure:"ro"` + ArmSKUName *string // READ-ONLY; The billing frequency, which can be either one-time or recurring. - BillingFrequency *string `json:"billingFrequency,omitempty" azure:"ro"` + BillingFrequency *string // READ-ONLY; Billing profile Id. - BillingProfileID *string `json:"billingProfileId,omitempty" azure:"ro"` + BillingProfileID *string // READ-ONLY; Billing profile name. - BillingProfileName *string `json:"billingProfileName,omitempty" azure:"ro"` + BillingProfileName *string // READ-ONLY; The ISO currency in which the transaction is charged, for example, USD. - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; The description of the transaction. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The date of the transaction - EventDate *time.Time `json:"eventDate,omitempty" azure:"ro"` + EventDate *time.Time - // READ-ONLY; The type of the transaction (Purchase, Cancel, etc.) - EventType *string `json:"eventType,omitempty" azure:"ro"` + // READ-ONLY; The type of the transaction (Purchase, Cancel or Refund). + EventType *string // READ-ONLY; Invoice Number - Invoice *string `json:"invoice,omitempty" azure:"ro"` + Invoice *string // READ-ONLY; Invoice Id as on the invoice where the specific transaction appears. - InvoiceID *string `json:"invoiceId,omitempty" azure:"ro"` + InvoiceID *string // READ-ONLY; Invoice Section Id - InvoiceSectionID *string `json:"invoiceSectionId,omitempty" azure:"ro"` + InvoiceSectionID *string // READ-ONLY; Invoice Section Name. - InvoiceSectionName *string `json:"invoiceSectionName,omitempty" azure:"ro"` + InvoiceSectionName *string // READ-ONLY; The subscription guid that makes the transaction. - PurchasingSubscriptionGUID *string `json:"purchasingSubscriptionGuid,omitempty" azure:"ro"` + PurchasingSubscriptionGUID *string // READ-ONLY; The subscription name that makes the transaction. - PurchasingSubscriptionName *string `json:"purchasingSubscriptionName,omitempty" azure:"ro"` + PurchasingSubscriptionName *string // READ-ONLY; The quantity of the transaction. - Quantity *float64 `json:"quantity,omitempty" azure:"ro"` + Quantity *float64 // READ-ONLY; The region of the transaction. - Region *string `json:"region,omitempty" azure:"ro"` + Region *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. - ReservationOrderID *string `json:"reservationOrderId,omitempty" azure:"ro"` + ReservationOrderID *string // READ-ONLY; The name of the reservation order. - ReservationOrderName *string `json:"reservationOrderName,omitempty" azure:"ro"` + ReservationOrderName *string // READ-ONLY; This is the term of the transaction. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string } // ModernReservationTransactionsListResult - Result of listing reservation recommendations. type ModernReservationTransactionsListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of reservation recommendations. - Value []*ModernReservationTransaction `json:"value,omitempty" azure:"ro"` + Value []*ModernReservationTransaction +} + +// ModernSharedScopeReservationRecommendationProperties - The properties of the modern reservation recommendation for shared +// scope. +type ModernSharedScopeReservationRecommendationProperties struct { + // REQUIRED; Shared or single recommendation. + Scope *string + + // READ-ONLY; The total amount of cost without reserved instances. + CostWithNoReservedInstances *Amount + + // READ-ONLY; The usage date for looking back. + FirstUsageDate *time.Time + + // READ-ONLY; The instance Flexibility Group. + InstanceFlexibilityGroup *string + + // READ-ONLY; The instance Flexibility Ratio. + InstanceFlexibilityRatio *float32 + + // READ-ONLY; Resource Location. + Location *string + + // READ-ONLY; The number of days of usage to look back for recommendation. + LookBackPeriod *int32 + + // READ-ONLY; The meter id (GUID) + MeterID *string + + // READ-ONLY; Total estimated savings with reserved instances. + NetSavings *Amount + + // READ-ONLY; The normalized Size. + NormalizedSize *string + + // READ-ONLY; Recommended quality for reserved instances. + RecommendedQuantity *float64 + + // READ-ONLY; The recommended Quantity Normalized. + RecommendedQuantityNormalized *float32 + + // READ-ONLY; Resource type. + ResourceType *string + + // READ-ONLY; This is the ARM Sku name. + SKUName *string + + // READ-ONLY; List of sku properties + SKUProperties []*SKUProperty + + // READ-ONLY; RI recommendations in one or three year terms. + Term *string + + // READ-ONLY; The total amount of cost with reserved instances. + TotalCostWithReservedInstances *Amount +} + +// GetModernReservationRecommendationProperties implements the ModernReservationRecommendationPropertiesClassification interface +// for type ModernSharedScopeReservationRecommendationProperties. +func (m *ModernSharedScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties { + return &ModernReservationRecommendationProperties{ + CostWithNoReservedInstances: m.CostWithNoReservedInstances, + FirstUsageDate: m.FirstUsageDate, + InstanceFlexibilityGroup: m.InstanceFlexibilityGroup, + InstanceFlexibilityRatio: m.InstanceFlexibilityRatio, + Location: m.Location, + LookBackPeriod: m.LookBackPeriod, + MeterID: m.MeterID, + NetSavings: m.NetSavings, + NormalizedSize: m.NormalizedSize, + RecommendedQuantity: m.RecommendedQuantity, + RecommendedQuantityNormalized: m.RecommendedQuantityNormalized, + ResourceType: m.ResourceType, + SKUName: m.SKUName, + SKUProperties: m.SKUProperties, + Scope: m.Scope, + Term: m.Term, + TotalCostWithReservedInstances: m.TotalCostWithReservedInstances, + } +} + +// ModernSingleScopeReservationRecommendationProperties - The properties of the modern reservation recommendation for single +// scope. +type ModernSingleScopeReservationRecommendationProperties struct { + // REQUIRED; Shared or single recommendation. + Scope *string + + // READ-ONLY; The total amount of cost without reserved instances. + CostWithNoReservedInstances *Amount + + // READ-ONLY; The usage date for looking back. + FirstUsageDate *time.Time + + // READ-ONLY; The instance Flexibility Group. + InstanceFlexibilityGroup *string + + // READ-ONLY; The instance Flexibility Ratio. + InstanceFlexibilityRatio *float32 + + // READ-ONLY; Resource Location. + Location *string + + // READ-ONLY; The number of days of usage to look back for recommendation. + LookBackPeriod *int32 + + // READ-ONLY; The meter id (GUID) + MeterID *string + + // READ-ONLY; Total estimated savings with reserved instances. + NetSavings *Amount + + // READ-ONLY; The normalized Size. + NormalizedSize *string + + // READ-ONLY; Recommended quality for reserved instances. + RecommendedQuantity *float64 + + // READ-ONLY; The recommended Quantity Normalized. + RecommendedQuantityNormalized *float32 + + // READ-ONLY; Resource type. + ResourceType *string + + // READ-ONLY; This is the ARM Sku name. + SKUName *string + + // READ-ONLY; List of sku properties + SKUProperties []*SKUProperty + + // READ-ONLY; Subscription ID associated with single scoped recommendation. + SubscriptionID *string + + // READ-ONLY; RI recommendations in one or three year terms. + Term *string + + // READ-ONLY; The total amount of cost with reserved instances. + TotalCostWithReservedInstances *Amount +} + +// GetModernReservationRecommendationProperties implements the ModernReservationRecommendationPropertiesClassification interface +// for type ModernSingleScopeReservationRecommendationProperties. +func (m *ModernSingleScopeReservationRecommendationProperties) GetModernReservationRecommendationProperties() *ModernReservationRecommendationProperties { + return &ModernReservationRecommendationProperties{ + CostWithNoReservedInstances: m.CostWithNoReservedInstances, + FirstUsageDate: m.FirstUsageDate, + InstanceFlexibilityGroup: m.InstanceFlexibilityGroup, + InstanceFlexibilityRatio: m.InstanceFlexibilityRatio, + Location: m.Location, + LookBackPeriod: m.LookBackPeriod, + MeterID: m.MeterID, + NetSavings: m.NetSavings, + NormalizedSize: m.NormalizedSize, + RecommendedQuantity: m.RecommendedQuantity, + RecommendedQuantityNormalized: m.RecommendedQuantityNormalized, + ResourceType: m.ResourceType, + SKUName: m.SKUName, + SKUProperties: m.SKUProperties, + Scope: m.Scope, + Term: m.Term, + TotalCostWithReservedInstances: m.TotalCostWithReservedInstances, + } } // ModernUsageDetail - Modern usage detail. type ModernUsageDetail struct { // REQUIRED; Specifies the kind of usage details. - Kind *UsageDetailsKind `json:"kind,omitempty"` + Kind *UsageDetailsKind // REQUIRED; Properties for modern usage details - Properties *ModernUsageDetailProperties `json:"properties,omitempty"` + Properties *ModernUsageDetailProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetUsageDetail implements the UsageDetailClassification interface for type ModernUsageDetail. func (m *ModernUsageDetail) GetUsageDetail() *UsageDetail { return &UsageDetail{ - Kind: m.Kind, + Etag: m.Etag, ID: m.ID, + Kind: m.Kind, Name: m.Name, - Type: m.Type, - Etag: m.Etag, Tags: m.Tags, + Type: m.Type, } } @@ -1782,238 +1843,238 @@ func (m *ModernUsageDetail) GetUsageDetail() *UsageDetail { type ModernUsageDetailProperties struct { // READ-ONLY; Additional details of this usage item. Use this field to get usage line item specific details such as the actual // VM Size (ServiceType) or the ratio in which the reservation discount is applied. - AdditionalInfo *string `json:"additionalInfo,omitempty" azure:"ro"` + AdditionalInfo *string // READ-ONLY; Unique identifier for the applicable benefit. - BenefitID *string `json:"benefitId,omitempty" azure:"ro"` + BenefitID *string // READ-ONLY; Name of the applicable benefit. - BenefitName *string `json:"benefitName,omitempty" azure:"ro"` + BenefitName *string // READ-ONLY; Billing Account identifier. - BillingAccountID *string `json:"billingAccountId,omitempty" azure:"ro"` + BillingAccountID *string // READ-ONLY; Name of the Billing Account. - BillingAccountName *string `json:"billingAccountName,omitempty" azure:"ro"` + BillingAccountName *string // READ-ONLY; The currency defining the billed cost. - BillingCurrencyCode *string `json:"billingCurrencyCode,omitempty" azure:"ro"` + BillingCurrencyCode *string // READ-ONLY; Billing Period End Date as in the invoice. - BillingPeriodEndDate *time.Time `json:"billingPeriodEndDate,omitempty" azure:"ro"` + BillingPeriodEndDate *time.Time // READ-ONLY; Billing Period Start Date as in the invoice. - BillingPeriodStartDate *time.Time `json:"billingPeriodStartDate,omitempty" azure:"ro"` + BillingPeriodStartDate *time.Time // READ-ONLY; Identifier for the billing profile that groups costs across invoices in the a singular billing currency across // across the customers who have onboarded the Microsoft customer agreement and the // customers in CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc. - BillingProfileID *string `json:"billingProfileId,omitempty" azure:"ro"` + BillingProfileID *string // READ-ONLY; Name of the billing profile that groups costs across invoices in the a singular billing currency across across // the customers who have onboarded the Microsoft customer agreement and the customers in // CSP who have made entitlement purchases like SaaS, Marketplace, RI, etc. - BillingProfileName *string `json:"billingProfileName,omitempty" azure:"ro"` + BillingProfileName *string // READ-ONLY; Indicates a charge represents credits, usage, a Marketplace purchase, a reservation fee, or a refund. - ChargeType *string `json:"chargeType,omitempty" azure:"ro"` + ChargeType *string // READ-ONLY; Consumed service name. Name of the azure resource provider that emits the usage or was purchased. This value // is not provided for marketplace usage. - ConsumedService *string `json:"consumedService,omitempty" azure:"ro"` + ConsumedService *string // READ-ONLY; Name for Cost Allocation Rule. - CostAllocationRuleName *string `json:"costAllocationRuleName,omitempty" azure:"ro"` + CostAllocationRuleName *string // READ-ONLY; The cost center of this department if it is a department and a cost center is provided. - CostCenter *string `json:"costCenter,omitempty" azure:"ro"` + CostCenter *string // READ-ONLY; ExtendedCost or blended cost before tax in billed currency. - CostInBillingCurrency *float64 `json:"costInBillingCurrency,omitempty" azure:"ro"` + CostInBillingCurrency *float64 // READ-ONLY; ExtendedCost or blended cost before tax in pricing currency to correlate with prices. - CostInPricingCurrency *float64 `json:"costInPricingCurrency,omitempty" azure:"ro"` + CostInPricingCurrency *float64 // READ-ONLY; Estimated extendedCost or blended cost before tax in USD. - CostInUSD *float64 `json:"costInUSD,omitempty" azure:"ro"` + CostInUSD *float64 // READ-ONLY; Name of the customer's AAD tenant. - CustomerName *string `json:"customerName,omitempty" azure:"ro"` + CustomerName *string // READ-ONLY; Identifier of the customer's AAD tenant. - CustomerTenantID *string `json:"customerTenantId,omitempty" azure:"ro"` + CustomerTenantID *string // READ-ONLY; Date for the usage record. - Date *time.Time `json:"date,omitempty" azure:"ro"` + Date *time.Time // READ-ONLY; Effective Price that's charged for the usage. - EffectivePrice *float64 `json:"effectivePrice,omitempty" azure:"ro"` + EffectivePrice *float64 // READ-ONLY; Exchange rate used in conversion from pricing currency to billing currency. - ExchangeRate *string `json:"exchangeRate,omitempty" azure:"ro"` + ExchangeRate *string // READ-ONLY; Date on which exchange rate used in conversion from pricing currency to billing currency. - ExchangeRateDate *time.Time `json:"exchangeRateDate,omitempty" azure:"ro"` + ExchangeRateDate *time.Time // READ-ONLY; Exchange Rate from pricing currency to billing currency. - ExchangeRatePricingToBilling *float64 `json:"exchangeRatePricingToBilling,omitempty" azure:"ro"` + ExchangeRatePricingToBilling *float64 // READ-ONLY; Indicates how frequently this charge will occur. OneTime for purchases which only happen once, Monthly for fees // which recur every month, and UsageBased for charges based on how much a service is used. - Frequency *string `json:"frequency,omitempty" azure:"ro"` + Frequency *string // READ-ONLY; Instance Name. - InstanceName *string `json:"instanceName,omitempty" azure:"ro"` + InstanceName *string // READ-ONLY; Invoice ID as on the invoice where the specific transaction appears. - InvoiceID *string `json:"invoiceId,omitempty" azure:"ro"` + InvoiceID *string // READ-ONLY; Identifier of the project that is being charged in the invoice. Not applicable for Microsoft Customer Agreements // onboarded by partners. - InvoiceSectionID *string `json:"invoiceSectionId,omitempty" azure:"ro"` + InvoiceSectionID *string // READ-ONLY; Name of the project that is being charged in the invoice. Not applicable for Microsoft Customer Agreements onboarded // by partners. - InvoiceSectionName *string `json:"invoiceSectionName,omitempty" azure:"ro"` + InvoiceSectionName *string // READ-ONLY; Determines if the cost is eligible to be paid for using Azure credits. - IsAzureCreditEligible *bool `json:"isAzureCreditEligible,omitempty" azure:"ro"` + IsAzureCreditEligible *bool // READ-ONLY; Market Price that's charged for the usage. - MarketPrice *float64 `json:"marketPrice,omitempty" azure:"ro"` + MarketPrice *float64 // READ-ONLY; Identifies the top-level service for the usage. - MeterCategory *string `json:"meterCategory,omitempty" azure:"ro"` + MeterCategory *string // READ-ONLY; The meter id (GUID). Not available for marketplace. For reserved instance this represents the primary meter // for which the reservation was purchased. For the actual VM Size for which the reservation is // purchased see productOrderName. - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Identifies the name of the meter against which consumption is measured. - MeterName *string `json:"meterName,omitempty" azure:"ro"` + MeterName *string // READ-ONLY; Identifies the location of the datacenter for certain services that are priced based on datacenter location. - MeterRegion *string `json:"meterRegion,omitempty" azure:"ro"` + MeterRegion *string // READ-ONLY; Defines the type or sub-category of Azure service that can affect the rate. - MeterSubCategory *string `json:"meterSubCategory,omitempty" azure:"ro"` + MeterSubCategory *string // READ-ONLY; Flag to indicate if partner earned credit has been applied or not. - PartnerEarnedCreditApplied *string `json:"partnerEarnedCreditApplied,omitempty" azure:"ro"` + PartnerEarnedCreditApplied *string // READ-ONLY; Rate of discount applied if there is a partner earned credit (PEC) based on partner admin link access. - PartnerEarnedCreditRate *float64 `json:"partnerEarnedCreditRate,omitempty" azure:"ro"` + PartnerEarnedCreditRate *float64 // READ-ONLY; Name of the partner' AAD tenant. - PartnerName *string `json:"partnerName,omitempty" azure:"ro"` + PartnerName *string // READ-ONLY; Identifier for the partner's AAD tenant. - PartnerTenantID *string `json:"partnerTenantId,omitempty" azure:"ro"` + PartnerTenantID *string // READ-ONLY; Retail price for the resource. - PayGPrice *float64 `json:"payGPrice,omitempty" azure:"ro"` + PayGPrice *float64 // READ-ONLY; The amount of PayG cost before tax in billing currency. - PaygCostInBillingCurrency *float64 `json:"paygCostInBillingCurrency,omitempty" azure:"ro"` + PaygCostInBillingCurrency *float64 // READ-ONLY; The amount of PayG cost before tax in US Dollar currency. - PaygCostInUSD *float64 `json:"paygCostInUSD,omitempty" azure:"ro"` + PaygCostInUSD *float64 // READ-ONLY; Reference to an original invoice there is a refund (negative cost). This is populated only when there is a refund. - PreviousInvoiceID *string `json:"previousInvoiceId,omitempty" azure:"ro"` + PreviousInvoiceID *string // READ-ONLY; Pricing Billing Currency. - PricingCurrencyCode *string `json:"pricingCurrencyCode,omitempty" azure:"ro"` + PricingCurrencyCode *string // READ-ONLY; Identifier that indicates how the meter is priced - PricingModel *PricingModelType `json:"pricingModel,omitempty" azure:"ro"` + PricingModel *PricingModelType // READ-ONLY; Name of the product that has accrued charges by consumption or purchase as listed in the invoice. Not available // for Marketplace. - Product *string `json:"product,omitempty" azure:"ro"` + Product *string // READ-ONLY; Identifier for the product that has accrued charges by consumption or purchase . This is the concatenated key // of productId and SkuId in partner center. - ProductIdentifier *string `json:"productIdentifier,omitempty" azure:"ro"` + ProductIdentifier *string // READ-ONLY; The identifier for the asset or Azure plan name that the subscription belongs to. For example: Azure Plan. For // reservations this is the Reservation Order ID. - ProductOrderID *string `json:"productOrderId,omitempty" azure:"ro"` + ProductOrderID *string // READ-ONLY; Product Order Name. For reservations this is the SKU that was purchased. - ProductOrderName *string `json:"productOrderName,omitempty" azure:"ro"` + ProductOrderName *string // READ-ONLY; Identifier for Product Category or Line Of Business, Ex - Azure, Microsoft 365, AWS e.t.c - Provider *string `json:"provider,omitempty" azure:"ro"` + Provider *string // READ-ONLY; Publisher Id. - PublisherID *string `json:"publisherId,omitempty" azure:"ro"` + PublisherID *string // READ-ONLY; Name of the publisher of the service including Microsoft or Third Party publishers. - PublisherName *string `json:"publisherName,omitempty" azure:"ro"` + PublisherName *string // READ-ONLY; Type of publisher that identifies if the publisher is first party, third party reseller or third party agency. - PublisherType *string `json:"publisherType,omitempty" azure:"ro"` + PublisherType *string // READ-ONLY; Measure the quantity purchased or consumed.The amount of the meter used during the billing period. - Quantity *float64 `json:"quantity,omitempty" azure:"ro"` + Quantity *float64 // READ-ONLY; MPNId for the reseller associated with the subscription. - ResellerMpnID *string `json:"resellerMpnId,omitempty" azure:"ro"` + ResellerMpnID *string // READ-ONLY; Reseller Name. - ResellerName *string `json:"resellerName,omitempty" azure:"ro"` + ResellerName *string // READ-ONLY; ARM resource id of the reservation. Only applies to records relevant to reservations. - ReservationID *string `json:"reservationId,omitempty" azure:"ro"` + ReservationID *string // READ-ONLY; User provided display name of the reservation. Last known name for a particular day is populated in the daily // data. Only applies to records relevant to reservations. - ReservationName *string `json:"reservationName,omitempty" azure:"ro"` + ReservationName *string // READ-ONLY; Name of the Azure resource group used for cohesive lifecycle management of resources. - ResourceGroup *string `json:"resourceGroup,omitempty" azure:"ro"` + ResourceGroup *string // READ-ONLY; Name of the resource location. - ResourceLocation *string `json:"resourceLocation,omitempty" azure:"ro"` + ResourceLocation *string // READ-ONLY; Resource Location Normalized. - ResourceLocationNormalized *string `json:"resourceLocationNormalized,omitempty" azure:"ro"` + ResourceLocationNormalized *string // READ-ONLY; List the service family for the product purchased or charged (Example: Storage ; Compute). - ServiceFamily *string `json:"serviceFamily,omitempty" azure:"ro"` + ServiceFamily *string // READ-ONLY; Service-specific metadata. - ServiceInfo1 *string `json:"serviceInfo1,omitempty" azure:"ro"` + ServiceInfo1 *string // READ-ONLY; Legacy field with optional service-specific metadata. - ServiceInfo2 *string `json:"serviceInfo2,omitempty" azure:"ro"` + ServiceInfo2 *string // READ-ONLY; End date for the period when the service usage was rated for charges. The prices for Azure services are determined // based on the rating period. - ServicePeriodEndDate *time.Time `json:"servicePeriodEndDate,omitempty" azure:"ro"` + ServicePeriodEndDate *time.Time // READ-ONLY; Start date for the rating period when the service usage was rated for charges. The prices for Azure services // are determined for the rating period. - ServicePeriodStartDate *time.Time `json:"servicePeriodStartDate,omitempty" azure:"ro"` + ServicePeriodStartDate *time.Time // READ-ONLY; Unique Microsoft generated identifier for the Azure Subscription. - SubscriptionGUID *string `json:"subscriptionGuid,omitempty" azure:"ro"` + SubscriptionGUID *string // READ-ONLY; Name of the Azure Subscription. - SubscriptionName *string `json:"subscriptionName,omitempty" azure:"ro"` + SubscriptionName *string // READ-ONLY; Term (in months). Displays the term for the validity of the offer. For example. In case of reserved instances // it displays 12 months for yearly term of reserved instance. For one time purchases or // recurring purchases, the terms displays 1 month; This is not applicable for Azure consumption. - Term *string `json:"term,omitempty" azure:"ro"` + Term *string // READ-ONLY; Identifies the Unit that the service is charged in. For example, GB, hours, 10,000 s. - UnitOfMeasure *string `json:"unitOfMeasure,omitempty" azure:"ro"` + UnitOfMeasure *string // READ-ONLY; Unit Price is the price applicable to you. (your EA or other contract price). - UnitPrice *float64 `json:"unitPrice,omitempty" azure:"ro"` + UnitPrice *float64 } // Notification - The notification associated with a budget. @@ -2021,294 +2082,274 @@ type Notification struct { // REQUIRED; Email addresses to send the budget notification to when the threshold is exceeded. Must have at least one contact // email or contact group specified at the Subscription or Resource Group scopes. All // other scopes must have at least one contact email specified. - ContactEmails []*string `json:"contactEmails,omitempty"` + ContactEmails []*string // REQUIRED; The notification is enabled or not. - Enabled *bool `json:"enabled,omitempty"` + Enabled *bool // REQUIRED; The comparison operator. - Operator *OperatorType `json:"operator,omitempty"` + Operator *OperatorType // REQUIRED; Threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It // is always percent and has to be between 0 and 1000. - Threshold *float64 `json:"threshold,omitempty"` + Threshold *float64 // Action groups to send the budget notification to when the threshold is exceeded. Must be provided as a fully qualified // Azure resource id. Only supported at Subscription or Resource Group scopes. - ContactGroups []*string `json:"contactGroups,omitempty"` + ContactGroups []*string // Contact roles to send the budget notification to when the threshold is exceeded. - ContactRoles []*string `json:"contactRoles,omitempty"` + ContactRoles []*string // Language in which the recipient will receive the notification - Locale *CultureCode `json:"locale,omitempty"` + Locale *CultureCode // The type of threshold - ThresholdType *ThresholdType `json:"thresholdType,omitempty"` + ThresholdType *ThresholdType } // Operation - A Consumption REST API operation. type Operation struct { // The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` + Display *OperationDisplay // READ-ONLY; Operation Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string } // OperationDisplay - The object that represents the operation. type OperationDisplay struct { // READ-ONLY; Description of the operation. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; Service provider: Microsoft.Consumption. - Provider *string `json:"provider,omitempty" azure:"ro"` + Provider *string // READ-ONLY; Resource on which the operation is performed: UsageDetail, etc. - Resource *string `json:"resource,omitempty" azure:"ro"` + Resource *string } // OperationListResult - Result of listing consumption operations. It contains a list of operations and a URL link to get // the next set of results. type OperationListResult struct { // READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; List of consumption operations supported by the Microsoft.Consumption resource provider. - Value []*Operation `json:"value,omitempty" azure:"ro"` + Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// PriceSheetClientGetByBillingPeriodOptions contains the optional parameters for the PriceSheetClient.GetByBillingPeriod -// method. -type PriceSheetClientGetByBillingPeriodOptions struct { - // May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when - // returning price sheet. - Expand *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the top N results. - Top *int32 -} +// OperationStatus - The status of the long running operation. +type OperationStatus struct { + // The properties of the resource generated. + Properties *PricesheetDownloadProperties -// PriceSheetClientGetOptions contains the optional parameters for the PriceSheetClient.Get method. -type PriceSheetClientGetOptions struct { - // May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when - // returning price sheet. - Expand *string - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the top N results. - Top *int32 + // The status of the long running operation. + Status *OperationStatusType } // PriceSheetModel - price sheet result. It contains the pricesheet associated with billing period type PriceSheetModel struct { // READ-ONLY; Pricesheet download details. - Download *MeterDetails `json:"download,omitempty" azure:"ro"` + Download *MeterDetails // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; Price sheet - Pricesheets []*PriceSheetProperties `json:"pricesheets,omitempty" azure:"ro"` + Pricesheets []*PriceSheetProperties } // PriceSheetProperties - The properties of the price sheet. type PriceSheetProperties struct { // READ-ONLY; The id of the billing period resource that the usage belongs to. - BillingPeriodID *string `json:"billingPeriodId,omitempty" azure:"ro"` + BillingPeriodID *string // READ-ONLY; Currency Code - CurrencyCode *string `json:"currencyCode,omitempty" azure:"ro"` + CurrencyCode *string // READ-ONLY; Included quality for an offer - IncludedQuantity *float64 `json:"includedQuantity,omitempty" azure:"ro"` + IncludedQuantity *float64 // READ-ONLY; The details about the meter. By default this is not populated, unless it's specified in $expand. - MeterDetails *MeterDetails `json:"meterDetails,omitempty" azure:"ro"` + MeterDetails *MeterDetails // READ-ONLY; The meter id (GUID) - MeterID *string `json:"meterId,omitempty" azure:"ro"` + MeterID *string // READ-ONLY; Offer Id - OfferID *string `json:"offerId,omitempty" azure:"ro"` + OfferID *string // READ-ONLY; Part Number - PartNumber *string `json:"partNumber,omitempty" azure:"ro"` + PartNumber *string + + // READ-ONLY; SavingsPlan Details + SavingsPlan *SavingsPlan // READ-ONLY; Unit of measure - UnitOfMeasure *string `json:"unitOfMeasure,omitempty" azure:"ro"` + UnitOfMeasure *string // READ-ONLY; Unit Price - UnitPrice *float64 `json:"unitPrice,omitempty" azure:"ro"` + UnitPrice *float64 } // PriceSheetResult - An pricesheet resource. type PriceSheetResult struct { // price sheet result. It contains the pricesheet associated with billing period - Properties *PriceSheetModel `json:"properties,omitempty"` + Properties *PriceSheetModel // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string +} + +// PricesheetDownloadProperties - The properties of the price sheet download. +type PricesheetDownloadProperties struct { + // READ-ONLY; The link (url) to download the pricesheet. + DownloadURL *string + + // READ-ONLY; Download link validity. + ValidTill *time.Time } // ProxyResource - The Resource model definition. type ProxyResource struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // Reseller - The reseller properties. type Reseller struct { // READ-ONLY; The reseller property description. - ResellerDescription *string `json:"resellerDescription,omitempty" azure:"ro"` + ResellerDescription *string // READ-ONLY; The reseller property ID. - ResellerID *string `json:"resellerId,omitempty" azure:"ro"` + ResellerID *string } // ReservationDetail - reservation detail resource. type ReservationDetail struct { // The properties of the reservation detail. - Properties *ReservationDetailProperties `json:"properties,omitempty"` + Properties *ReservationDetailProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ReservationDetailProperties - The properties of the reservation detail. type ReservationDetailProperties struct { // READ-ONLY; The instance Flexibility Group. - InstanceFlexibilityGroup *string `json:"instanceFlexibilityGroup,omitempty" azure:"ro"` + InstanceFlexibilityGroup *string // READ-ONLY; The instance Flexibility Ratio. - InstanceFlexibilityRatio *string `json:"instanceFlexibilityRatio,omitempty" azure:"ro"` + InstanceFlexibilityRatio *string // READ-ONLY; This identifier is the name of the resource or the fully qualified Resource ID. - InstanceID *string `json:"instanceId,omitempty" azure:"ro"` + InstanceID *string // READ-ONLY; The reservation kind. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; The reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping // for applying the benefit scope and also specifies the number of instances to which // the reservation benefit can be applied to. - ReservationID *string `json:"reservationId,omitempty" azure:"ro"` + ReservationID *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. - ReservationOrderID *string `json:"reservationOrderId,omitempty" azure:"ro"` + ReservationOrderID *string // READ-ONLY; This is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will // be 11 hours for that day and 24 hours from subsequent days. - ReservedHours *float64 `json:"reservedHours,omitempty" azure:"ro"` + ReservedHours *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. - SKUName *string `json:"skuName,omitempty" azure:"ro"` + SKUName *string // READ-ONLY; This is the total count of instances that are reserved for the reservationId. - TotalReservedQuantity *float64 `json:"totalReservedQuantity,omitempty" azure:"ro"` + TotalReservedQuantity *float64 // READ-ONLY; The date on which consumption occurred. - UsageDate *time.Time `json:"usageDate,omitempty" azure:"ro"` + UsageDate *time.Time // READ-ONLY; This is the total hours used by the instance. - UsedHours *float64 `json:"usedHours,omitempty" azure:"ro"` + UsedHours *float64 } // ReservationDetailsListResult - Result of listing reservation details. type ReservationDetailsListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of reservation details. - Value []*ReservationDetail `json:"value,omitempty" azure:"ro"` -} - -// ReservationRecommendationClassification provides polymorphic access to related types. -// Call the interface's GetReservationRecommendation() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LegacyReservationRecommendation, *ModernReservationRecommendation, *ReservationRecommendation -type ReservationRecommendationClassification interface { - // GetReservationRecommendation returns the ReservationRecommendation content of the underlying type. - GetReservationRecommendation() *ReservationRecommendation + Value []*ReservationDetail } // ReservationRecommendation - A reservation recommendation resource. type ReservationRecommendation struct { // REQUIRED; Specifies the kind of reservation recommendation. - Kind *ReservationRecommendationKind `json:"kind,omitempty"` + Kind *ReservationRecommendationKind // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource location - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource sku - SKU *string `json:"sku,omitempty" azure:"ro"` + SKU *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetReservationRecommendation implements the ReservationRecommendationClassification interface for type ReservationRecommendation. @@ -2316,514 +2357,400 @@ func (r *ReservationRecommendation) GetReservationRecommendation() *ReservationR return r } -// ReservationRecommendationDetailsCalculatedSavingsProperties - Details of estimated savings. +// ReservationRecommendationDetailsCalculatedSavingsProperties - Details of estimated savings. The costs and savings are estimated +// for the term. type ReservationRecommendationDetailsCalculatedSavingsProperties struct { // The number of reserved units used to calculate savings. Always 1 for virtual machines. - ReservedUnitCount *float32 `json:"reservedUnitCount,omitempty"` + ReservedUnitCount *float32 - // READ-ONLY; The cost without reservation. - OnDemandCost *float32 `json:"onDemandCost,omitempty" azure:"ro"` + // READ-ONLY; The cost without reservation. Includes hardware and software cost. + OnDemandCost *float32 - // READ-ONLY; The difference between total reservation cost and reservation cost. - OverageCost *float32 `json:"overageCost,omitempty" azure:"ro"` + // READ-ONLY; Hardware and software cost of the resources not covered by the reservation. + OverageCost *float32 // READ-ONLY; The quantity for calculated savings. - Quantity *float32 `json:"quantity,omitempty" azure:"ro"` + Quantity *float32 - // READ-ONLY; The exact cost of the estimated usage using reservation. - ReservationCost *float32 `json:"reservationCost,omitempty" azure:"ro"` + // READ-ONLY; Hardware cost of the resources covered by the reservation. + ReservationCost *float32 - // READ-ONLY; The amount saved by purchasing the recommended quantity of reservation. - Savings *float32 `json:"savings,omitempty" azure:"ro"` - - // READ-ONLY; The cost of the suggested quantity. - TotalReservationCost *float32 `json:"totalReservationCost,omitempty" azure:"ro"` -} + // READ-ONLY; The amount saved by purchasing the recommended quantity of reservation. This is equal to onDemandCost - totalReservationCost. + Savings *float32 -// ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get -// method. -type ReservationRecommendationDetailsClientGetOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Reservation cost + software cost of the resources covered by the reservation + overage cost. + TotalReservationCost *float32 } // ReservationRecommendationDetailsModel - Reservation recommendation details. type ReservationRecommendationDetailsModel struct { // Resource Location. - Location *string `json:"location,omitempty"` + Location *string // The properties of the reservation recommendation. - Properties *ReservationRecommendationDetailsProperties `json:"properties,omitempty"` + Properties *ReservationRecommendationDetailsProperties // Resource sku - SKU *string `json:"sku,omitempty"` + SKU *string // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ReservationRecommendationDetailsProperties - The properties of the reservation recommendation. type ReservationRecommendationDetailsProperties struct { // READ-ONLY; An ISO 4217 currency code identifier for the costs and savings - Currency *string `json:"currency,omitempty" azure:"ro"` + Currency *string // READ-ONLY; Resource specific properties. - Resource *ReservationRecommendationDetailsResourceProperties `json:"resource,omitempty" azure:"ro"` + Resource *ReservationRecommendationDetailsResourceProperties // READ-ONLY; Resource Group. - ResourceGroup *string `json:"resourceGroup,omitempty" azure:"ro"` + ResourceGroup *string // READ-ONLY; Savings information for the recommendation. - Savings *ReservationRecommendationDetailsSavingsProperties `json:"savings,omitempty" azure:"ro"` + Savings *ReservationRecommendationDetailsSavingsProperties // READ-ONLY; Scope of the reservation, ex: Single or Shared. - Scope *string `json:"scope,omitempty" azure:"ro"` + Scope *string // READ-ONLY; Historical usage details used to calculate the estimated savings. - Usage *ReservationRecommendationDetailsUsageProperties `json:"usage,omitempty" azure:"ro"` + Usage *ReservationRecommendationDetailsUsageProperties } // ReservationRecommendationDetailsResourceProperties - Details of the resource. type ReservationRecommendationDetailsResourceProperties struct { // READ-ONLY; List of subscriptions for which the reservation is applied. - AppliedScopes []*string `json:"appliedScopes,omitempty" azure:"ro"` + AppliedScopes []*string - // READ-ONLY; On demand rate of the resource. - OnDemandRate *float32 `json:"onDemandRate,omitempty" azure:"ro"` + // READ-ONLY; Hourly on-demand rate of the resource. Includes only hardware rate i.e, software rate is not included. + OnDemandRate *float32 // READ-ONLY; Azure product ex: StandardE8sv3 etc. - Product *string `json:"product,omitempty" azure:"ro"` + Product *string // READ-ONLY; Azure resource region ex:EastUS, WestUS etc. - Region *string `json:"region,omitempty" azure:"ro"` + Region *string - // READ-ONLY; Reservation rate of the resource. - ReservationRate *float32 `json:"reservationRate,omitempty" azure:"ro"` + // READ-ONLY; Hourly reservation rate of the resource. Varies based on the term. + ReservationRate *float32 // READ-ONLY; The azure resource type. - ResourceType *string `json:"resourceType,omitempty" azure:"ro"` + ResourceType *string } // ReservationRecommendationDetailsSavingsProperties - Details of the estimated savings. type ReservationRecommendationDetailsSavingsProperties struct { // List of calculated savings. - CalculatedSavings []*ReservationRecommendationDetailsCalculatedSavingsProperties `json:"calculatedSavings,omitempty"` + CalculatedSavings []*ReservationRecommendationDetailsCalculatedSavingsProperties // READ-ONLY; Number of days of usage to look back used for computing the recommendation. - LookBackPeriod *int32 `json:"lookBackPeriod,omitempty" azure:"ro"` + LookBackPeriod *int32 // READ-ONLY; Number of recommended units of the resource. - RecommendedQuantity *float32 `json:"recommendedQuantity,omitempty" azure:"ro"` + RecommendedQuantity *float32 // READ-ONLY; Term period of the reservation, ex: P1Y or P3Y. - ReservationOrderTerm *string `json:"reservationOrderTerm,omitempty" azure:"ro"` + ReservationOrderTerm *string // READ-ONLY; Type of savings, ex: instance. - SavingsType *string `json:"savingsType,omitempty" azure:"ro"` + SavingsType *string // READ-ONLY; Measurement unit ex: hour etc. - UnitOfMeasure *string `json:"unitOfMeasure,omitempty" azure:"ro"` + UnitOfMeasure *string } // ReservationRecommendationDetailsUsageProperties - Details about historical usage data that has been used for computing // the recommendation. type ReservationRecommendationDetailsUsageProperties struct { // READ-ONLY; The first usage date used for looking back for computing the recommendation. - FirstConsumptionDate *string `json:"firstConsumptionDate,omitempty" azure:"ro"` + FirstConsumptionDate *string // READ-ONLY; The last usage date used for looking back for computing the recommendation. - LastConsumptionDate *string `json:"lastConsumptionDate,omitempty" azure:"ro"` + LastConsumptionDate *string // READ-ONLY; What the usage data values represent ex: virtual machine instance. - LookBackUnitType *string `json:"lookBackUnitType,omitempty" azure:"ro"` + LookBackUnitType *string // READ-ONLY; The breakdown of historical resource usage. The values are in the order of usage between the firstConsumptionDate // and the lastConsumptionDate. - UsageData []*float32 `json:"usageData,omitempty" azure:"ro"` + UsageData []*float32 // READ-ONLY; The grain of the values represented in the usage data ex: hourly. - UsageGrain *string `json:"usageGrain,omitempty" azure:"ro"` -} - -// ReservationRecommendationsClientListOptions contains the optional parameters for the ReservationRecommendationsClient.NewListPager -// method. -type ReservationRecommendationsClientListOptions struct { - // May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default - // value 'Single'; properties/resourceType with allowed values - // ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', - // 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', - // 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed - // values ['Last7Days', 'Last30Days', 'Last60Days'] and default value - // 'Last7Days'. - Filter *string + UsageGrain *string } // ReservationRecommendationsListResult - Result of listing reservation recommendations. type ReservationRecommendationsListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The link (url) to the previous page of results. - PreviousLink *string `json:"previousLink,omitempty" azure:"ro"` + PreviousLink *string // READ-ONLY; The list of reservation recommendations. - Value []ReservationRecommendationClassification `json:"value,omitempty" azure:"ro"` + Value []ReservationRecommendationClassification } // ReservationSummariesListResult - Result of listing reservation summaries. type ReservationSummariesListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of reservation summaries. - Value []*ReservationSummary `json:"value,omitempty" azure:"ro"` + Value []*ReservationSummary } // ReservationSummary - reservation summary resource. type ReservationSummary struct { // The properties of the reservation summary. - Properties *ReservationSummaryProperties `json:"properties,omitempty"` + Properties *ReservationSummaryProperties // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ReservationSummaryProperties - The properties of the reservation summary. type ReservationSummaryProperties struct { // READ-ONLY; This is average utilization for the entire time range. (day or month depending on the grain) - AvgUtilizationPercentage *float64 `json:"avgUtilizationPercentage,omitempty" azure:"ro"` + AvgUtilizationPercentage *float64 // READ-ONLY; The reservation kind. - Kind *string `json:"kind,omitempty" azure:"ro"` + Kind *string // READ-ONLY; This is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to // 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% // for that day. - MaxUtilizationPercentage *float64 `json:"maxUtilizationPercentage,omitempty" azure:"ro"` + MaxUtilizationPercentage *float64 // READ-ONLY; This is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to // 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% // for that day - MinUtilizationPercentage *float64 `json:"minUtilizationPercentage,omitempty" azure:"ro"` + MinUtilizationPercentage *float64 // READ-ONLY; This is the purchased quantity for the reservationId. - PurchasedQuantity *float64 `json:"purchasedQuantity,omitempty" azure:"ro"` + PurchasedQuantity *float64 // READ-ONLY; This is the remaining quantity for the reservationId. - RemainingQuantity *float64 `json:"remainingQuantity,omitempty" azure:"ro"` + RemainingQuantity *float64 // READ-ONLY; The reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping // for applying the benefit scope and also specifies the number of instances to which // the reservation benefit can be applied to. - ReservationID *string `json:"reservationId,omitempty" azure:"ro"` + ReservationID *string // READ-ONLY; The reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents // a single purchase transaction. A reservation order contains reservations. The reservation // order specifies the VM size and region for the reservations. - ReservationOrderID *string `json:"reservationOrderId,omitempty" azure:"ro"` + ReservationOrderID *string // READ-ONLY; This is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours // for that day and 24 hours from subsequent days - ReservedHours *float64 `json:"reservedHours,omitempty" azure:"ro"` + ReservedHours *float64 // READ-ONLY; This is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. - SKUName *string `json:"skuName,omitempty" azure:"ro"` + SKUName *string // READ-ONLY; This is the total count of instances that are reserved for the reservationId. - TotalReservedQuantity *float64 `json:"totalReservedQuantity,omitempty" azure:"ro"` + TotalReservedQuantity *float64 // READ-ONLY; Data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. - UsageDate *time.Time `json:"usageDate,omitempty" azure:"ro"` + UsageDate *time.Time // READ-ONLY; Total used hours by the reservation - UsedHours *float64 `json:"usedHours,omitempty" azure:"ro"` + UsedHours *float64 // READ-ONLY; This is the used quantity for the reservationId. - UsedQuantity *float64 `json:"usedQuantity,omitempty" azure:"ro"` + UsedQuantity *float64 // READ-ONLY; This is the utilized percentage for the reservation Id. - UtilizedPercentage *float64 `json:"utilizedPercentage,omitempty" azure:"ro"` + UtilizedPercentage *float64 } // ReservationTransaction - Reservation transaction resource. type ReservationTransaction struct { // The properties of a legacy reservation transaction. - Properties *LegacyReservationTransactionProperties `json:"properties,omitempty"` + Properties *LegacyReservationTransactionProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags []*string `json:"tags,omitempty" azure:"ro"` + Tags []*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ReservationTransactionResource - The Resource model definition. type ReservationTransactionResource struct { // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags []*string `json:"tags,omitempty" azure:"ro"` + Tags []*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager -// method. -type ReservationTransactionsClientListByBillingProfileOptions struct { - // Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports - // 'le' and 'ge' - Filter *string -} - -// ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager -// method. -type ReservationTransactionsClientListOptions struct { - // Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports - // 'le' and 'ge' - Filter *string + Type *string } // ReservationTransactionsListResult - Result of listing reservation recommendations. type ReservationTransactionsListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of reservation recommendations. - Value []*ReservationTransaction `json:"value,omitempty" azure:"ro"` -} - -// ReservationsDetailsClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderAndReservationPager -// method. -type ReservationsDetailsClientListByReservationOrderAndReservationOptions struct { - // placeholder for future optional parameters -} - -// ReservationsDetailsClientListByReservationOrderOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderPager -// method. -type ReservationsDetailsClientListByReservationOrderOptions struct { - // placeholder for future optional parameters -} - -// ReservationsDetailsClientListOptions contains the optional parameters for the ReservationsDetailsClient.NewListPager method. -type ReservationsDetailsClientListOptions struct { - // End date. Only applicable when querying with billing profile - EndDate *string - // Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' - // and 'ge'. Not applicable when querying with billing profile - Filter *string - // Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation - ReservationID *string - // Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order - ReservationOrderID *string - // Start date. Only applicable when querying with billing profile - StartDate *string -} - -// ReservationsSummariesClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderAndReservationPager -// method. -type ReservationsSummariesClientListByReservationOrderAndReservationOptions struct { - // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' - Filter *string -} - -// ReservationsSummariesClientListByReservationOrderOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderPager -// method. -type ReservationsSummariesClientListByReservationOrderOptions struct { - // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' - Filter *string -} - -// ReservationsSummariesClientListOptions contains the optional parameters for the ReservationsSummariesClient.NewListPager -// method. -type ReservationsSummariesClientListOptions struct { - // End date. Only applicable when querying with billing profile - EndDate *string - // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. - // Not applicable when querying with billing profile - Filter *string - // Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation - ReservationID *string - // Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order - ReservationOrderID *string - // Start date. Only applicable when querying with billing profile - StartDate *string + Value []*ReservationTransaction } // Resource - The Resource model definition. type Resource struct { // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ResourceAttributes - The Resource model definition. type ResourceAttributes struct { // READ-ONLY; Resource location - Location *string `json:"location,omitempty" azure:"ro"` + Location *string // READ-ONLY; Resource sku - SKU *string `json:"sku,omitempty" azure:"ro"` + SKU *string } // SKUProperty - The Sku property type SKUProperty struct { // READ-ONLY; The name of sku property. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The value of sku property. - Value *string `json:"value,omitempty" azure:"ro"` + Value *string +} + +// SavingsPlan - The properties of the SavingsPlan. +type SavingsPlan struct { + // READ-ONLY; SavingsPlan Effective Price + EffectivePrice *float64 + + // READ-ONLY; SavingsPlan Market Price + MarketPrice *float64 + + // READ-ONLY; SavingsPlan term + Term *string } // Tag - The tag resource. type Tag struct { // Tag key. - Key *string `json:"key,omitempty"` + Key *string // Tag values. - Value []*string `json:"value,omitempty"` + Value []*string } // TagProperties - The properties of the tag. type TagProperties struct { // A list of Tag. - Tags []*Tag `json:"tags,omitempty"` + Tags []*Tag // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The link (url) to the previous page of results. - PreviousLink *string `json:"previousLink,omitempty" azure:"ro"` -} - -// TagsClientGetOptions contains the optional parameters for the TagsClient.Get method. -type TagsClientGetOptions struct { - // placeholder for future optional parameters + PreviousLink *string } // TagsResult - A resource listing all tags. type TagsResult struct { // eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating // the latest version or not. - ETag *string `json:"eTag,omitempty"` + ETag *string // The properties of the tag. - Properties *TagProperties `json:"properties,omitempty"` + Properties *TagProperties // READ-ONLY; Resource Id. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; Resource name. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// UsageDetailClassification provides polymorphic access to related types. -// Call the interface's GetUsageDetail() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LegacyUsageDetail, *ModernUsageDetail, *UsageDetail -type UsageDetailClassification interface { - // GetUsageDetail returns the UsageDetail content of the underlying type. - GetUsageDetail() *UsageDetail + Type *string } // UsageDetail - An usage detail resource. type UsageDetail struct { // REQUIRED; Specifies the kind of usage details. - Kind *UsageDetailsKind `json:"kind,omitempty"` + Kind *UsageDetailsKind // READ-ONLY; The etag for the resource. - Etag *string `json:"etag,omitempty" azure:"ro"` + Etag *string // READ-ONLY; The full qualified ARM ID of an event. - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The ID that uniquely identifies an event. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags,omitempty" azure:"ro"` + Tags map[string]*string // READ-ONLY; Resource type. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // GetUsageDetail implements the UsageDetailClassification interface for type UsageDetail. func (u *UsageDetail) GetUsageDetail() *UsageDetail { return u } -// UsageDetailsClientListOptions contains the optional parameters for the UsageDetailsClient.NewListPager method. -type UsageDetailsClientListOptions struct { - // May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, - // these fields are not included when listing usage details. - Expand *string - // May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, - // properties/reservationId, properties/publisherType or tags. The - // filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter - // is a key value pair string where key and value is separated by a colon (:). - // PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type - Filter *string - // Allows to select different type of cost/usage records. - Metric *Metrictype - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // May be used to limit the number of results to the most recent N usageDetails. - Top *int32 -} - // UsageDetailsListResult - Result of listing usage details. It contains a list of available usage details in reverse chronological // order by billing period. type UsageDetailsListResult struct { // READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of usage details. - Value []UsageDetailClassification `json:"value,omitempty" azure:"ro"` + Value []UsageDetailClassification } diff --git a/sdk/resourcemanager/consumption/armconsumption/models_serde.go b/sdk/resourcemanager/consumption/armconsumption/models_serde.go index 5e757d7ab1e0..155433aa160a 100644 --- a/sdk/resourcemanager/consumption/armconsumption/models_serde.go +++ b/sdk/resourcemanager/consumption/armconsumption/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -146,6 +145,7 @@ func (b BalanceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "endingBalance", b.EndingBalance) populate(objectMap, "newPurchases", b.NewPurchases) populate(objectMap, "newPurchasesDetails", b.NewPurchasesDetails) + populate(objectMap, "overageRefund", b.OverageRefund) populate(objectMap, "priceHidden", b.PriceHidden) populate(objectMap, "serviceOverage", b.ServiceOverage) populate(objectMap, "totalOverage", b.TotalOverage) @@ -193,6 +193,9 @@ func (b *BalanceProperties) UnmarshalJSON(data []byte) error { case "newPurchasesDetails": err = unpopulate(val, "NewPurchasesDetails", &b.NewPurchasesDetails) delete(rawMsg, key) + case "overageRefund": + err = unpopulate(val, "OverageRefund", &b.OverageRefund) + delete(rawMsg, key) case "priceHidden": err = unpopulate(val, "PriceHidden", &b.PriceHidden) delete(rawMsg, key) @@ -647,11 +650,10 @@ func (c *CreditBalanceSummary) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CreditSummary. func (c CreditSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", c.Etag) + populate(objectMap, "eTag", c.ETag) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -665,8 +667,8 @@ func (c *CreditSummary) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &c.Etag) + case "eTag": + err = unpopulate(val, "ETag", &c.ETag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &c.ID) @@ -677,9 +679,6 @@ func (c *CreditSummary) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -699,6 +698,7 @@ func (c CreditSummaryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "creditCurrency", c.CreditCurrency) populate(objectMap, "eTag", c.ETag) populate(objectMap, "expiredCredit", c.ExpiredCredit) + populate(objectMap, "isEstimatedBalance", c.IsEstimatedBalance) populate(objectMap, "pendingCreditAdjustments", c.PendingCreditAdjustments) populate(objectMap, "pendingEligibleCharges", c.PendingEligibleCharges) populate(objectMap, "reseller", c.Reseller) @@ -729,6 +729,9 @@ func (c *CreditSummaryProperties) UnmarshalJSON(data []byte) error { case "expiredCredit": err = unpopulate(val, "ExpiredCredit", &c.ExpiredCredit) delete(rawMsg, key) + case "isEstimatedBalance": + err = unpopulate(val, "IsEstimatedBalance", &c.IsEstimatedBalance) + delete(rawMsg, key) case "pendingCreditAdjustments": err = unpopulate(val, "PendingCreditAdjustments", &c.PendingCreditAdjustments) delete(rawMsg, key) @@ -871,6 +874,8 @@ func (e EventProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adjustments", e.Adjustments) populate(objectMap, "adjustmentsInBillingCurrency", e.AdjustmentsInBillingCurrency) + populate(objectMap, "billingAccountDisplayName", e.BillingAccountDisplayName) + populate(objectMap, "billingAccountId", e.BillingAccountID) populate(objectMap, "billingCurrency", e.BillingCurrency) populate(objectMap, "billingProfileDisplayName", e.BillingProfileDisplayName) populate(objectMap, "billingProfileId", e.BillingProfileID) @@ -886,6 +891,7 @@ func (e EventProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "eTag", e.ETag) populate(objectMap, "eventType", e.EventType) populate(objectMap, "invoiceNumber", e.InvoiceNumber) + populate(objectMap, "isEstimatedBalance", e.IsEstimatedBalance) populate(objectMap, "lotId", e.LotID) populate(objectMap, "lotSource", e.LotSource) populate(objectMap, "newCredit", e.NewCredit) @@ -910,6 +916,12 @@ func (e *EventProperties) UnmarshalJSON(data []byte) error { case "adjustmentsInBillingCurrency": err = unpopulate(val, "AdjustmentsInBillingCurrency", &e.AdjustmentsInBillingCurrency) delete(rawMsg, key) + case "billingAccountDisplayName": + err = unpopulate(val, "BillingAccountDisplayName", &e.BillingAccountDisplayName) + delete(rawMsg, key) + case "billingAccountId": + err = unpopulate(val, "BillingAccountID", &e.BillingAccountID) + delete(rawMsg, key) case "billingCurrency": err = unpopulate(val, "BillingCurrency", &e.BillingCurrency) delete(rawMsg, key) @@ -955,6 +967,9 @@ func (e *EventProperties) UnmarshalJSON(data []byte) error { case "invoiceNumber": err = unpopulate(val, "InvoiceNumber", &e.InvoiceNumber) delete(rawMsg, key) + case "isEstimatedBalance": + err = unpopulate(val, "IsEstimatedBalance", &e.IsEstimatedBalance) + delete(rawMsg, key) case "lotId": err = unpopulate(val, "LotID", &e.LotID) delete(rawMsg, key) @@ -1195,10 +1210,10 @@ func (l *LegacyChargeSummary) UnmarshalJSON(data []byte) error { func (l LegacyChargeSummaryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "azureCharges", l.AzureCharges) + populate(objectMap, "azureMarketplaceCharges", l.AzureMarketplaceCharges) populate(objectMap, "billingPeriodId", l.BillingPeriodID) populate(objectMap, "chargesBilledSeparately", l.ChargesBilledSeparately) populate(objectMap, "currency", l.Currency) - populate(objectMap, "marketplaceCharges", l.MarketplaceCharges) populate(objectMap, "usageEnd", l.UsageEnd) populate(objectMap, "usageStart", l.UsageStart) return json.Marshal(objectMap) @@ -1216,6 +1231,9 @@ func (l *LegacyChargeSummaryProperties) UnmarshalJSON(data []byte) error { case "azureCharges": err = unpopulate(val, "AzureCharges", &l.AzureCharges) delete(rawMsg, key) + case "azureMarketplaceCharges": + err = unpopulate(val, "AzureMarketplaceCharges", &l.AzureMarketplaceCharges) + delete(rawMsg, key) case "billingPeriodId": err = unpopulate(val, "BillingPeriodID", &l.BillingPeriodID) delete(rawMsg, key) @@ -1225,9 +1243,6 @@ func (l *LegacyChargeSummaryProperties) UnmarshalJSON(data []byte) error { case "currency": err = unpopulate(val, "Currency", &l.Currency) delete(rawMsg, key) - case "marketplaceCharges": - err = unpopulate(val, "MarketplaceCharges", &l.MarketplaceCharges) - delete(rawMsg, key) case "usageEnd": err = unpopulate(val, "UsageEnd", &l.UsageEnd) delete(rawMsg, key) @@ -1979,6 +1994,8 @@ func (l LotProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "creditCurrency", l.CreditCurrency) populate(objectMap, "eTag", l.ETag) populateTimeRFC3339(objectMap, "expirationDate", l.ExpirationDate) + populate(objectMap, "isEstimatedBalance", l.IsEstimatedBalance) + populate(objectMap, "OrganizationType", l.OrganizationType) populate(objectMap, "originalAmount", l.OriginalAmount) populate(objectMap, "originalAmountInBillingCurrency", l.OriginalAmountInBillingCurrency) populate(objectMap, "poNumber", l.PoNumber) @@ -1987,6 +2004,7 @@ func (l LotProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "source", l.Source) populateTimeRFC3339(objectMap, "startDate", l.StartDate) populate(objectMap, "status", l.Status) + populate(objectMap, "usedAmount", l.UsedAmount) return json.Marshal(objectMap) } @@ -2017,6 +2035,12 @@ func (l *LotProperties) UnmarshalJSON(data []byte) error { case "expirationDate": err = unpopulateTimeRFC3339(val, "ExpirationDate", &l.ExpirationDate) delete(rawMsg, key) + case "isEstimatedBalance": + err = unpopulate(val, "IsEstimatedBalance", &l.IsEstimatedBalance) + delete(rawMsg, key) + case "OrganizationType": + err = unpopulate(val, "OrganizationType", &l.OrganizationType) + delete(rawMsg, key) case "originalAmount": err = unpopulate(val, "OriginalAmount", &l.OriginalAmount) delete(rawMsg, key) @@ -2041,6 +2065,9 @@ func (l *LotProperties) UnmarshalJSON(data []byte) error { case "status": err = unpopulate(val, "Status", &l.Status) delete(rawMsg, key) + case "usedAmount": + err = unpopulate(val, "UsedAmount", &l.UsedAmount) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", l, err) @@ -2599,6 +2626,7 @@ func (m ModernChargeSummaryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "invoiceSectionId", m.InvoiceSectionID) populate(objectMap, "isInvoiced", m.IsInvoiced) populate(objectMap, "marketplaceCharges", m.MarketplaceCharges) + populate(objectMap, "subscriptionId", m.SubscriptionID) populate(objectMap, "usageEnd", m.UsageEnd) populate(objectMap, "usageStart", m.UsageStart) return json.Marshal(objectMap) @@ -2640,6 +2668,9 @@ func (m *ModernChargeSummaryProperties) UnmarshalJSON(data []byte) error { case "marketplaceCharges": err = unpopulate(val, "MarketplaceCharges", &m.MarketplaceCharges) delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &m.SubscriptionID) + delete(rawMsg, key) case "usageEnd": err = unpopulate(val, "UsageEnd", &m.UsageEnd) delete(rawMsg, key) @@ -2694,7 +2725,7 @@ func (m *ModernReservationRecommendation) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &m.Properties) + m.Properties, err = unmarshalModernReservationRecommendationPropertiesClassification(val) delete(rawMsg, key) case "sku": err = unpopulate(val, "SKU", &m.SKU) @@ -2727,9 +2758,10 @@ func (m ModernReservationRecommendationProperties) MarshalJSON() ([]byte, error) populate(objectMap, "normalizedSize", m.NormalizedSize) populate(objectMap, "recommendedQuantity", m.RecommendedQuantity) populate(objectMap, "recommendedQuantityNormalized", m.RecommendedQuantityNormalized) + populate(objectMap, "resourceType", m.ResourceType) populate(objectMap, "skuName", m.SKUName) populate(objectMap, "skuProperties", m.SKUProperties) - populate(objectMap, "scope", m.Scope) + objectMap["scope"] = m.Scope populate(objectMap, "term", m.Term) populate(objectMap, "totalCostWithReservedInstances", m.TotalCostWithReservedInstances) return json.Marshal(objectMap) @@ -2777,6 +2809,9 @@ func (m *ModernReservationRecommendationProperties) UnmarshalJSON(data []byte) e case "recommendedQuantityNormalized": err = unpopulate(val, "RecommendedQuantityNormalized", &m.RecommendedQuantityNormalized) delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &m.ResourceType) + delete(rawMsg, key) case "skuName": err = unpopulate(val, "SKUName", &m.SKUName) delete(rawMsg, key) @@ -2977,6 +3012,192 @@ func (m *ModernReservationTransactionsListResult) UnmarshalJSON(data []byte) err return nil } +// MarshalJSON implements the json.Marshaller interface for type ModernSharedScopeReservationRecommendationProperties. +func (m ModernSharedScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "costWithNoReservedInstances", m.CostWithNoReservedInstances) + populateTimeRFC3339(objectMap, "firstUsageDate", m.FirstUsageDate) + populate(objectMap, "instanceFlexibilityGroup", m.InstanceFlexibilityGroup) + populate(objectMap, "instanceFlexibilityRatio", m.InstanceFlexibilityRatio) + populate(objectMap, "location", m.Location) + populate(objectMap, "lookBackPeriod", m.LookBackPeriod) + populate(objectMap, "meterId", m.MeterID) + populate(objectMap, "netSavings", m.NetSavings) + populate(objectMap, "normalizedSize", m.NormalizedSize) + populate(objectMap, "recommendedQuantity", m.RecommendedQuantity) + populate(objectMap, "recommendedQuantityNormalized", m.RecommendedQuantityNormalized) + populate(objectMap, "resourceType", m.ResourceType) + populate(objectMap, "skuName", m.SKUName) + populate(objectMap, "skuProperties", m.SKUProperties) + objectMap["scope"] = "Shared" + populate(objectMap, "term", m.Term) + populate(objectMap, "totalCostWithReservedInstances", m.TotalCostWithReservedInstances) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ModernSharedScopeReservationRecommendationProperties. +func (m *ModernSharedScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "costWithNoReservedInstances": + err = unpopulate(val, "CostWithNoReservedInstances", &m.CostWithNoReservedInstances) + delete(rawMsg, key) + case "firstUsageDate": + err = unpopulateTimeRFC3339(val, "FirstUsageDate", &m.FirstUsageDate) + delete(rawMsg, key) + case "instanceFlexibilityGroup": + err = unpopulate(val, "InstanceFlexibilityGroup", &m.InstanceFlexibilityGroup) + delete(rawMsg, key) + case "instanceFlexibilityRatio": + err = unpopulate(val, "InstanceFlexibilityRatio", &m.InstanceFlexibilityRatio) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "lookBackPeriod": + err = unpopulate(val, "LookBackPeriod", &m.LookBackPeriod) + delete(rawMsg, key) + case "meterId": + err = unpopulate(val, "MeterID", &m.MeterID) + delete(rawMsg, key) + case "netSavings": + err = unpopulate(val, "NetSavings", &m.NetSavings) + delete(rawMsg, key) + case "normalizedSize": + err = unpopulate(val, "NormalizedSize", &m.NormalizedSize) + delete(rawMsg, key) + case "recommendedQuantity": + err = unpopulate(val, "RecommendedQuantity", &m.RecommendedQuantity) + delete(rawMsg, key) + case "recommendedQuantityNormalized": + err = unpopulate(val, "RecommendedQuantityNormalized", &m.RecommendedQuantityNormalized) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &m.ResourceType) + delete(rawMsg, key) + case "skuName": + err = unpopulate(val, "SKUName", &m.SKUName) + delete(rawMsg, key) + case "skuProperties": + err = unpopulate(val, "SKUProperties", &m.SKUProperties) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &m.Scope) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &m.Term) + delete(rawMsg, key) + case "totalCostWithReservedInstances": + err = unpopulate(val, "TotalCostWithReservedInstances", &m.TotalCostWithReservedInstances) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ModernSingleScopeReservationRecommendationProperties. +func (m ModernSingleScopeReservationRecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "costWithNoReservedInstances", m.CostWithNoReservedInstances) + populateTimeRFC3339(objectMap, "firstUsageDate", m.FirstUsageDate) + populate(objectMap, "instanceFlexibilityGroup", m.InstanceFlexibilityGroup) + populate(objectMap, "instanceFlexibilityRatio", m.InstanceFlexibilityRatio) + populate(objectMap, "location", m.Location) + populate(objectMap, "lookBackPeriod", m.LookBackPeriod) + populate(objectMap, "meterId", m.MeterID) + populate(objectMap, "netSavings", m.NetSavings) + populate(objectMap, "normalizedSize", m.NormalizedSize) + populate(objectMap, "recommendedQuantity", m.RecommendedQuantity) + populate(objectMap, "recommendedQuantityNormalized", m.RecommendedQuantityNormalized) + populate(objectMap, "resourceType", m.ResourceType) + populate(objectMap, "skuName", m.SKUName) + populate(objectMap, "skuProperties", m.SKUProperties) + objectMap["scope"] = "Single" + populate(objectMap, "subscriptionId", m.SubscriptionID) + populate(objectMap, "term", m.Term) + populate(objectMap, "totalCostWithReservedInstances", m.TotalCostWithReservedInstances) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ModernSingleScopeReservationRecommendationProperties. +func (m *ModernSingleScopeReservationRecommendationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "costWithNoReservedInstances": + err = unpopulate(val, "CostWithNoReservedInstances", &m.CostWithNoReservedInstances) + delete(rawMsg, key) + case "firstUsageDate": + err = unpopulateTimeRFC3339(val, "FirstUsageDate", &m.FirstUsageDate) + delete(rawMsg, key) + case "instanceFlexibilityGroup": + err = unpopulate(val, "InstanceFlexibilityGroup", &m.InstanceFlexibilityGroup) + delete(rawMsg, key) + case "instanceFlexibilityRatio": + err = unpopulate(val, "InstanceFlexibilityRatio", &m.InstanceFlexibilityRatio) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "lookBackPeriod": + err = unpopulate(val, "LookBackPeriod", &m.LookBackPeriod) + delete(rawMsg, key) + case "meterId": + err = unpopulate(val, "MeterID", &m.MeterID) + delete(rawMsg, key) + case "netSavings": + err = unpopulate(val, "NetSavings", &m.NetSavings) + delete(rawMsg, key) + case "normalizedSize": + err = unpopulate(val, "NormalizedSize", &m.NormalizedSize) + delete(rawMsg, key) + case "recommendedQuantity": + err = unpopulate(val, "RecommendedQuantity", &m.RecommendedQuantity) + delete(rawMsg, key) + case "recommendedQuantityNormalized": + err = unpopulate(val, "RecommendedQuantityNormalized", &m.RecommendedQuantityNormalized) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &m.ResourceType) + delete(rawMsg, key) + case "skuName": + err = unpopulate(val, "SKUName", &m.SKUName) + delete(rawMsg, key) + case "skuProperties": + err = unpopulate(val, "SKUProperties", &m.SKUProperties) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &m.Scope) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &m.SubscriptionID) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &m.Term) + delete(rawMsg, key) + case "totalCostWithReservedInstances": + err = unpopulate(val, "TotalCostWithReservedInstances", &m.TotalCostWithReservedInstances) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ModernUsageDetail. func (m ModernUsageDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3499,6 +3720,37 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PriceSheetModel. func (p PriceSheetModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3544,6 +3796,7 @@ func (p PriceSheetProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "meterId", p.MeterID) populate(objectMap, "offerId", p.OfferID) populate(objectMap, "partNumber", p.PartNumber) + populate(objectMap, "savingsPlan", p.SavingsPlan) populate(objectMap, "unitOfMeasure", p.UnitOfMeasure) populate(objectMap, "unitPrice", p.UnitPrice) return json.Marshal(objectMap) @@ -3579,6 +3832,9 @@ func (p *PriceSheetProperties) UnmarshalJSON(data []byte) error { case "partNumber": err = unpopulate(val, "PartNumber", &p.PartNumber) delete(rawMsg, key) + case "savingsPlan": + err = unpopulate(val, "SavingsPlan", &p.SavingsPlan) + delete(rawMsg, key) case "unitOfMeasure": err = unpopulate(val, "UnitOfMeasure", &p.UnitOfMeasure) delete(rawMsg, key) @@ -3640,6 +3896,37 @@ func (p *PriceSheetResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PricesheetDownloadProperties. +func (p PricesheetDownloadProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadUrl", p.DownloadURL) + populateTimeRFC3339(objectMap, "validTill", p.ValidTill) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PricesheetDownloadProperties. +func (p *PricesheetDownloadProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadUrl": + err = unpopulate(val, "DownloadURL", &p.DownloadURL) + delete(rawMsg, key) + case "validTill": + err = unpopulateTimeRFC3339(val, "ValidTill", &p.ValidTill) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4614,6 +4901,41 @@ func (s *SKUProperty) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SavingsPlan. +func (s SavingsPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "effectivePrice", s.EffectivePrice) + populate(objectMap, "marketPrice", s.MarketPrice) + populate(objectMap, "term", s.Term) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SavingsPlan. +func (s *SavingsPlan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "effectivePrice": + err = unpopulate(val, "EffectivePrice", &s.EffectivePrice) + delete(rawMsg, key) + case "marketPrice": + err = unpopulate(val, "MarketPrice", &s.MarketPrice) + delete(rawMsg, key) + case "term": + err = unpopulate(val, "Term", &s.Term) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Tag. func (t Tag) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/consumption/armconsumption/operations_client.go b/sdk/resourcemanager/consumption/armconsumption/operations_client.go index 45b3faab5195..624bd79c7637 100644 --- a/sdk/resourcemanager/consumption/armconsumption/operations_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/operations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available consumption REST API operations. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/operations_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/operations_client_example_test.go deleted file mode 100644 index de858d0604b9..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/operations_client_example_test.go +++ /dev/null @@ -1,55 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/OperationList.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 := armconsumption.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 = armconsumption.OperationListResult{ - // Value: []*armconsumption.Operation{ - // { - // Name: to.Ptr("Microsoft.Consumption/Operation"), - // Display: &armconsumption.OperationDisplay{ - // Description: to.Ptr("Create or Update Managed Applications"), - // Operation: to.Ptr("Create or Update Managed Applications"), - // Provider: to.Ptr("Microsoft Azure Distributed Managed Service"), - // Resource: to.Ptr("Managed Applications"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/options.go b/sdk/resourcemanager/consumption/armconsumption/options.go new file mode 100644 index 000000000000..928141086900 --- /dev/null +++ b/sdk/resourcemanager/consumption/armconsumption/options.go @@ -0,0 +1,320 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armconsumption + +// AggregatedCostClientGetByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetByManagementGroup +// method. +type AggregatedCostClientGetByManagementGroupOptions struct { + // May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc time). The filter supports + // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + // 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + Filter *string +} + +// AggregatedCostClientGetForBillingPeriodByManagementGroupOptions contains the optional parameters for the AggregatedCostClient.GetForBillingPeriodByManagementGroup +// method. +type AggregatedCostClientGetForBillingPeriodByManagementGroupOptions struct { + // placeholder for future optional parameters +} + +// BalancesClientGetByBillingAccountOptions contains the optional parameters for the BalancesClient.GetByBillingAccount method. +type BalancesClientGetByBillingAccountOptions struct { + // placeholder for future optional parameters +} + +// BalancesClientGetForBillingPeriodByBillingAccountOptions contains the optional parameters for the BalancesClient.GetForBillingPeriodByBillingAccount +// method. +type BalancesClientGetForBillingPeriodByBillingAccountOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientCreateOrUpdateOptions contains the optional parameters for the BudgetsClient.CreateOrUpdate method. +type BudgetsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientDeleteOptions contains the optional parameters for the BudgetsClient.Delete method. +type BudgetsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientGetOptions contains the optional parameters for the BudgetsClient.Get method. +type BudgetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BudgetsClientListOptions contains the optional parameters for the BudgetsClient.NewListPager method. +type BudgetsClientListOptions struct { + // placeholder for future optional parameters +} + +// ChargesClientListOptions contains the optional parameters for the ChargesClient.List method. +type ChargesClientListOptions struct { + // May be used to group charges for billingAccount scope by properties/billingProfileId, properties/invoiceSectionId, properties/customerId + // (specific for Partner Led), or for billingProfile scope by + // properties/invoiceSectionId. + Apply *string + + // End date + EndDate *string + + // May be used to filter charges by properties/usageEnd (Utc time), properties/usageStart (Utc time). The filter supports + // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', + // 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + Filter *string + + // Start date + StartDate *string +} + +// CreditsClientGetOptions contains the optional parameters for the CreditsClient.Get method. +type CreditsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EventsClientListByBillingAccountOptions contains the optional parameters for the EventsClient.NewListByBillingAccountPager +// method. +type EventsClientListByBillingAccountOptions struct { + // May be used to filter the events by lotId, lotSource etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + // It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value + // pair string where key and value is separated by a colon (:). + Filter *string +} + +// EventsClientListByBillingProfileOptions contains the optional parameters for the EventsClient.NewListByBillingProfilePager +// method. +type EventsClientListByBillingProfileOptions struct { + // placeholder for future optional parameters +} + +// LotsClientListByBillingAccountOptions contains the optional parameters for the LotsClient.NewListByBillingAccountPager +// method. +type LotsClientListByBillingAccountOptions struct { + // May be used to filter the lots by Status, Source etc. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + // not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + // string where key and value is separated by a colon (:). + Filter *string +} + +// LotsClientListByBillingProfileOptions contains the optional parameters for the LotsClient.NewListByBillingProfilePager +// method. +type LotsClientListByBillingProfileOptions struct { + // placeholder for future optional parameters +} + +// LotsClientListByCustomerOptions contains the optional parameters for the LotsClient.NewListByCustomerPager 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 +} + +// MarketplacesClientListOptions contains the optional parameters for the MarketplacesClient.NewListPager method. +type MarketplacesClientListOptions struct { + // May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, + // properties/instanceName or properties/instanceId. The filter supports + // 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + Filter *string + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + + // May be used to limit the number of results to the most recent N marketplaces. + Top *int32 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PriceSheetClientBeginDownloadByBillingAccountPeriodOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingAccountPeriod +// method. +type PriceSheetClientBeginDownloadByBillingAccountPeriodOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PriceSheetClientGetByBillingPeriodOptions contains the optional parameters for the PriceSheetClient.GetByBillingPeriod +// method. +type PriceSheetClientGetByBillingPeriodOptions struct { + // May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when + // returning price sheet. + Expand *string + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + + // May be used to limit the number of results to the top N results. + Top *int32 +} + +// PriceSheetClientGetOptions contains the optional parameters for the PriceSheetClient.Get method. +type PriceSheetClientGetOptions struct { + // May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when + // returning price sheet. + Expand *string + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + + // May be used to limit the number of results to the top N results. + Top *int32 +} + +// ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get +// method. +type ReservationRecommendationDetailsClientGetOptions struct { + // Used to filter reservation recommendation details by: properties/subscriptionId can be specified for billing account and + // billing profile paths. + Filter *string +} + +// ReservationRecommendationsClientListOptions contains the optional parameters for the ReservationRecommendationsClient.NewListPager +// method. +type ReservationRecommendationsClientListOptions struct { + // May be used to filter reservationRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default + // value 'Single'; properties/resourceType with allowed values + // ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', + // 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', + // 'AzureDataExplorer', 'VMwareCloudSimple'] and default value 'VirtualMachines'; and properties/lookBackPeriod with allowed + // values ['Last7Days', 'Last30Days', 'Last60Days'] and default value + // 'Last7Days'. + Filter *string +} + +// ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager +// method. +type ReservationTransactionsClientListByBillingProfileOptions struct { + // Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports + // 'le' and 'ge'. Note: API returns data for the entire start date's and end + // date's billing month. For example, filter properties/eventDate+ge+2020-01-01+AND+properties/eventDate+le+2020-12-29 will + // include data for entire December 2020 month (i.e. will contain records for + // dates December 30 and 31) + Filter *string +} + +// ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager +// method. +type ReservationTransactionsClientListOptions struct { + // Filter reservation transactions by date range. The properties/EventDate for start date and end date. The filter supports + // 'le' and 'ge'. Note: API returns data for the entire start date's and end + // date's billing month. For example, filter properties/eventDate+ge+2020-01-01+AND+properties/eventDate+le+2020-12-29 will + // include data for the entire December 2020 month (i.e. will contain records for + // dates December 30 and 31) + Filter *string + + // Preview markup percentage to be applied. + PreviewMarkupPercentage *float64 + + // Applies mark up to the transactions if the caller is a partner. + UseMarkupIfPartner *bool +} + +// ReservationsDetailsClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderAndReservationPager +// method. +type ReservationsDetailsClientListByReservationOrderAndReservationOptions struct { + // placeholder for future optional parameters +} + +// ReservationsDetailsClientListByReservationOrderOptions contains the optional parameters for the ReservationsDetailsClient.NewListByReservationOrderPager +// method. +type ReservationsDetailsClientListByReservationOrderOptions struct { + // placeholder for future optional parameters +} + +// ReservationsDetailsClientListOptions contains the optional parameters for the ReservationsDetailsClient.NewListPager method. +type ReservationsDetailsClientListOptions struct { + // End date. Only applicable when querying with billing profile + EndDate *string + + // Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' + // and 'ge'. Not applicable when querying with billing profile + Filter *string + + // Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation + ReservationID *string + + // Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order + ReservationOrderID *string + + // Start date. Only applicable when querying with billing profile + StartDate *string +} + +// ReservationsSummariesClientListByReservationOrderAndReservationOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderAndReservationPager +// method. +type ReservationsSummariesClientListByReservationOrderAndReservationOptions struct { + // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + Filter *string +} + +// ReservationsSummariesClientListByReservationOrderOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderPager +// method. +type ReservationsSummariesClientListByReservationOrderOptions struct { + // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + Filter *string +} + +// ReservationsSummariesClientListOptions contains the optional parameters for the ReservationsSummariesClient.NewListPager +// method. +type ReservationsSummariesClientListOptions struct { + // End date. Only applicable when querying with billing profile + EndDate *string + + // Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge'. + // Not applicable when querying with billing profile + Filter *string + + // Reservation Id GUID. Only valid if reservationOrderId is also provided. Filter to a specific reservation + ReservationID *string + + // Reservation Order Id GUID. Required if reservationId is provided. Filter to a specific reservation order + ReservationOrderID *string + + // Start date. Only applicable when querying with billing profile + StartDate *string +} + +// TagsClientGetOptions contains the optional parameters for the TagsClient.Get method. +type TagsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UsageDetailsClientListOptions contains the optional parameters for the UsageDetailsClient.NewListPager method. +type UsageDetailsClientListOptions struct { + // May be used to expand the properties/additionalInfo or properties/meterDetails within a list of usage details. By default, + // these fields are not included when listing usage details. + Expand *string + + // May be used to filter usageDetails by properties/resourceGroup, properties/resourceName, properties/resourceId, properties/chargeType, + // properties/reservationId, properties/publisherType or tags. The + // filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter + // is a key value pair string where key and value is separated by a colon (:). + // PublisherType Filter accepts two values azure and marketplace and it is currently supported for Web Direct Offer Type + Filter *string + + // Allows to select different type of cost/usage records. + Metric *Metrictype + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + + // May be used to limit the number of results to the most recent N usageDetails. + Top *int32 +} diff --git a/sdk/resourcemanager/consumption/armconsumption/polymorphic_helpers.go b/sdk/resourcemanager/consumption/armconsumption/polymorphic_helpers.go index 1b050e714fe5..b564158c7642 100644 --- a/sdk/resourcemanager/consumption/armconsumption/polymorphic_helpers.go +++ b/sdk/resourcemanager/consumption/armconsumption/polymorphic_helpers.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -28,7 +27,10 @@ func unmarshalChargeSummaryClassification(rawMsg json.RawMessage) (ChargeSummary default: b = &ChargeSummary{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalChargeSummaryClassificationArray(rawMsg json.RawMessage) ([]ChargeSummaryClassification, error) { @@ -67,7 +69,33 @@ func unmarshalLegacyReservationRecommendationPropertiesClassification(rawMsg jso default: b = &LegacyReservationRecommendationProperties{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalModernReservationRecommendationPropertiesClassification(rawMsg json.RawMessage) (ModernReservationRecommendationPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ModernReservationRecommendationPropertiesClassification + switch m["scope"] { + case "Shared": + b = &ModernSharedScopeReservationRecommendationProperties{} + case "Single": + b = &ModernSingleScopeReservationRecommendationProperties{} + default: + b = &ModernReservationRecommendationProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalReservationRecommendationClassification(rawMsg json.RawMessage) (ReservationRecommendationClassification, error) { @@ -87,7 +115,10 @@ func unmarshalReservationRecommendationClassification(rawMsg json.RawMessage) (R default: b = &ReservationRecommendation{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalReservationRecommendationClassificationArray(rawMsg json.RawMessage) ([]ReservationRecommendationClassification, error) { @@ -126,7 +157,10 @@ func unmarshalUsageDetailClassification(rawMsg json.RawMessage) (UsageDetailClas default: b = &UsageDetail{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalUsageDetailClassificationArray(rawMsg json.RawMessage) ([]UsageDetailClassification, error) { diff --git a/sdk/resourcemanager/consumption/armconsumption/pricesheet_client.go b/sdk/resourcemanager/consumption/armconsumption/pricesheet_client.go index 0085726a67fe..c0c62b5b1130 100644 --- a/sdk/resourcemanager/consumption/armconsumption/pricesheet_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/pricesheet_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -45,24 +44,95 @@ func NewPriceSheetClient(subscriptionID string, credential azcore.TokenCredentia return client, nil } +// BeginDownloadByBillingAccountPeriod - Generates the pricesheet for the provided billing period asynchronously based on +// the enrollment id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - billingAccountID - BillingAccount ID +// - billingPeriodName - Billing Period Name. +// - options - PriceSheetClientBeginDownloadByBillingAccountPeriodOptions contains the optional parameters for the PriceSheetClient.BeginDownloadByBillingAccountPeriod +// method. +func (client *PriceSheetClient) BeginDownloadByBillingAccountPeriod(ctx context.Context, billingAccountID string, billingPeriodName string, options *PriceSheetClientBeginDownloadByBillingAccountPeriodOptions) (*runtime.Poller[PriceSheetClientDownloadByBillingAccountPeriodResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.downloadByBillingAccountPeriod(ctx, billingAccountID, billingPeriodName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PriceSheetClientDownloadByBillingAccountPeriodResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PriceSheetClientDownloadByBillingAccountPeriodResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// DownloadByBillingAccountPeriod - Generates the pricesheet for the provided billing period asynchronously based on the enrollment +// id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *PriceSheetClient) downloadByBillingAccountPeriod(ctx context.Context, billingAccountID string, billingPeriodName string, options *PriceSheetClientBeginDownloadByBillingAccountPeriodOptions) (*http.Response, error) { + var err error + req, err := client.downloadByBillingAccountPeriodCreateRequest(ctx, billingAccountID, billingPeriodName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// downloadByBillingAccountPeriodCreateRequest creates the DownloadByBillingAccountPeriod request. +func (client *PriceSheetClient) downloadByBillingAccountPeriodCreateRequest(ctx context.Context, billingAccountID string, billingPeriodName string, options *PriceSheetClientBeginDownloadByBillingAccountPeriodOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/pricesheets/download" + if billingAccountID == "" { + return nil, errors.New("parameter billingAccountID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingAccountId}", url.PathEscape(billingAccountID)) + if billingPeriodName == "" { + return nil, errors.New("parameter billingPeriodName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingPeriodName}", url.PathEscape(billingPeriodName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // Get - Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - options - PriceSheetClientGetOptions contains the optional parameters for the PriceSheetClient.Get method. func (client *PriceSheetClient) Get(ctx context.Context, options *PriceSheetClientGetOptions) (PriceSheetClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, options) if err != nil { return PriceSheetClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PriceSheetClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PriceSheetClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PriceSheetClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -86,7 +156,7 @@ func (client *PriceSheetClient) getCreateRequest(ctx context.Context, options *P if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,23 +175,26 @@ func (client *PriceSheetClient) getHandleResponse(resp *http.Response) (PriceShe // this API only for May 1, 2014 or later. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingPeriodName - Billing Period Name. // - options - PriceSheetClientGetByBillingPeriodOptions contains the optional parameters for the PriceSheetClient.GetByBillingPeriod // method. func (client *PriceSheetClient) GetByBillingPeriod(ctx context.Context, billingPeriodName string, options *PriceSheetClientGetByBillingPeriodOptions) (PriceSheetClientGetByBillingPeriodResponse, error) { + var err error req, err := client.getByBillingPeriodCreateRequest(ctx, billingPeriodName, options) if err != nil { return PriceSheetClientGetByBillingPeriodResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PriceSheetClientGetByBillingPeriodResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PriceSheetClientGetByBillingPeriodResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PriceSheetClientGetByBillingPeriodResponse{}, err } - return client.getByBillingPeriodHandleResponse(resp) + resp, err := client.getByBillingPeriodHandleResponse(httpResp) + return resp, err } // getByBillingPeriodCreateRequest creates the GetByBillingPeriod request. @@ -149,7 +222,7 @@ func (client *PriceSheetClient) getByBillingPeriodCreateRequest(ctx context.Cont if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/pricesheet_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/pricesheet_client_example_test.go deleted file mode 100644 index caf6ef6fcd8c..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/pricesheet_client_example_test.go +++ /dev/null @@ -1,150 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPriceSheetClient().Get(ctx, &armconsumption.PriceSheetClientGetOptions{Expand: nil, - Skiptoken: nil, - Top: 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.PriceSheetResult = armconsumption.PriceSheetResult{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Consumption/pricesheets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/pricesheets/default"), - // Properties: &armconsumption.PriceSheetModel{ - // Pricesheets: []*armconsumption.PriceSheetProperties{ - // { - // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702"), - // CurrencyCode: to.Ptr("EUR"), - // IncludedQuantity: to.Ptr[float64](100), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("OfferId 1"), - // PartNumber: to.Ptr("XX-11110"), - // UnitOfMeasure: to.Ptr("100 Hours"), - // UnitPrice: to.Ptr[float64](0.00328), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheetExpand.json -func ExamplePriceSheetClient_GetByBillingPeriod_priceSheetExpand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPriceSheetClient().GetByBillingPeriod(ctx, "201801", &armconsumption.PriceSheetClientGetByBillingPeriodOptions{Expand: to.Ptr("meterDetails"), - Skiptoken: nil, - Top: 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.PriceSheetResult = armconsumption.PriceSheetResult{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Consumption/pricesheets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/pricesheets/default"), - // Properties: &armconsumption.PriceSheetModel{ - // Pricesheets: []*armconsumption.PriceSheetProperties{ - // { - // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702"), - // CurrencyCode: to.Ptr("EUR"), - // IncludedQuantity: to.Ptr[float64](100), - // MeterDetails: &armconsumption.MeterDetails{ - // MeterCategory: to.Ptr("Networking"), - // MeterLocation: to.Ptr("Zone 2"), - // MeterName: to.Ptr("Data Transfer Out (GB)"), - // PretaxStandardRate: to.Ptr[float64](0.138), - // TotalIncludedQuantity: to.Ptr[float64](0), - // Unit: to.Ptr("GB"), - // }, - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("OfferId 1"), - // PartNumber: to.Ptr("XX-11110"), - // UnitOfMeasure: to.Ptr("100 Hours"), - // UnitPrice: to.Ptr[float64](0.00328), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/PriceSheetForBillingPeriod.json -func ExamplePriceSheetClient_GetByBillingPeriod_priceSheetForBillingPeriod() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPriceSheetClient().GetByBillingPeriod(ctx, "201801", &armconsumption.PriceSheetClientGetByBillingPeriodOptions{Expand: nil, - Skiptoken: nil, - Top: 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.PriceSheetResult = armconsumption.PriceSheetResult{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Consumption/pricesheets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702/providers/Microsoft.Consumption/pricesheets/default"), - // Properties: &armconsumption.PriceSheetModel{ - // Pricesheets: []*armconsumption.PriceSheetProperties{ - // { - // BillingPeriodID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201702"), - // CurrencyCode: to.Ptr("EUR"), - // IncludedQuantity: to.Ptr[float64](100), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("OfferId 1"), - // PartNumber: to.Ptr("XX-11110"), - // UnitOfMeasure: to.Ptr("100 Hours"), - // UnitPrice: to.Ptr[float64](0.00328), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client.go b/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client.go index 1676ffb11def..3729ed5adb63 100644 --- a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -42,7 +41,7 @@ func NewReservationRecommendationDetailsClient(credential azcore.TokenCredential // Get - Details of a reservation recommendation for what-if analysis of reserved instances. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceScope - The scope associated with reservation recommendation details operations. This includes '/subscriptions/{subscriptionId}/' // for subscription scope, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' @@ -58,18 +57,21 @@ func NewReservationRecommendationDetailsClient(credential azcore.TokenCredential // - options - ReservationRecommendationDetailsClientGetOptions contains the optional parameters for the ReservationRecommendationDetailsClient.Get // method. func (client *ReservationRecommendationDetailsClient) Get(ctx context.Context, resourceScope string, scope Scope, region string, term Term, lookBackPeriod LookBackPeriod, product string, options *ReservationRecommendationDetailsClientGetOptions) (ReservationRecommendationDetailsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceScope, scope, region, term, lookBackPeriod, product, options) if err != nil { return ReservationRecommendationDetailsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ReservationRecommendationDetailsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ReservationRecommendationDetailsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ReservationRecommendationDetailsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -81,12 +83,15 @@ func (client *ReservationRecommendationDetailsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") reqQP.Set("scope", string(scope)) reqQP.Set("region", region) reqQP.Set("term", string(term)) reqQP.Set("lookBackPeriod", string(lookBackPeriod)) reqQP.Set("product", product) + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client_example_test.go deleted file mode 100644 index 6769b8eafcaf..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendationdetails_client_example_test.go +++ /dev/null @@ -1,345 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByBillingAccount.json -func ExampleReservationRecommendationDetailsClient_Get_reservationRecommendationsByBillingAccountLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/000000", armconsumption.ScopeShared, "eastus", armconsumption.TermP1Y, armconsumption.LookBackPeriodLast60Days, "Standard_DS14_v2", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ - // Name: to.Ptr("reservationRecommendationDetails"), - // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000/providers/microsoft.consumption/reservationrecommendationdetails"), - // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ - // Currency: to.Ptr("USD"), - // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ - // AppliedScopes: []*string{ - // to.Ptr("00000000-0000-0000-0000-00000000"), - // to.Ptr("00000000-0000-0000-0000-00000000")}, - // OnDemandRate: to.Ptr[float32](1.482), - // Product: to.Ptr("Standard_DS14_v2"), - // Region: to.Ptr("eastus"), - // ReservationRate: to.Ptr[float32](0.70570776255707), - // ResourceType: to.Ptr("virtualmachines"), - // }, - // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ - // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ - // { - // OnDemandCost: to.Ptr[float32](529550.326618951), - // OverageCost: to.Ptr[float32](63253.5935111345), - // Quantity: to.Ptr[float32](220), - // ReservationCost: to.Ptr[float32](223102.452054792), - // Savings: to.Ptr[float32](243194.281053024), - // TotalReservationCost: to.Ptr[float32](286356.045565927), - // }, - // { - // OnDemandCost: to.Ptr[float32](529550.32661895), - // OverageCost: to.Ptr[float32](149335.025050147), - // Quantity: to.Ptr[float32](179), - // ReservationCost: to.Ptr[float32](181524.267808217), - // Savings: to.Ptr[float32](198691.033760586), - // TotalReservationCost: to.Ptr[float32](330859.292858364), - // }, - // { - // OnDemandCost: to.Ptr[float32](529550.32661895), - // OverageCost: to.Ptr[float32](195942.319606957), - // Quantity: to.Ptr[float32](157), - // ReservationCost: to.Ptr[float32](159214.022602738), - // Savings: to.Ptr[float32](174393.984409255), - // TotalReservationCost: to.Ptr[float32](355156.342209695), - // }, - // { - // OnDemandCost: to.Ptr[float32](529550.32661895), - // OverageCost: to.Ptr[float32](30975.2311896299), - // Quantity: to.Ptr[float32](241), - // ReservationCost: to.Ptr[float32](244398.595205477), - // Savings: to.Ptr[float32](254176.500223843), - // TotalReservationCost: to.Ptr[float32](275373.826395107), - // }}, - // LookBackPeriod: to.Ptr[int32](60), - // RecommendedQuantity: to.Ptr[float32](253), - // ReservationOrderTerm: to.Ptr("P1Y"), - // SavingsType: to.Ptr("instance"), - // UnitOfMeasure: to.Ptr("hour"), - // }, - // Scope: to.Ptr("Shared"), - // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ - // FirstConsumptionDate: to.Ptr("2019-11-27T00:00:00"), - // LastConsumptionDate: to.Ptr("2020-01-25T21:00:00"), - // LookBackUnitType: to.Ptr("virtualMachine quantity"), - // UsageData: []*float32{ - // to.Ptr[float32](275.95003899999995), - // to.Ptr[float32](275.916705), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](275.916725), - // to.Ptr[float32](275.916705), - // to.Ptr[float32](275.98335299999997), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](275.98335299999997), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](276), - // to.Ptr[float32](275.933352)}, - // UsageGrain: to.Ptr("hourly"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByBillingProfile.json -func ExampleReservationRecommendationDetailsClient_Get_reservationRecommendationsByBillingProfileModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-00000000:00000000-0000-0000-0000-00000000/billingProfiles/00000000-0000-0000-0000-00000000", armconsumption.ScopeShared, "australiaeast", armconsumption.TermP1Y, armconsumption.LookBackPeriodLast07Days, "Standard_B2s", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ - // Name: to.Ptr("reservationRecommendationDetails"), - // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), - // ID: to.Ptr("providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-00000000:00000000-0000-0000-0000-00000000/billingProfiles/00000000-0000-0000-0000-00000000/providers/microsoft.consumption/reservationrecommendationdetails"), - // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ - // Currency: to.Ptr("AUD"), - // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ - // AppliedScopes: []*string{ - // to.Ptr("00000000-0000-0000-0000-00000000")}, - // OnDemandRate: to.Ptr[float32](0.0725), - // Product: to.Ptr("Standard_B2s"), - // Region: to.Ptr("australiaeast"), - // ReservationRate: to.Ptr[float32](0.04414166531788041), - // ResourceType: to.Ptr("virtualmachines"), - // }, - // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ - // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ - // { - // OnDemandCost: to.Ptr[float32](632.8844720496894), - // OverageCost: to.Ptr[float32](0), - // Quantity: to.Ptr[float32](1), - // ReservationCost: to.Ptr[float32](387.74038815226174), - // Savings: to.Ptr[float32](245.1440838974277), - // TotalReservationCost: to.Ptr[float32](387.74038815226174), - // }}, - // LookBackPeriod: to.Ptr[int32](7), - // RecommendedQuantity: to.Ptr[float32](1), - // ReservationOrderTerm: to.Ptr("P1Y"), - // SavingsType: to.Ptr("instance"), - // UnitOfMeasure: to.Ptr("hour"), - // }, - // Scope: to.Ptr("Shared"), - // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ - // FirstConsumptionDate: to.Ptr("2020-01-19T00:00:00"), - // LastConsumptionDate: to.Ptr("2020-01-25T17:00:00"), - // LookBackUnitType: to.Ptr("virtualMachine quantity"), - // UsageData: []*float32{ - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](0)}, - // UsageGrain: to.Ptr("hourly"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsByResourceGroup.json -func ExampleReservationRecommendationDetailsClient_Get_reservationRecommendationsByResourceGroupLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/testGroup", armconsumption.ScopeSingle, "westus", armconsumption.TermP3Y, armconsumption.LookBackPeriodLast30Days, "Standard_DS13_v2", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ - // Name: to.Ptr("reservationRecommendationDetails"), - // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/testGroup/providers/microsoft.consumption/reservationrecommendationdetails"), - // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ - // Currency: to.Ptr("USD"), - // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ - // AppliedScopes: []*string{ - // to.Ptr("00000000-0000-0000-0000-00000000"), - // to.Ptr("testGroup")}, - // OnDemandRate: to.Ptr[float32](0.519), - // Product: to.Ptr("Standard_DS13_v2"), - // Region: to.Ptr("westus"), - // ReservationRate: to.Ptr[float32](0.302549467275493), - // ResourceType: to.Ptr("virtualmachines"), - // }, - // ResourceGroup: to.Ptr("testGroup"), - // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ - // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ - // { - // OnDemandCost: to.Ptr[float32](368.4813602070006), - // OverageCost: to.Ptr[float32](0), - // Quantity: to.Ptr[float32](2), - // ReservationCost: to.Ptr[float32](429.01514459665), - // Savings: to.Ptr[float32](-60.5337843896494), - // TotalReservationCost: to.Ptr[float32](429.01514459665), - // }, - // { - // OnDemandCost: to.Ptr[float32](368.481360207), - // OverageCost: to.Ptr[float32](1.557), - // Quantity: to.Ptr[float32](1), - // ReservationCost: to.Ptr[float32](214.507572298325), - // Savings: to.Ptr[float32](152.416787908675), - // TotalReservationCost: to.Ptr[float32](216.064572298325), - // }}, - // LookBackPeriod: to.Ptr[int32](30), - // RecommendedQuantity: to.Ptr[float32](1), - // ReservationOrderTerm: to.Ptr("P3Y"), - // SavingsType: to.Ptr("instance"), - // UnitOfMeasure: to.Ptr("hour"), - // }, - // Scope: to.Ptr("Single"), - // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ - // FirstConsumptionDate: to.Ptr("2020-02-03T00:00:00"), - // LastConsumptionDate: to.Ptr("2020-03-03T13:00:00"), - // LookBackUnitType: to.Ptr("virtualMachine quantity"), - // UsageData: []*float32{ - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1)}, - // UsageGrain: to.Ptr("hourly"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationDetailsBySubscription.json -func ExampleReservationRecommendationDetailsClient_Get_reservationRecommendationsBySubscriptionLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReservationRecommendationDetailsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-00000000", armconsumption.ScopeSingle, "westus", armconsumption.TermP3Y, armconsumption.LookBackPeriodLast30Days, "Standard_DS13_v2", 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.ReservationRecommendationDetailsModel = armconsumption.ReservationRecommendationDetailsModel{ - // Name: to.Ptr("reservationRecommendationDetails"), - // Type: to.Ptr("Microsoft.Consumption/ReservationRecommendationDetails"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-00000000/providers/microsoft.consumption/reservationrecommendationdetails"), - // Properties: &armconsumption.ReservationRecommendationDetailsProperties{ - // Currency: to.Ptr("USD"), - // Resource: &armconsumption.ReservationRecommendationDetailsResourceProperties{ - // AppliedScopes: []*string{ - // to.Ptr("00000000-0000-0000-0000-00000000")}, - // OnDemandRate: to.Ptr[float32](0.519), - // Product: to.Ptr("Standard_DS13_v2"), - // Region: to.Ptr("westus"), - // ReservationRate: to.Ptr[float32](0.302549467275493), - // ResourceType: to.Ptr("virtualmachines"), - // }, - // Savings: &armconsumption.ReservationRecommendationDetailsSavingsProperties{ - // CalculatedSavings: []*armconsumption.ReservationRecommendationDetailsCalculatedSavingsProperties{ - // { - // OnDemandCost: to.Ptr[float32](368.4813602070006), - // OverageCost: to.Ptr[float32](0), - // Quantity: to.Ptr[float32](2), - // ReservationCost: to.Ptr[float32](429.01514459665), - // Savings: to.Ptr[float32](-60.5337843896494), - // TotalReservationCost: to.Ptr[float32](429.01514459665), - // }, - // { - // OnDemandCost: to.Ptr[float32](368.481360207), - // OverageCost: to.Ptr[float32](1.557), - // Quantity: to.Ptr[float32](1), - // ReservationCost: to.Ptr[float32](214.507572298325), - // Savings: to.Ptr[float32](152.416787908675), - // TotalReservationCost: to.Ptr[float32](216.064572298325), - // }}, - // LookBackPeriod: to.Ptr[int32](30), - // RecommendedQuantity: to.Ptr[float32](1), - // ReservationOrderTerm: to.Ptr("P3Y"), - // SavingsType: to.Ptr("instance"), - // UnitOfMeasure: to.Ptr("hour"), - // }, - // Scope: to.Ptr("Single"), - // Usage: &armconsumption.ReservationRecommendationDetailsUsageProperties{ - // FirstConsumptionDate: to.Ptr("2020-02-03T00:00:00"), - // LastConsumptionDate: to.Ptr("2020-03-03T13:00:00"), - // LookBackUnitType: to.Ptr("virtualMachine quantity"), - // UsageData: []*float32{ - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1), - // to.Ptr[float32](1)}, - // UsageGrain: to.Ptr("hourly"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client.go b/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client.go index adb4414fcebd..629345992754 100644 --- a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -41,7 +40,7 @@ func NewReservationRecommendationsClient(credential azcore.TokenCredential, opti // NewListPager - List of recommendations for purchasing reserved instances. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceScope - The scope associated with reservation recommendations operations. This includes '/subscriptions/{subscriptionId}/' // for subscription scope, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' @@ -90,7 +89,7 @@ func (client *ReservationRecommendationsClient) listCreateRequest(ctx context.Co if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client_example_test.go deleted file mode 100644 index c1213873488d..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/reservationrecommendations_client_example_test.go +++ /dev/null @@ -1,443 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByBillingAccount.json -func ExampleReservationRecommendationsClient_NewListPager_reservationRecommendationsByBillingAccountLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationRecommendationsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456", &armconsumption.ReservationRecommendationsClientListOptions{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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ - // Value: []armconsumption.ReservationRecommendationClassification{ - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), - // Location: to.Ptr("westus"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySharedScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](12.0785105), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T00:00:00-07:00"); return t}()), - // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), - // InstanceFlexibilityRatio: to.Ptr[float32](1), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](0.588546019225182), - // NormalizedSize: to.Ptr("Standard_DS1_v2"), - // RecommendedQuantity: to.Ptr[float64](1), - // RecommendedQuantityNormalized: to.Ptr[float32](1), - // Scope: to.Ptr("Shared"), - // SKUProperties: []*armconsumption.SKUProperty{ - // { - // Name: to.Ptr("Cores"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("Ram"), - // Value: to.Ptr("1"), - // }}, - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](11.4899644807748), - // }, - // }, - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("billingAccount/123456/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), - // Location: to.Ptr("westus"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySharedScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](10.0785105), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T00:00:00-07:00"); return t}()), - // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), - // InstanceFlexibilityRatio: to.Ptr[float32](1), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](0.68), - // NormalizedSize: to.Ptr("Standard_DS1"), - // RecommendedQuantity: to.Ptr[float64](1), - // RecommendedQuantityNormalized: to.Ptr[float32](1.2), - // Scope: to.Ptr("Shared"), - // SKUProperties: []*armconsumption.SKUProperty{ - // { - // Name: to.Ptr("SkuDisplayName"), - // Value: to.Ptr("B"), - // }, - // { - // Name: to.Ptr("CPU"), - // Value: to.Ptr("1"), - // }}, - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](13.48), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByBillingProfile.json -func ExampleReservationRecommendationsClient_NewListPager_reservationRecommendationsByBillingProfileModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationRecommendationsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420", &armconsumption.ReservationRecommendationsClientListOptions{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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ - // Value: []armconsumption.ReservationRecommendationClassification{ - // &armconsumption.ModernReservationRecommendation{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), - // Location: to.Ptr("westus"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindModern), - // Properties: &armconsumption.ModernReservationRecommendationProperties{ - // CostWithNoReservedInstances: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](1.4749000882), - // }, - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T00:00:00-07:00"); return t}()), - // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), - // InstanceFlexibilityRatio: to.Ptr[float32](1), - // LookBackPeriod: to.Ptr[int32](7), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0.39824251795372), - // }, - // NormalizedSize: to.Ptr("Standard_DS1_v2"), - // RecommendedQuantity: to.Ptr[float64](1), - // RecommendedQuantityNormalized: to.Ptr[float32](1), - // Scope: to.Ptr("Shared"), - // SKUProperties: []*armconsumption.SKUProperty{ - // { - // Name: to.Ptr("Cores"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("Ram"), - // Value: to.Ptr("1"), - // }}, - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](1.07665757024628), - // }, - // }, - // }, - // &armconsumption.ModernReservationRecommendation{ - // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/123456/billingProfiles/6420/providers/Microsoft.Consumption/reservationRecommendations/00000000-0000-0000-0000-000000000000"), - // Location: to.Ptr("westus"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindModern), - // Properties: &armconsumption.ModernReservationRecommendationProperties{ - // CostWithNoReservedInstances: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](1.4896), - // }, - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-07T00:00:00-07:00"); return t}()), - // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), - // InstanceFlexibilityRatio: to.Ptr[float32](1), - // LookBackPeriod: to.Ptr[int32](7), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](0.40694246575372), - // }, - // NormalizedSize: to.Ptr("Standard_DS1"), - // RecommendedQuantity: to.Ptr[float64](1), - // RecommendedQuantityNormalized: to.Ptr[float32](1.2), - // Scope: to.Ptr("Shared"), - // SKUProperties: []*armconsumption.SKUProperty{ - // { - // Name: to.Ptr("SkuDisplayName"), - // Value: to.Ptr("B"), - // }, - // { - // Name: to.Ptr("CPU"), - // Value: to.Ptr("1"), - // }}, - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: &armconsumption.Amount{ - // Currency: to.Ptr("USD"), - // Value: to.Ptr[float64](1.08265753424628), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsByResourceGroup.json -func ExampleReservationRecommendationsClient_NewListPager_reservationRecommendationsByResourceGroupLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationRecommendationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup", &armconsumption.ReservationRecommendationsClientListOptions{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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ - // Value: []armconsumption.ReservationRecommendationClassification{ - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("reservationRecommendations1"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGrouups/testGroup/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1"), - // Location: to.Ptr("northeurope"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](0), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](4.634521202630137), - // RecommendedQuantity: to.Ptr[float64](1), - // Scope: to.Ptr("Single"), - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("reservationRecommendations2"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2"), - // Location: to.Ptr("northeurope"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](0), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](7.289315723178081), - // RecommendedQuantity: to.Ptr[float64](1), - // Scope: to.Ptr("Single"), - // Term: to.Ptr("P3Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsBySubscription.json -func ExampleReservationRecommendationsClient_NewListPager_reservationRecommendationsBySubscriptionLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationRecommendationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.ReservationRecommendationsClientListOptions{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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ - // Value: []armconsumption.ReservationRecommendationClassification{ - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("reservationRecommendations1"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1"), - // Location: to.Ptr("northeurope"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](0), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](4.634521202630137), - // RecommendedQuantity: to.Ptr[float64](1), - // Scope: to.Ptr("Single"), - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("reservationRecommendations2"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2"), - // Location: to.Ptr("northeurope"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](0), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](7.289315723178081), - // RecommendedQuantity: to.Ptr[float64](1), - // Scope: to.Ptr("Single"), - // Term: to.Ptr("P3Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationRecommendationsFilterBySubscriptionForScopeLookBackPeriod.json -func ExampleReservationRecommendationsClient_NewListPager_reservationRecommendationsFilterBySubscriptionForScopeLookBackPeriodLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationRecommendationsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.ReservationRecommendationsClientListOptions{Filter: to.Ptr("properties/scope eq 'Single' AND properties/lookBackPeriod eq 'Last7Days'")}) - 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.ReservationRecommendationsListResult = armconsumption.ReservationRecommendationsListResult{ - // Value: []armconsumption.ReservationRecommendationClassification{ - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("reservationRecommendations1"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations1"), - // Location: to.Ptr("northeurope"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](0), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](4.634521202630137), - // RecommendedQuantity: to.Ptr[float64](1), - // Scope: to.Ptr("Single"), - // SKUProperties: []*armconsumption.SKUProperty{ - // { - // Name: to.Ptr("Cores"), - // Value: to.Ptr("1"), - // }, - // { - // Name: to.Ptr("Ram"), - // Value: to.Ptr("1"), - // }}, - // Term: to.Ptr("P1Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }, - // &armconsumption.LegacyReservationRecommendation{ - // Name: to.Ptr("reservationRecommendations2"), - // Type: to.Ptr("Microsoft.Consumption/reservationRecommendations"), - // ID: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationRecommendations/reservationRecommendations2"), - // Location: to.Ptr("northeurope"), - // SKU: to.Ptr("Standard_DS1_v2"), - // Kind: to.Ptr(armconsumption.ReservationRecommendationKindLegacy), - // Properties: &armconsumption.LegacySingleScopeReservationRecommendationProperties{ - // CostWithNoReservedInstances: to.Ptr[float64](0), - // FirstUsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-06T00:00:00Z"); return t}()), - // LookBackPeriod: to.Ptr("Last7Days"), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // NetSavings: to.Ptr[float64](7.289315723178081), - // RecommendedQuantity: to.Ptr[float64](1), - // Scope: to.Ptr("Single"), - // SKUProperties: []*armconsumption.SKUProperty{ - // { - // Name: to.Ptr("SkuDisplayName"), - // Value: to.Ptr("B"), - // }, - // { - // Name: to.Ptr("CPU"), - // Value: to.Ptr("1"), - // }}, - // Term: to.Ptr("P3Y"), - // TotalCostWithReservedInstances: to.Ptr[float64](0), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client.go b/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client.go index fc2ce90998d8..c079326a362c 100644 --- a/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -41,9 +40,13 @@ func NewReservationsDetailsClient(credential azcore.TokenCredential, options *ar return client, nil } -// NewListPager - Lists the reservations details for the defined scope and provided date range. +// NewListPager - Lists the reservations details for provided date range. Note: ARM has a payload size limit of 12MB, so currently +// callers get 400 when the response size exceeds the ARM limit. If the data size is too +// large, customers may also get 504 as the API timed out preparing the data. In such cases, API call should be made with +// smaller date ranges or a call to Generate Reservation Details Report API should +// be made as it is asynchronous and will not run into response size time outs. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceScope - The scope associated with reservations details operations. This includes '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' // for BillingAccount scope (legacy), and // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile @@ -102,7 +105,7 @@ func (client *ReservationsDetailsClient) listCreateRequest(ctx context.Context, if options != nil && options.ReservationOrderID != nil { reqQP.Set("reservationOrderId", *options.ReservationOrderID) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,9 +120,13 @@ func (client *ReservationsDetailsClient) listHandleResponse(resp *http.Response) return result, nil } -// NewListByReservationOrderPager - Lists the reservations details for provided date range. +// NewListByReservationOrderPager - Lists the reservations details for provided date range. Note: ARM has a payload size limit +// of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. If the data size is too +// large, customers may also get 504 as the API timed out preparing the data. In such cases, API call should be made with +// smaller date ranges or a call to Generate Reservation Details Report API should +// be made as it is asynchronous and will not run into response size time outs. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - reservationOrderID - Order Id of the reservation // - filter - Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports // 'le' and 'ge' @@ -166,7 +173,7 @@ func (client *ReservationsDetailsClient) listByReservationOrderCreateRequest(ctx } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,9 +188,14 @@ func (client *ReservationsDetailsClient) listByReservationOrderHandleResponse(re return result, nil } -// NewListByReservationOrderAndReservationPager - Lists the reservations details for provided date range. +// NewListByReservationOrderAndReservationPager - Lists the reservations details for provided date range. Note: ARM has a +// payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. If the data size +// is too +// large, customers may also get 504 as the API timed out preparing the data. In such cases, API call should be made with +// smaller date ranges or a call to Generate Reservation Details Report API should +// be made as it is asynchronous and will not run into response size time outs. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - reservationOrderID - Order Id of the reservation // - reservationID - Id of the reservation // - filter - Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports @@ -235,7 +247,7 @@ func (client *ReservationsDetailsClient) listByReservationOrderAndReservationCre } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client_example_test.go deleted file mode 100644 index 2e6fb4854fa8..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/reservationsdetails_client_example_test.go +++ /dev/null @@ -1,268 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetails.json -func ExampleReservationsDetailsClient_NewListByReservationOrderPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsDetailsClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", "properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05", 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ - // Value: []*armconsumption.ReservationDetail{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171129"), - // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), - // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationDetails/20171129"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.ReservationDetailProperties{ - // InstanceFlexibilityGroup: to.Ptr("DSv2 Series"), - // InstanceFlexibilityRatio: to.Ptr("0.25"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/wvn-sql/providers/microsoft.compute/virtualmachines/abc-sql2014sp33"), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](24), - // SKUName: to.Ptr("Standard_D2_v2"), - // TotalReservedQuantity: to.Ptr[float64](1), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-29T00:00:00Z"); return t}()), - // UsedHours: to.Ptr[float64](24), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsWithReservationId.json -func ExampleReservationsDetailsClient_NewListByReservationOrderAndReservationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsDetailsClient().NewListByReservationOrderAndReservationPager("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", "properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05", 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ - // Value: []*armconsumption.ReservationDetail{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171129"), - // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), - // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationDetails/20171129"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.ReservationDetailProperties{ - // InstanceFlexibilityGroup: to.Ptr("D2v2 Series"), - // InstanceFlexibilityRatio: to.Ptr("1"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/wvn-sql/providers/microsoft.compute/virtualmachines/wvn-sql2014sp33"), - // Kind: to.Ptr("Reservation"), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](24), - // SKUName: to.Ptr("Standard_D2_v2"), - // TotalReservedQuantity: to.Ptr[float64](1), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-29T00:00:00Z"); return t}()), - // UsedHours: to.Ptr[float64](24), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingAccountId.json -func ExampleReservationsDetailsClient_NewListPager_reservationDetailsByBillingAccountId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", &armconsumption.ReservationsDetailsClientListOptions{StartDate: nil, - EndDate: nil, - Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-12-05"), - ReservationID: nil, - ReservationOrderID: 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ - // Value: []*armconsumption.ReservationDetail{ - // { - // Name: to.Ptr("reservationDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.Consumption/reservationDetails/reservationDetails_Id1"), - // Properties: &armconsumption.ReservationDetailProperties{ - // InstanceFlexibilityGroup: to.Ptr("DSv3 Series"), - // InstanceFlexibilityRatio: to.Ptr("1"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sqlh1/providers/microsoft.compute/virtualmachines/sqlh1"), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](48), - // SKUName: to.Ptr("Standard_D2s_v3"), - // TotalReservedQuantity: to.Ptr[float64](0), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-30T00:00:00-08:00"); return t}()), - // UsedHours: to.Ptr[float64](0.6), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingProfileId.json -func ExampleReservationsDetailsClient_NewListPager_reservationDetailsByBillingProfileId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", &armconsumption.ReservationsDetailsClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-10-31"), - Filter: nil, - ReservationID: nil, - ReservationOrderID: 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ - // Value: []*armconsumption.ReservationDetail{ - // { - // Name: to.Ptr("reservationDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationDetails/reservationDetails_Id1"), - // Properties: &armconsumption.ReservationDetailProperties{ - // InstanceFlexibilityGroup: to.Ptr("DSv3 Series"), - // InstanceFlexibilityRatio: to.Ptr("1"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sqlh1/providers/microsoft.compute/virtualmachines/sqlh1"), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](48), - // SKUName: to.Ptr("Standard_D2s_v3"), - // TotalReservedQuantity: to.Ptr[float64](0), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T00:00:00-08:00"); return t}()), - // UsedHours: to.Ptr[float64](0.6), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationDetailsByBillingProfileIdReservationId.json -func ExampleReservationsDetailsClient_NewListPager_reservationDetailsByBillingProfileIdReservationId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsDetailsClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", &armconsumption.ReservationsDetailsClientListOptions{StartDate: to.Ptr("2019-09-01"), - EndDate: to.Ptr("2019-10-31"), - Filter: nil, - ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), - ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), - }) - 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.ReservationDetailsListResult = armconsumption.ReservationDetailsListResult{ - // Value: []*armconsumption.ReservationDetail{ - // { - // Name: to.Ptr("reservationDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationDetails/reservationDetails_Id1"), - // Properties: &armconsumption.ReservationDetailProperties{ - // InstanceFlexibilityGroup: to.Ptr("DSv3 Series"), - // InstanceFlexibilityRatio: to.Ptr("1"), - // InstanceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sqlh1/providers/microsoft.compute/virtualmachines/sqlh1"), - // ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), - // ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), - // ReservedHours: to.Ptr[float64](48), - // SKUName: to.Ptr("Standard_D2s_v3"), - // TotalReservedQuantity: to.Ptr[float64](0), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-30T00:00:00-08:00"); return t}()), - // UsedHours: to.Ptr[float64](0.6), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client.go b/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client.go index 83eb33130080..dbe6d2ef30b5 100644 --- a/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -41,9 +40,11 @@ func NewReservationsSummariesClient(credential azcore.TokenCredential, options * return client, nil } -// NewListPager - Lists the reservations summaries for the defined scope daily or monthly grain. +// NewListPager - Lists the reservations summaries for the defined scope daily or monthly grain. Note: ARM has a payload size +// limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In +// such cases, API call should be made with smaller date ranges. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceScope - The scope associated with reservations summaries operations. This includes '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' // for BillingAccount scope (legacy), and // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile @@ -104,7 +105,7 @@ func (client *ReservationsSummariesClient) listCreateRequest(ctx context.Context if options != nil && options.ReservationOrderID != nil { reqQP.Set("reservationOrderId", *options.ReservationOrderID) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,9 +120,11 @@ func (client *ReservationsSummariesClient) listHandleResponse(resp *http.Respons return result, nil } -// NewListByReservationOrderPager - Lists the reservations summaries for daily or monthly grain. +// NewListByReservationOrderPager - Lists the reservations summaries for daily or monthly grain. Note: ARM has a payload size +// limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API +// call should be made with smaller date ranges. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - reservationOrderID - Order Id of the reservation // - grain - Can be daily or monthly // - options - ReservationsSummariesClientListByReservationOrderOptions contains the optional parameters for the ReservationsSummariesClient.NewListByReservationOrderPager @@ -170,7 +173,7 @@ func (client *ReservationsSummariesClient) listByReservationOrderCreateRequest(c if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,9 +188,12 @@ func (client *ReservationsSummariesClient) listByReservationOrderHandleResponse( return result, nil } -// NewListByReservationOrderAndReservationPager - Lists the reservations summaries for daily or monthly grain. +// NewListByReservationOrderAndReservationPager - Lists the reservations summaries for daily or monthly grain. Note: ARM has +// a payload size limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, +// API +// call should be made with smaller date ranges. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - reservationOrderID - Order Id of the reservation // - reservationID - Id of the reservation // - grain - Can be daily or monthly @@ -241,7 +247,7 @@ func (client *ReservationsSummariesClient) listByReservationOrderAndReservationC if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client_example_test.go deleted file mode 100644 index f8aa5d1eefa4..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/reservationssummaries_client_example_test.go +++ /dev/null @@ -1,480 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDaily.json -func ExampleReservationsSummariesClient_NewListByReservationOrderPager_reservationSummariesDaily() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderOptions{Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-11-20")}) - 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // Kind: to.Ptr("Reservation"), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // PurchasedQuantity: to.Ptr[float64](0), - // RemainingQuantity: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](0), - // SKUName: to.Ptr("Standard_D8s_v3"), - // TotalReservedQuantity: to.Ptr[float64](155), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // UsedHours: to.Ptr[float64](0), - // UsedQuantity: to.Ptr[float64](0), - // UtilizedPercentage: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthly.json -func ExampleReservationsSummariesClient_NewListByReservationOrderPager_reservationSummariesMonthly() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderPager("00000000-0000-0000-0000-000000000000", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderOptions{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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // Kind: to.Ptr("Reservation"), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // PurchasedQuantity: to.Ptr[float64](0), - // RemainingQuantity: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](0), - // SKUName: to.Ptr("Standard_D8s_v3"), - // TotalReservedQuantity: to.Ptr[float64](155), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // UsedHours: to.Ptr[float64](0), - // UsedQuantity: to.Ptr[float64](0), - // UtilizedPercentage: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithReservationId.json -func ExampleReservationsSummariesClient_NewListByReservationOrderAndReservationPager_reservationSummariesDailyWithReservationId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderAndReservationPager("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationOptions{Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-11-20")}) - 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // Kind: to.Ptr("Reservation"), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // PurchasedQuantity: to.Ptr[float64](0), - // RemainingQuantity: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](0), - // SKUName: to.Ptr("Standard_D8s_v3"), - // TotalReservedQuantity: to.Ptr[float64](155), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // UsedHours: to.Ptr[float64](0), - // UsedQuantity: to.Ptr[float64](0), - // UtilizedPercentage: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithReservationId.json -func ExampleReservationsSummariesClient_NewListByReservationOrderAndReservationPager_reservationSummariesMonthlyWithReservationId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListByReservationOrderAndReservationPager("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListByReservationOrderAndReservationOptions{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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("00000000-0000-0000-0000-000000000000_00000000-0000-0000-0000-000000000000_20171001"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("providers/Microsoft.Capacity/reservationOrders/00000000-0000-0000-0000-000000000000/reservations/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/reservationSummaries/20171001"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // Kind: to.Ptr("Reservation"), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // PurchasedQuantity: to.Ptr[float64](0), - // RemainingQuantity: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](0), - // SKUName: to.Ptr("Standard_D8s_v3"), - // TotalReservedQuantity: to.Ptr[float64](155), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-01T00:00:00Z"); return t}()), - // UsedHours: to.Ptr[float64](0), - // UsedQuantity: to.Ptr[float64](0), - // UtilizedPercentage: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithBillingAccountId.json -func ExampleReservationsSummariesClient_NewListPager_reservationSummariesDailyWithBillingAccountId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: to.Ptr("properties/usageDate ge 2017-10-01 AND properties/usageDate le 2017-11-20"), - ReservationID: nil, - ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("reservationSummaries_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](720), - // SKUName: to.Ptr("Standard_B1s"), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T00:00:00-07:00"); return t}()), - // UsedHours: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesDailyWithBillingProfileId.json -func ExampleReservationsSummariesClient_NewListPager_reservationSummariesDailyWithBillingProfileId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", armconsumption.DatagrainDailyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: to.Ptr("2017-10-01"), - EndDate: to.Ptr("2017-11-20"), - Filter: nil, - ReservationID: nil, - ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("reservationSummaries_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](720), - // SKUName: to.Ptr("Standard_B1s"), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T00:00:00-07:00"); return t}()), - // UsedHours: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithBillingAccountId.json -func ExampleReservationsSummariesClient_NewListPager_reservationSummariesMonthlyWithBillingAccountId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - ReservationID: nil, - ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("reservationSummaries_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](720), - // SKUName: to.Ptr("Standard_B1s"), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T00:00:00-07:00"); return t}()), - // UsedHours: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithBillingProfileId.json -func ExampleReservationsSummariesClient_NewListPager_reservationSummariesMonthlyWithBillingProfileId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - ReservationID: nil, - ReservationOrderID: 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("reservationSummaries_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // ReservationID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservedHours: to.Ptr[float64](720), - // SKUName: to.Ptr("Standard_B1s"), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T00:00:00-07:00"); return t}()), - // UsedHours: to.Ptr[float64](0), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationSummariesMonthlyWithBillingProfileIdReservationId.json -func ExampleReservationsSummariesClient_NewListPager_reservationSummariesMonthlyWithBillingProfileIdReservationId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationsSummariesClient().NewListPager("providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579", armconsumption.DatagrainMonthlyGrain, &armconsumption.ReservationsSummariesClientListOptions{StartDate: nil, - EndDate: nil, - Filter: nil, - ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), - ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), - }) - 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.ReservationSummariesListResult = armconsumption.ReservationSummariesListResult{ - // Value: []*armconsumption.ReservationSummary{ - // { - // Name: to.Ptr("reservationSummaries_Id1"), - // Type: to.Ptr("Microsoft.Consumption/reservationSummaries"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/12345:2468/billingProfiles/13579/providers/Microsoft.Consumption/reservationSummaries/reservationSummaries_Id1"), - // Properties: &armconsumption.ReservationSummaryProperties{ - // AvgUtilizationPercentage: to.Ptr[float64](0), - // MaxUtilizationPercentage: to.Ptr[float64](0), - // MinUtilizationPercentage: to.Ptr[float64](0), - // ReservationID: to.Ptr("1c6b6358-709f-484c-85f1-72e862a0cf3b"), - // ReservationOrderID: to.Ptr("9f39ba10-794f-4dcb-8f4b-8d0cb47c27dc"), - // ReservedHours: to.Ptr[float64](720), - // SKUName: to.Ptr("Standard_B1s"), - // UsageDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-01T00:00:00-07:00"); return t}()), - // UsedHours: to.Ptr[float64](0), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client.go b/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client.go index 1f325338d9f8..147f667aa53b 100644 --- a/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -18,6 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -41,9 +41,14 @@ func NewReservationTransactionsClient(credential azcore.TokenCredential, options return client, nil } -// NewListPager - List of transactions for reserved instances on billing account scope +// NewListPager - List of transactions for reserved instances on billing account scope. Note: The refund transactions are +// posted along with its purchase transaction (i.e. in the purchase billing month). For example, +// The refund is requested in May 2021. This refund transaction will have event date as May 2021 but the billing month as +// April 2020 when the reservation purchase was made. Note: ARM has a payload size +// limit of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should +// be made with smaller date ranges. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - options - ReservationTransactionsClientListOptions contains the optional parameters for the ReservationTransactionsClient.NewListPager // method. @@ -90,7 +95,13 @@ func (client *ReservationTransactionsClient) listCreateRequest(ctx context.Conte if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") + if options != nil && options.UseMarkupIfPartner != nil { + reqQP.Set("useMarkupIfPartner", strconv.FormatBool(*options.UseMarkupIfPartner)) + } + if options != nil && options.PreviewMarkupPercentage != nil { + reqQP.Set("previewMarkupPercentage", strconv.FormatFloat(*options.PreviewMarkupPercentage, 'f', -1, 128)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,9 +116,14 @@ func (client *ReservationTransactionsClient) listHandleResponse(resp *http.Respo return result, nil } -// NewListByBillingProfilePager - List of transactions for reserved instances on billing account scope +// NewListByBillingProfilePager - List of transactions for reserved instances on billing profile scope. The refund transactions +// are posted along with its purchase transaction (i.e. in the purchase billing month). For example, The +// refund is requested in May 2021. This refund transaction will have event date as May 2021 but the billing month as April +// 2020 when the reservation purchase was made. Note: ARM has a payload size limit +// of 12MB, so currently callers get 400 when the response size exceeds the ARM limit. In such cases, API call should be made +// with smaller date ranges. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - billingAccountID - BillingAccount ID // - billingProfileID - Azure Billing Profile ID. // - options - ReservationTransactionsClientListByBillingProfileOptions contains the optional parameters for the ReservationTransactionsClient.NewListByBillingProfilePager @@ -159,7 +175,7 @@ func (client *ReservationTransactionsClient) listByBillingProfileCreateRequest(c if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client_example_test.go deleted file mode 100644 index 14d8fdf36a34..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/reservationtransactions_client_example_test.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationTransactionsListByEnrollmentNumber.json -func ExampleReservationTransactionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationTransactionsClient().NewListPager("123456", &armconsumption.ReservationTransactionsClientListOptions{Filter: to.Ptr("properties/eventDate+ge+2020-05-20+AND+properties/eventDate+le+2020-05-30")}) - 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.ReservationTransactionsListResult = armconsumption.ReservationTransactionsListResult{ - // Value: []*armconsumption.ReservationTransaction{ - // { - // Name: to.Ptr("201909091919"), - // Type: to.Ptr("Microsoft.Consumption/reservationTransactions"), - // ID: to.Ptr("/billingAccounts/123456/providers/Microsoft.Consumption/reservationtransactions/201909091919"), - // Tags: []*string{ - // }, - // Properties: &armconsumption.LegacyReservationTransactionProperties{ - // Description: to.Ptr("Standard_DS1_v2 westus 1 Year"), - // AccountName: to.Ptr("Microsoft Infrastructure"), - // AccountOwnerEmail: to.Ptr("admin@microsoft.com"), - // Amount: to.Ptr[float64](-21), - // ArmSKUName: to.Ptr("Standard_DS1_v2"), - // BillingFrequency: to.Ptr("recurring"), - // BillingMonth: to.Ptr[int32](20190901), - // CostCenter: to.Ptr(""), - // Currency: to.Ptr("USD"), - // CurrentEnrollment: to.Ptr("123456"), - // DepartmentName: to.Ptr("Unassigned"), - // EventDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-09T19:19:04Z"); return t}()), - // EventType: to.Ptr("Refund"), - // MonetaryCommitment: to.Ptr[float64](523123.9), - // Overage: to.Ptr[float64](23234.49), - // PurchasingEnrollment: to.Ptr("123456"), - // PurchasingSubscriptionGUID: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), - // PurchasingSubscriptionName: to.Ptr("Infrastructure Subscription"), - // Quantity: to.Ptr[float64](1), - // Region: to.Ptr("westus"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderName: to.Ptr("Transaction-DS1_v2"), - // Term: to.Ptr("P1Y"), - // }, - // }, - // { - // Name: to.Ptr("201909091919"), - // Type: to.Ptr("Microsoft.Consumption/reservationTransactions"), - // ID: to.Ptr("/billingAccounts/123456/providers/Microsoft.Consumption/reservationtransactions/201909091919"), - // Tags: []*string{ - // }, - // Properties: &armconsumption.LegacyReservationTransactionProperties{ - // Description: to.Ptr("Standard_DS1_v2 westus 1 Year"), - // AccountName: to.Ptr("Microsoft Infrastructure"), - // AccountOwnerEmail: to.Ptr("admin@microsoft.com"), - // Amount: to.Ptr[float64](21), - // ArmSKUName: to.Ptr("Standard_DS1_v2"), - // BillingFrequency: to.Ptr("recurring"), - // BillingMonth: to.Ptr[int32](20190901), - // CostCenter: to.Ptr(""), - // Currency: to.Ptr("USD"), - // CurrentEnrollment: to.Ptr("123456"), - // DepartmentName: to.Ptr("Unassigned"), - // EventDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-09T19:19:04Z"); return t}()), - // EventType: to.Ptr("Purchase"), - // MonetaryCommitment: to.Ptr[float64](523123.9), - // Overage: to.Ptr[float64](23234.49), - // PurchasingEnrollment: to.Ptr("123456"), - // PurchasingSubscriptionGUID: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), - // PurchasingSubscriptionName: to.Ptr("Infrastructure Subscription"), - // Quantity: to.Ptr[float64](1), - // Region: to.Ptr("westus"), - // ReservationOrderID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ReservationOrderName: to.Ptr("Transaction-DS1_v2"), - // Term: to.Ptr("P1Y"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/ReservationTransactionsListByBillingProfileId.json -func ExampleReservationTransactionsClient_NewListByBillingProfilePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReservationTransactionsClient().NewListByBillingProfilePager("fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30", "Z76D-SGAF-BG7-TGB", &armconsumption.ReservationTransactionsClientListByBillingProfileOptions{Filter: to.Ptr("properties/eventDate+ge+2020-05-20+AND+properties/eventDate+le+2020-05-30")}) - 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.ModernReservationTransactionsListResult = armconsumption.ModernReservationTransactionsListResult{ - // Value: []*armconsumption.ModernReservationTransaction{ - // { - // Name: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), - // Type: to.Ptr("Microsoft.Consumption/reservationTransactions"), - // ID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/billingProfiles/Z76D-SGAF-BG7-TGB/providers/Microsoft.Consumption/reservationTransactions"), - // Properties: &armconsumption.ModernReservationTransactionProperties{ - // Description: to.Ptr("Reserved VM Instance, Standard_B1ls, US East, 3 Years"), - // Amount: to.Ptr[float64](1.44), - // ArmSKUName: to.Ptr("Standard_B1ls"), - // BillingFrequency: to.Ptr("Recurring"), - // BillingProfileID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/billingProfiles/Z76D-SGAF-BG7-TGB"), - // BillingProfileName: to.Ptr("IT Department*"), - // Currency: to.Ptr("USD"), - // EventDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-25T21:21:38Z"); return t}()), - // EventType: to.Ptr("Purchase"), - // Invoice: to.Ptr("T000456437"), - // InvoiceID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/billingProfiles/Z76D-SGAF-BG7-TGB/invoices/T000456437"), - // InvoiceSectionID: to.Ptr("/providers/Microsoft.Billing/billingAccounts/fcebaabc-fced-4284-a83d-79f83dee183c:45796ba8-988f-45ad-bea9-7b71fc6c7513_2018-09-30/invoiceSections/QBTB-EYAK-PJA-TGB"), - // InvoiceSectionName: to.Ptr("IT Department"), - // PurchasingSubscriptionGUID: to.Ptr("d924ad15-4a3d-4047-971d-c8b1b300a97b"), - // PurchasingSubscriptionName: to.Ptr("contoso"), - // Quantity: to.Ptr[float64](1), - // Region: to.Ptr("eastus"), - // ReservationOrderID: to.Ptr("a838a8c3-a408-49e1-ac90-42cb95bff9b2"), - // ReservationOrderName: to.Ptr("VM_RI_03-25-2020_14-18"), - // Term: to.Ptr("P3Y"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/response_types.go b/sdk/resourcemanager/consumption/armconsumption/response_types.go index f1de72573a61..1a4d4421c76b 100644 --- a/sdk/resourcemanager/consumption/armconsumption/response_types.go +++ b/sdk/resourcemanager/consumption/armconsumption/response_types.go @@ -3,34 +3,38 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption // AggregatedCostClientGetByManagementGroupResponse contains the response from method AggregatedCostClient.GetByManagementGroup. type AggregatedCostClientGetByManagementGroupResponse struct { + // A management group aggregated cost resource. ManagementGroupAggregatedCostResult } // AggregatedCostClientGetForBillingPeriodByManagementGroupResponse contains the response from method AggregatedCostClient.GetForBillingPeriodByManagementGroup. type AggregatedCostClientGetForBillingPeriodByManagementGroupResponse struct { + // A management group aggregated cost resource. ManagementGroupAggregatedCostResult } // BalancesClientGetByBillingAccountResponse contains the response from method BalancesClient.GetByBillingAccount. type BalancesClientGetByBillingAccountResponse struct { + // A balance resource. Balance } // BalancesClientGetForBillingPeriodByBillingAccountResponse contains the response from method BalancesClient.GetForBillingPeriodByBillingAccount. type BalancesClientGetForBillingPeriodByBillingAccountResponse struct { + // A balance resource. Balance } // BudgetsClientCreateOrUpdateResponse contains the response from method BudgetsClient.CreateOrUpdate. type BudgetsClientCreateOrUpdateResponse struct { + // A budget resource. Budget } @@ -41,125 +45,158 @@ type BudgetsClientDeleteResponse struct { // BudgetsClientGetResponse contains the response from method BudgetsClient.Get. type BudgetsClientGetResponse struct { + // A budget resource. Budget } // BudgetsClientListResponse contains the response from method BudgetsClient.NewListPager. type BudgetsClientListResponse struct { + // Result of listing budgets. It contains a list of available budgets in the scope provided. BudgetsListResult } // ChargesClientListResponse contains the response from method ChargesClient.List. type ChargesClientListResponse struct { + // Result of listing charge summary. ChargesListResult } // CreditsClientGetResponse contains the response from method CreditsClient.Get. type CreditsClientGetResponse struct { + // A credit summary resource. CreditSummary } // EventsClientListByBillingAccountResponse contains the response from method EventsClient.NewListByBillingAccountPager. type EventsClientListByBillingAccountResponse struct { + // Result of listing event summary. Events } // EventsClientListByBillingProfileResponse contains the response from method EventsClient.NewListByBillingProfilePager. type EventsClientListByBillingProfileResponse struct { + // Result of listing event summary. Events } // LotsClientListByBillingAccountResponse contains the response from method LotsClient.NewListByBillingAccountPager. type LotsClientListByBillingAccountResponse struct { + // Result of listing lot summary. Lots } // LotsClientListByBillingProfileResponse contains the response from method LotsClient.NewListByBillingProfilePager. type LotsClientListByBillingProfileResponse struct { + // Result of listing lot summary. Lots } // LotsClientListByCustomerResponse contains the response from method LotsClient.NewListByCustomerPager. type LotsClientListByCustomerResponse struct { + // Result of listing lot summary. Lots } // MarketplacesClientListResponse contains the response from method MarketplacesClient.NewListPager. type MarketplacesClientListResponse struct { + // Result of listing marketplaces. It contains a list of available marketplaces in reverse chronological order by billing + // period. MarketplacesListResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of listing consumption operations. It contains a list of operations and a URL link to get the next set of results. OperationListResult } +// PriceSheetClientDownloadByBillingAccountPeriodResponse contains the response from method PriceSheetClient.BeginDownloadByBillingAccountPeriod. +type PriceSheetClientDownloadByBillingAccountPeriodResponse struct { + // The status of the long running operation. + OperationStatus +} + // PriceSheetClientGetByBillingPeriodResponse contains the response from method PriceSheetClient.GetByBillingPeriod. type PriceSheetClientGetByBillingPeriodResponse struct { + // An pricesheet resource. PriceSheetResult } // PriceSheetClientGetResponse contains the response from method PriceSheetClient.Get. type PriceSheetClientGetResponse struct { + // An pricesheet resource. PriceSheetResult } // ReservationRecommendationDetailsClientGetResponse contains the response from method ReservationRecommendationDetailsClient.Get. type ReservationRecommendationDetailsClientGetResponse struct { + // Reservation recommendation details. ReservationRecommendationDetailsModel } // ReservationRecommendationsClientListResponse contains the response from method ReservationRecommendationsClient.NewListPager. type ReservationRecommendationsClientListResponse struct { + // Result of listing reservation recommendations. ReservationRecommendationsListResult } // ReservationTransactionsClientListByBillingProfileResponse contains the response from method ReservationTransactionsClient.NewListByBillingProfilePager. type ReservationTransactionsClientListByBillingProfileResponse struct { + // Result of listing reservation recommendations. ModernReservationTransactionsListResult } // ReservationTransactionsClientListResponse contains the response from method ReservationTransactionsClient.NewListPager. type ReservationTransactionsClientListResponse struct { + // Result of listing reservation recommendations. ReservationTransactionsListResult } // ReservationsDetailsClientListByReservationOrderAndReservationResponse contains the response from method ReservationsDetailsClient.NewListByReservationOrderAndReservationPager. type ReservationsDetailsClientListByReservationOrderAndReservationResponse struct { + // Result of listing reservation details. ReservationDetailsListResult } // ReservationsDetailsClientListByReservationOrderResponse contains the response from method ReservationsDetailsClient.NewListByReservationOrderPager. type ReservationsDetailsClientListByReservationOrderResponse struct { + // Result of listing reservation details. ReservationDetailsListResult } // ReservationsDetailsClientListResponse contains the response from method ReservationsDetailsClient.NewListPager. type ReservationsDetailsClientListResponse struct { + // Result of listing reservation details. ReservationDetailsListResult } // ReservationsSummariesClientListByReservationOrderAndReservationResponse contains the response from method ReservationsSummariesClient.NewListByReservationOrderAndReservationPager. type ReservationsSummariesClientListByReservationOrderAndReservationResponse struct { + // Result of listing reservation summaries. ReservationSummariesListResult } // ReservationsSummariesClientListByReservationOrderResponse contains the response from method ReservationsSummariesClient.NewListByReservationOrderPager. type ReservationsSummariesClientListByReservationOrderResponse struct { + // Result of listing reservation summaries. ReservationSummariesListResult } // ReservationsSummariesClientListResponse contains the response from method ReservationsSummariesClient.NewListPager. type ReservationsSummariesClientListResponse struct { + // Result of listing reservation summaries. ReservationSummariesListResult } // TagsClientGetResponse contains the response from method TagsClient.Get. type TagsClientGetResponse struct { + // A resource listing all tags. TagsResult } // UsageDetailsClientListResponse contains the response from method UsageDetailsClient.NewListPager. type UsageDetailsClientListResponse struct { + // Result of listing usage details. It contains a list of available usage details in reverse chronological order by billing + // period. UsageDetailsListResult } diff --git a/sdk/resourcemanager/consumption/armconsumption/tags_client.go b/sdk/resourcemanager/consumption/armconsumption/tags_client.go index 332e5bebf53d..ce5e69f95277 100644 --- a/sdk/resourcemanager/consumption/armconsumption/tags_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/tags_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -42,7 +41,7 @@ func NewTagsClient(credential azcore.TokenCredential, options *arm.ClientOptions // Get - Get all available tag keys for the defined scope // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with tags operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for // resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, @@ -52,18 +51,21 @@ func NewTagsClient(credential azcore.TokenCredential, options *arm.ClientOptions // '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope.. // - options - TagsClientGetOptions contains the optional parameters for the TagsClient.Get method. func (client *TagsClient) Get(ctx context.Context, scope string, options *TagsClientGetOptions) (TagsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, scope, options) if err != nil { return TagsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TagsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return TagsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TagsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -75,7 +77,7 @@ func (client *TagsClient) getCreateRequest(ctx context.Context, scope string, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/consumption/armconsumption/tags_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/tags_client_example_test.go deleted file mode 100644 index 3324f16a88e6..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/tags_client_example_test.go +++ /dev/null @@ -1,75 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTagsClient().Get(ctx, "providers/Microsoft.CostManagement/billingAccounts/1234", 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.TagsResult = armconsumption.TagsResult{ - // Name: to.Ptr("tags1"), - // Type: to.Ptr("Microsoft.Consumption/tags"), - // ETag: to.Ptr("\"1d34d012214157f\""), - // ID: to.Ptr("providers/Microsoft.CostManagement/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/tags/tags1"), - // Properties: &armconsumption.TagProperties{ - // PreviousLink: to.Ptr("https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingaccount-id}/providers/Microsoft.Consumption/tags/?$expand=properties/tags/value&api-version=2021-10-01&startDate=2020-12-01&endDate=2020-12-31&$top=1000&$skiptoken=AQAAAA%3D%3D"), - // Tags: []*armconsumption.Tag{ - // { - // Key: to.Ptr("Department"), - // }, - // { - // Key: to.Ptr("CostCenter"), - // }, - // { - // Key: to.Ptr("Portal"), - // }, - // { - // Key: to.Ptr("OrgName"), - // }, - // { - // Key: to.Ptr("Namespace"), - // }, - // { - // Key: to.Ptr("resourceType"), - // }, - // { - // Key: to.Ptr("Subsystem"), - // }, - // { - // Key: to.Ptr("Environment"), - // }, - // { - // Key: to.Ptr("clusterName"), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/consumption/armconsumption/time_rfc3339.go b/sdk/resourcemanager/consumption/armconsumption/time_rfc3339.go index ebfb2e58c37c..1483ae960996 100644 --- a/sdk/resourcemanager/consumption/armconsumption/time_rfc3339.go +++ b/sdk/resourcemanager/consumption/armconsumption/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption diff --git a/sdk/resourcemanager/consumption/armconsumption/usagedetails_client.go b/sdk/resourcemanager/consumption/armconsumption/usagedetails_client.go index fa4aa59550ab..d3e0ddbd7763 100644 --- a/sdk/resourcemanager/consumption/armconsumption/usagedetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/usagedetails_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armconsumption @@ -42,8 +41,13 @@ func NewUsageDetailsClient(credential azcore.TokenCredential, options *arm.Clien // NewListPager - Lists the usage details for the defined scope. Usage details are available via this API only for May 1, // 2014 or later. +// Note:Microsoft will be retiring the Consumption Usage Details API at some point in the future. We do not recommend that +// you take a new dependency on this API. Please use the Cost Details API instead. +// We will notify customers once a date for retirement has been determined.For Learn more,see Generate Cost Details Report +// - Create Operation +// [https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?tabs=HTTP] // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - scope - The scope associated with usage details operations. This includes '/subscriptions/{subscriptionId}/' for subscription // scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for // Billing Account scope, '/providers/Microsoft.Billing/departments/{departmentId}' for Department scope, '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' @@ -56,9 +60,9 @@ func NewUsageDetailsClient(credential azcore.TokenCredential, options *arm.Clien // Also, Modern Commerce Account scopes are // '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for billingAccount scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' // for -// billingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' +// billingProfile scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' // for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. +// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. // - options - UsageDetailsClientListOptions contains the optional parameters for the UsageDetailsClient.NewListPager method. func (client *UsageDetailsClient) NewListPager(scope string, options *UsageDetailsClientListOptions) *runtime.Pager[UsageDetailsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[UsageDetailsClientListResponse]{ @@ -109,7 +113,7 @@ func (client *UsageDetailsClient) listCreateRequest(ctx context.Context, scope s if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Metric != nil { reqQP.Set("metric", string(*options.Metric)) } diff --git a/sdk/resourcemanager/consumption/armconsumption/usagedetails_client_example_test.go b/sdk/resourcemanager/consumption/armconsumption/usagedetails_client_example_test.go deleted file mode 100644 index d3bdb61e6c49..000000000000 --- a/sdk/resourcemanager/consumption/armconsumption/usagedetails_client_example_test.go +++ /dev/null @@ -1,1662 +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 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByBillingAccount.json -func ExampleUsageDetailsClient_NewListPager_billingAccountUsageDetailsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000295194820065), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.000402776395232), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.7329), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCABillingAccount.json -func ExampleUsageDetailsClient_NewListPager_billingAccountUsageDetailsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.ModernUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), - // Properties: &armconsumption.ModernUsageDetailProperties{ - // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("1234:56789"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrencyCode: to.Ptr("USD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("2468"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // CostCenter: to.Ptr("DEV"), - // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), - // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), - // CostInUSD: to.Ptr[float64](1.84763819095477), - // CustomerName: to.Ptr("Modern Azure Customer 1"), - // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.0000000Z"); return t}()), - // ExchangeRate: to.Ptr("1"), - // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), - // Frequency: to.Ptr("UsageBased"), - // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // InvoiceID: to.Ptr(""), - // InvoiceSectionID: to.Ptr("98765"), - // InvoiceSectionName: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MarketPrice: to.Ptr[float64](0.077), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartnerEarnedCreditApplied: to.Ptr("0"), - // PartnerEarnedCreditRate: to.Ptr[float64](0.077), - // PartnerName: to.Ptr("Partner Name 1"), - // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PaygCostInBillingCurrency: to.Ptr[float64](1.848), - // PaygCostInUSD: to.Ptr[float64](1.848), - // PreviousInvoiceID: to.Ptr(""), - // PricingCurrencyCode: to.Ptr("USD"), - // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), - // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), - // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), - // ProductOrderName: to.Ptr("Azure plan"), - // PublisherID: to.Ptr(""), - // PublisherName: to.Ptr("Microsoft"), - // PublisherType: to.Ptr("Microsoft"), - // Quantity: to.Ptr[float64](0.7329), - // ResellerMpnID: to.Ptr(""), - // ResellerName: to.Ptr("Reseller Name 1"), - // ReservationID: to.Ptr(""), - // ReservationName: to.Ptr(""), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceLocationNormalized: to.Ptr("US East"), - // ServiceInfo1: to.Ptr(""), - // ServiceInfo2: to.Ptr("Windows Client BYOL"), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // Term: to.Ptr(""), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByBillingAccount.json -func ExampleUsageDetailsClient_NewListPager_billingAccountUsageDetailsListForBillingPeriodLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCABillingProfile.json -func ExampleUsageDetailsClient_NewListPager_billingProfileUsageDetailsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2468", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.ModernUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/billingProfiles/2468/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), - // Properties: &armconsumption.ModernUsageDetailProperties{ - // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("1234:56789"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrencyCode: to.Ptr("USD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("2468"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // CostCenter: to.Ptr("DEV"), - // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), - // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), - // CostInUSD: to.Ptr[float64](1.84763819095477), - // CustomerName: to.Ptr("Modern Azure Customer 1"), - // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.0000000Z"); return t}()), - // ExchangeRate: to.Ptr("1"), - // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), - // Frequency: to.Ptr("UsageBased"), - // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // InvoiceID: to.Ptr(""), - // InvoiceSectionID: to.Ptr("98765"), - // InvoiceSectionName: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MarketPrice: to.Ptr[float64](0.077), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartnerEarnedCreditApplied: to.Ptr("0"), - // PartnerEarnedCreditRate: to.Ptr[float64](0.077), - // PartnerName: to.Ptr("Partner Name 1"), - // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PaygCostInBillingCurrency: to.Ptr[float64](1.848), - // PaygCostInUSD: to.Ptr[float64](1.848), - // PreviousInvoiceID: to.Ptr(""), - // PricingCurrencyCode: to.Ptr("USD"), - // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), - // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), - // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), - // ProductOrderName: to.Ptr("Azure plan"), - // PublisherID: to.Ptr(""), - // PublisherName: to.Ptr("Microsoft"), - // PublisherType: to.Ptr("Microsoft"), - // Quantity: to.Ptr[float64](0.7329), - // ResellerMpnID: to.Ptr(""), - // ResellerName: to.Ptr("Reseller Name 1"), - // ReservationID: to.Ptr(""), - // ReservationName: to.Ptr(""), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceLocationNormalized: to.Ptr("US East"), - // ServiceInfo1: to.Ptr(""), - // ServiceInfo2: to.Ptr("Windows Client BYOL"), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // Term: to.Ptr(""), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCACustomer.json -func ExampleUsageDetailsClient_NewListPager_customerUsageDetailsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.ModernUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/customers/00000000-0000-0000-0000-000000000000/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), - // Properties: &armconsumption.ModernUsageDetailProperties{ - // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("1234:56789"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrencyCode: to.Ptr("USD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("2468"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // CostCenter: to.Ptr("DEV"), - // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), - // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), - // CostInUSD: to.Ptr[float64](1.84763819095477), - // CustomerName: to.Ptr("Modern Azure Customer 1"), - // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.0000000Z"); return t}()), - // ExchangeRate: to.Ptr("1"), - // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), - // Frequency: to.Ptr("UsageBased"), - // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // InvoiceID: to.Ptr(""), - // InvoiceSectionID: to.Ptr("98765"), - // InvoiceSectionName: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MarketPrice: to.Ptr[float64](0.077), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartnerEarnedCreditApplied: to.Ptr("0"), - // PartnerEarnedCreditRate: to.Ptr[float64](0.077), - // PartnerName: to.Ptr("Partner Name 1"), - // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PaygCostInBillingCurrency: to.Ptr[float64](1.848), - // PaygCostInUSD: to.Ptr[float64](1.848), - // PreviousInvoiceID: to.Ptr(""), - // PricingCurrencyCode: to.Ptr("USD"), - // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), - // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), - // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), - // ProductOrderName: to.Ptr("Azure plan"), - // PublisherID: to.Ptr(""), - // PublisherName: to.Ptr("Microsoft"), - // PublisherType: to.Ptr("Microsoft"), - // Quantity: to.Ptr[float64](0.7329), - // ResellerMpnID: to.Ptr(""), - // ResellerName: to.Ptr("Reseller Name 1"), - // ReservationID: to.Ptr(""), - // ReservationName: to.Ptr(""), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceLocationNormalized: to.Ptr("US East"), - // ServiceInfo1: to.Ptr(""), - // ServiceInfo2: to.Ptr("Windows Client BYOL"), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // Term: to.Ptr(""), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByDepartment.json -func ExampleUsageDetailsClient_NewListPager_departmentUsageDetailsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/Departments/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/Departments/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000295194820065), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.000402776395232), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.7329), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByDepartment.json -func ExampleUsageDetailsClient_NewListPager_departmentUsageDetailsListForBillingPeriodLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/Departments/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/Departments/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByEnrollmentAccount.json -func ExampleUsageDetailsClient_NewListPager_enrollmentAccountUsageDetailsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/EnrollmentAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/EnrollmentAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000295194820065), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.000402776395232), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.7329), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByEnrollmentAccount.json -func ExampleUsageDetailsClient_NewListPager_enrollmentAccountUsageDetailsListForBillingPeriodLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/EnrollmentAccounts/1234", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/EnrollmentAccounts/1234/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMCAInvoiceSection.json -func ExampleUsageDetailsClient_NewListPager_invoiceSectionUsageDetailsListModern() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/98765", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.ModernUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/providers/Microsoft.Billing/BillingAccounts/1234:56789/invoiceSections/98765/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindModern), - // Properties: &armconsumption.ModernUsageDetailProperties{ - // AdditionalInfo: to.Ptr("{ \"UsageType\": \"ComputeHR\", \"ImageType\": \"Windows Client BYOL\", \"ServiceType\": \"Standard_D1\", \"VMName\": null, \"VMProperties\": null, \"VCPUs\": 1, \"CPUs\": 0}"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("1234:56789"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrencyCode: to.Ptr("USD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("2468"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // CostCenter: to.Ptr("DEV"), - // CostInBillingCurrency: to.Ptr[float64](1.84763819095477), - // CostInPricingCurrency: to.Ptr[float64](1.84763819095477), - // CostInUSD: to.Ptr[float64](1.84763819095477), - // CustomerName: to.Ptr("Modern Azure Customer 1"), - // CustomerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-10-30T00:00:00.0000000Z"); return t}()), - // ExchangeRate: to.Ptr("1"), - // ExchangeRateDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // ExchangeRatePricingToBilling: to.Ptr[float64](0.077), - // Frequency: to.Ptr("UsageBased"), - // InstanceName: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // InvoiceID: to.Ptr(""), - // InvoiceSectionID: to.Ptr("98765"), - // InvoiceSectionName: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MarketPrice: to.Ptr[float64](0.077), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartnerEarnedCreditApplied: to.Ptr("0"), - // PartnerEarnedCreditRate: to.Ptr[float64](0.077), - // PartnerName: to.Ptr("Partner Name 1"), - // PartnerTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PaygCostInBillingCurrency: to.Ptr[float64](1.848), - // PaygCostInUSD: to.Ptr[float64](1.848), - // PreviousInvoiceID: to.Ptr(""), - // PricingCurrencyCode: to.Ptr("USD"), - // Product: to.Ptr("Virtual Machines D Series - D1 - US East"), - // ProductIdentifier: to.Ptr("DZH318Z0BQ4B00FV"), - // ProductOrderID: to.Ptr("a3db7880-70eb-4b4c-6a79-1425a058df5a"), - // ProductOrderName: to.Ptr("Azure plan"), - // PublisherID: to.Ptr(""), - // PublisherName: to.Ptr("Microsoft"), - // PublisherType: to.Ptr("Microsoft"), - // Quantity: to.Ptr[float64](0.7329), - // ResellerMpnID: to.Ptr(""), - // ResellerName: to.Ptr("Reseller Name 1"), - // ReservationID: to.Ptr(""), - // ReservationName: to.Ptr(""), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceLocationNormalized: to.Ptr("US East"), - // ServiceInfo1: to.Ptr(""), - // ServiceInfo2: to.Ptr("Windows Client BYOL"), - // ServicePeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00Z"); return t}()), - // ServicePeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00Z"); return t}()), - // SubscriptionGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // Term: to.Ptr(""), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByManagementGroup.json -func ExampleUsageDetailsClient_NewListPager_managementGroupUsageDetailsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }, - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id2"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/scope/providers/Microsoft.Billing/billingPeriods/20180801/providers/Microsoft.Consumption/usageDetails/usageDetails_Id2"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 2"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 2"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000295194820065), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.000402776395232), - // InvoiceSection: to.Ptr("Invoice Section 2"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // OfferID: to.Ptr("Offer Id 2"), - // PartNumber: to.Ptr("Part Number 2"), - // Product: to.Ptr("Product Name 2"), - // Quantity: to.Ptr[float64](0.7329), - // ResourceGroup: to.Ptr("Resource Group 2"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 2/providers/Microsoft.Storage/storageAccounts/Resource Name 2"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 2"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](4.38), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriodByManagementGroup.json -func ExampleUsageDetailsClient_NewListPager_managementGroupUsageDetailsListForBillingPeriodLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }, - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id2"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/scope/providers/Microsoft.Billing/billingPeriods/billingPeriodName/providers/Microsoft.Consumption/usageDetails/usageDetails_Id2"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 2"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 2"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 2"), - // ChargeType: to.Ptr("UnusedReservation"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000821821271948), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.073488920944598), - // InvoiceSection: to.Ptr("Invoice Section 2"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // OfferID: to.Ptr("Offer Id 2"), - // PartNumber: to.Ptr("Part Number 2"), - // Product: to.Ptr("Product Name 2"), - // Quantity: to.Ptr[float64](0.4759), - // ResourceGroup: to.Ptr("Resource Group 2"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 2/providers/Microsoft.Storage/storageAccounts/Resource Name 2"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 2"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 2"), - // UnitPrice: to.Ptr[float64](5.74), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsExpand.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsExpandLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: to.Ptr("meterDetails,additionalInfo"), - Filter: to.Ptr("tags eq 'dev:tools'"), - Skiptoken: nil, - Top: to.Ptr[int32](1), - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // AdditionalInfo: to.Ptr("{\"MyType\":\"\",\"ServiceType\":\"\",\"VMName\":\"\",\"UsageType\":\"MyUsage\"}"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010464556322455), - // Frequency: to.Ptr("UsageBased"), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterDetails: &armconsumption.MeterDetailsResponse{ - // MeterCategory: to.Ptr("Networking"), - // MeterName: to.Ptr("Data Transfer Out (GB)"), - // MeterSubCategory: to.Ptr("ExpressRoute"), - // ServiceFamily: to.Ptr("Compute"), - // UnitOfMeasure: to.Ptr("GB"), - // }, - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.54), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsList.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsListLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("AccountName"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Customer Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Customer Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), - // Cost: to.Ptr[float64](0.000001980949998), - // CostCenter: to.Ptr("BAS"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.054693034210767), - // Frequency: to.Ptr("UsageBased"), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product1"), - // Quantity: to.Ptr[float64](0.000036), - // ResourceGroup: to.Ptr("Resource-Group-westus"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), - // ResourceLocation: to.Ptr("uswest"), - // ResourceName: to.Ptr("ResourceName1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("SubscriptionName 1"), - // UnitPrice: to.Ptr[float64](5.47), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMetricActualCost.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsListByMetricActualCostLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: to.Ptr(armconsumption.MetrictypeActualCostMetricType), - }) - 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("AccountName"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Customer Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Customer Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), - // Cost: to.Ptr[float64](0.000001968949998), - // CostCenter: to.Ptr("BAS"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.054693055510767), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product1"), - // Quantity: to.Ptr[float64](0.000036), - // ResourceGroup: to.Ptr("Resource-Group-westus"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), - // ResourceLocation: to.Ptr("uswest"), - // ResourceName: to.Ptr("ResourceName1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("SubscriptionName 1"), - // UnitPrice: to.Ptr[float64](5.47), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMetricAmortizedCost.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsListByMetricAmortizedCostLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: to.Ptr(armconsumption.MetrictypeAmortizedCostMetricType), - }) - 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("AccountName"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Customer Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Customer Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), - // Cost: to.Ptr[float64](0.000001968949998), - // CostCenter: to.Ptr("BAS"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.054693055510767), - // Frequency: to.Ptr("UsageBased"), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product1"), - // Quantity: to.Ptr[float64](0.000036), - // ResourceGroup: to.Ptr("Resource-Group-westus"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), - // ResourceLocation: to.Ptr("uswest"), - // ResourceName: to.Ptr("ResourceName1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("SubscriptionName 1"), - // UnitPrice: to.Ptr[float64](5.47), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListByMetricUsage.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsListByMetricUsageLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: to.Ptr(armconsumption.MetrictypeUsageMetricType), - }) - 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("AccountName"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Customer Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-30T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Customer Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.ClassicStorage"), - // Cost: to.Ptr[float64](0.000001968949998), - // CostCenter: to.Ptr("BAS"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-09T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.054693055510767), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product1"), - // Quantity: to.Ptr[float64](0.000036), - // ResourceGroup: to.Ptr("Resource-Group-westus"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource-Group-westus/providers/Microsoft.ClassicStorage/storageAccounts/ResourceName1"), - // ResourceLocation: to.Ptr("uswest"), - // ResourceName: to.Ptr("ResourceName1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("SubscriptionName 1"), - // UnitPrice: to.Ptr[float64](5.47), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListFilterByTag.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsListFilterByTagLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: to.Ptr("tags eq 'dev:tools'"), - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/UsageDetailsListForBillingPeriod.json -func ExampleUsageDetailsClient_NewListPager_usageDetailsListForBillingPeriodLegacy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armconsumption.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageDetailsClient().NewListPager("subscriptions/00000000-0000-0000-0000-000000000000", &armconsumption.UsageDetailsClientListOptions{Expand: nil, - Filter: nil, - Skiptoken: nil, - Top: nil, - Metric: 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.UsageDetailsListResult = armconsumption.UsageDetailsListResult{ - // Value: []armconsumption.UsageDetailClassification{ - // &armconsumption.LegacyUsageDetail{ - // Name: to.Ptr("usageDetails_Id1"), - // Type: to.Ptr("Microsoft.Consumption/usageDetails"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Billing/billingPeriods/201903/providers/Microsoft.Consumption/usageDetails/usageDetails_Id1"), - // Tags: map[string]*string{ - // "dev": to.Ptr("tools"), - // "env": to.Ptr("newcrp"), - // }, - // Kind: to.Ptr(armconsumption.UsageDetailsKindLegacy), - // Properties: &armconsumption.LegacyUsageDetailProperties{ - // AccountName: to.Ptr("Account Name 1"), - // BenefitID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // BenefitName: to.Ptr("Reservation_purchase_03-09-2018_10-59"), - // BillingAccountID: to.Ptr("xxxxxxxx"), - // BillingAccountName: to.Ptr("Account Name 1"), - // BillingCurrency: to.Ptr("CAD"), - // BillingPeriodEndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-31T00:00:00.0000000Z"); return t}()), - // BillingPeriodStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T00:00:00.0000000Z"); return t}()), - // BillingProfileID: to.Ptr("xxxxxxxx"), - // BillingProfileName: to.Ptr("Account Name 1"), - // ChargeType: to.Ptr("Usage"), - // ConsumedService: to.Ptr("Microsoft.Storage"), - // Cost: to.Ptr[float64](0.000342194841184), - // CostCenter: to.Ptr("DEV"), - // Date: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-30T00:00:00.0000000Z"); return t}()), - // EffectivePrice: to.Ptr[float64](0.010534556373432), - // InvoiceSection: to.Ptr("Invoice Section 1"), - // IsAzureCreditEligible: to.Ptr(false), - // MeterID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // OfferID: to.Ptr("Offer Id 1"), - // PartNumber: to.Ptr("Part Number 1"), - // Product: to.Ptr("Product Name 1"), - // Quantity: to.Ptr[float64](0.8234), - // ResourceGroup: to.Ptr("Resource Group 1"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Resource Group 1/providers/Microsoft.Storage/storageAccounts/Resource Name 1"), - // ResourceLocation: to.Ptr("USEast"), - // ResourceName: to.Ptr("Resource Name 1"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // SubscriptionName: to.Ptr("Subscription Name 1"), - // UnitPrice: to.Ptr[float64](3.74), - // }, - // }}, - // } - } -}