diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/ArmCostManagementModelFactory.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/ArmCostManagementModelFactory.cs new file mode 100644 index 000000000000..c8d14124bc36 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/ArmCostManagementModelFactory.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; +using static Azure.Core.Pipeline.TaskExtensions; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public static partial class ArmCostManagementModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Scheduled action name. + /// Destination format of the view data. This is optional. + /// Notification properties based on scheduled action kind. + /// Email address of the point of contact that should get the unsubscribe requests and notification emails. + /// Schedule of the scheduled action. + /// Cost Management scope like 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + /// Status of the scheduled action. + /// Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. + /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. + /// Kind of the scheduled action. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ScheduledActionData ScheduledActionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IEnumerable fileFormats = null, NotificationProperties notification = null, string notificationEmail = null, ScheduleProperties schedule = null, ResourceIdentifier scope = null, ScheduledActionStatus? status = null, ResourceIdentifier viewId = null, ETag? eTag = null, ScheduledActionKind? kind = null) + => ScheduledActionData(id, name, resourceType, systemData, eTag, kind, displayName, fileFormats, notification, notificationEmail, schedule, scope, status, viewId); + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/CostManagementExportResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/CostManagementExportResource.cs new file mode 100644 index 000000000000..5b50598e62b0 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/CostManagementExportResource.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.CostManagement +{ + public partial class CostManagementExportResource + { + /// + /// The operation to run an export. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run + /// + /// + /// Operation Id + /// Exports_Execute + /// + /// + /// Default Api Version + /// 2023-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task ExecuteAsync(CancellationToken cancellationToken = default) + => await ExecuteAsync(null, cancellationToken).ConfigureAwait(false); + + /// + /// The operation to run an export. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run + /// + /// + /// Operation Id + /// Exports_Execute + /// + /// + /// Default Api Version + /// 2023-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Response Execute(CancellationToken cancellationToken = default) + => Execute(null, cancellationToken); + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Extensions/MockableCostManagementTenantResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Extensions/MockableCostManagementTenantResource.cs new file mode 100644 index 000000000000..0c8c0aa7fd80 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Extensions/MockableCostManagementTenantResource.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement.Mocking +{ + public partial class MockableCostManagementTenantResource : ArmResource + { + /// + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// + /// + /// Operation Id + /// PriceSheet_DownloadByBillingProfile + /// + /// + /// Default Api Version + /// 2023-03-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> DownloadByBillingProfilePriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingProfilePriceSheet"); + scope.Start(); + try + { + var response = await PriceSheetRestClient.DownloadByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// + /// + /// Operation Id + /// PriceSheet_DownloadByBillingProfile + /// + /// + /// Default Api Version + /// 2023-03-01 + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The ID that uniquely identifies a billing account. + /// The ID that uniquely identifies a billing profile. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual ArmOperation DownloadByBillingProfilePriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingProfilePriceSheet"); + scope.Start(); + try + { + var response = PriceSheetRestClient.DownloadByBillingProfile(billingAccountName, billingProfileName, cancellationToken); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/CommonExportProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/CommonExportProperties.cs new file mode 100644 index 000000000000..c4a9eb13e4bb --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/CommonExportProperties.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + [CodeGenModel(Usage = new[] { "Input" })] + public partial class CommonExportProperties + { + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportDataset.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportDataset.cs new file mode 100644 index 000000000000..887039745f76 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportDataset.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class ExportDataset + { + /// Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). + public IList Columns + { + get + { + if (Configuration is null) + Configuration = new ExportDatasetConfiguration(); + return Configuration.Columns; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportDeliveryInfo.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportDeliveryInfo.cs new file mode 100644 index 000000000000..da3194dfab1d --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportDeliveryInfo.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + [CodeGenModel(Usage = new[] { "Input" })] + public partial class ExportDeliveryInfo + { + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportRun.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportRun.cs new file mode 100644 index 000000000000..778d19f24da8 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Custom/Models/ExportRun.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + [CodeGenModel(Usage = new[] { "Input" })] + public partial class ExportRun + { + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs index 5810114d36c9..474bbffecf5d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ArmCostManagementModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,6 +17,55 @@ namespace Azure.ResourceManager.CostManagement.Models /// Model factory for models. public static partial class ArmCostManagementModelFactory { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// 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. + /// defines the type of alert. + /// Alert description. + /// Source of alert. + /// Alert details. + /// related budget. + /// alert status. + /// dateTime in which alert was created. + /// dateTime in which alert was closed. + /// dateTime in which alert was last modified. + /// User who last modified the alert. + /// dateTime in which the alert status was last modified. + /// A new instance for mocking. + public static CostManagementAlertData CostManagementAlertData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, AlertPropertiesDefinition definition = null, string description = null, CostManagementAlertSource? source = null, AlertPropertiesDetails details = null, string costEntityId = null, CostManagementAlertStatus? status = null, DateTimeOffset? createdOn = null, DateTimeOffset? closeOn = null, DateTimeOffset? modifiedOn = null, string statusModificationUserName = null, DateTimeOffset? statusModifiedOn = null) + { + return new CostManagementAlertData( + id, + name, + resourceType, + systemData, + eTag, + definition, + description, + source, + details, + costEntityId, + status, + createdOn, + closeOn, + modifiedOn, + statusModificationUserName, + statusModifiedOn, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Error code. + /// Error message indicating why the operation failed. + /// A new instance for mocking. + public static ExportRunErrorDetails ExportRunErrorDetails(string code = null, string message = null) + { + return new ExportRunErrorDetails(code, message, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -122,51 +172,169 @@ public static AllSavingsList AllSavingsList(IEnumerable Initializes a new instance of . - /// Error code. - /// Error message indicating why the operation failed. - /// A new instance for mocking. - public static ExportRunErrorDetails ExportRunErrorDetails(string code = null, string message = null) - { - return new ExportRunErrorDetails(code, message, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Supported values: 'SavingsPlan'. - /// A new instance for mocking. - public static BenefitUtilizationSummary BenefitUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = null) + /// 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. + /// + /// The category of the budget. + /// - 'Cost' defines a Budget. + /// - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + /// + /// + /// The total amount of cost to track with the budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// Required for CategoryType(s): Cost. + /// + /// + /// The time covered by a budget. Tracking of the amount will be reset based on the time grain. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported timeGrainTypes for **CategoryType: Cost** + /// + /// - Monthly + /// - Quarterly + /// - Annually + /// - BillingMonth* + /// - BillingQuarter* + /// - BillingAnnual* + /// + /// *only supported for Web Direct customers. + /// + /// Supported timeGrainTypes for **CategoryType: ReservationUtilization** + /// - Last7Days + /// - Last30Days + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// May be used to filter budgets by user-specified dimensions and/or tags. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// The current amount of cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// + /// Dictionary of notifications associated with the budget. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// - Constraints for **CategoryType: Cost** - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications with thresholdType: Forecasted. + /// - Constraints for **CategoryType: ReservationUtilization** - Only one notification allowed. thresholdType is not applicable. + /// + /// + /// The forecasted cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// A new instance for mocking. + public static BudgetData BudgetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, CategoryType? category = null, float? amount = null, TimeGrainType? timeGrain = null, BudgetTimePeriod timePeriod = null, BudgetFilter filter = null, CurrentSpend currentSpend = null, IDictionary notifications = null, ForecastSpend forecastSpend = null) { - return new BenefitUtilizationSummary( + notifications ??= new Dictionary(); + + return new BudgetData( id, name, resourceType, systemData, - kind == null ? default : new BillingAccountBenefitKind(kind), + eTag, + category, + amount, + timeGrain, + timePeriod, + filter, + currentSpend, + notifications, + forecastSpend, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Input given to create the benefit utilization summaries report. - /// The status of the creation of the benefit utilization summaries report. - /// Contains sas url to the async benefit utilization summaries report and a date that the url is valid until. These values will be empty if the report is in a Running or Failed state. - /// A new instance for mocking. - public static BenefitUtilizationSummariesOperationStatus BenefitUtilizationSummariesOperationStatus(BenefitUtilizationSummariesContent input = null, OperationStatusType? status = null, AsyncOperationStatusProperties properties = null) + /// Initializes a new instance of . + /// The total amount of cost which is being tracked by the budget. + /// The unit of measure for the budget amount. + /// A new instance for mocking. + public static CurrentSpend CurrentSpend(float? amount = null, string unit = null) { - return new BenefitUtilizationSummariesOperationStatus(input, status, properties, serializedAdditionalRawData: null); + return new CurrentSpend(amount, unit, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. - /// Sas url to async benefit utilization summaries report in secondary storage in case of primary outage. Will be empty if the report is in Running or Failed state. - /// The date that the sas url provided in reportUrl expires. - /// A new instance for mocking. - public static AsyncOperationStatusProperties AsyncOperationStatusProperties(BenefitUtilizationSummaryReportSchema? reportUri = null, BenefitUtilizationSummaryReportSchema? secondaryReportUri = null, DateTimeOffset? validUntil = null) + /// Initializes a new instance of . + /// 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. + /// The unit of measure for the budget amount. + /// A new instance for mocking. + public static ForecastSpend ForecastSpend(float? amount = null, string unit = null) { - return new AsyncOperationStatusProperties(reportUri, secondaryReportUri, validUntil, serializedAdditionalRawData: null); + return new ForecastSpend(amount, unit, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Indicates if the resource name is available. + /// The reason why the given name is not available. + /// Detailed reason why the given name is available. + /// A new instance for mocking. + public static CostManagementNameAvailabilityResult CostManagementNameAvailabilityResult(bool? nameAvailable = null, CostManagementUnavailabilityReason? reason = null, string message = null) + { + return new CostManagementNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Dimension description. + /// Filter enabled. + /// Grouping enabled. + /// Dimension data. + /// Total number of data for the dimension. + /// Dimension category. + /// Usage start. + /// Usage end. + /// The link (url) to the next page of results. + /// Location of the resource. + /// SKU of the resource. + /// ETag of the resource. + /// Resource tags. + /// A new instance for mocking. + public static CostManagementDimension CostManagementDimension(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, bool? isFilterEnabled = null, bool? isGroupingEnabled = null, IEnumerable data = null, int? total = null, string category = null, DateTimeOffset? usageStart = null, DateTimeOffset? usageEnd = null, string nextLink = null, AzureLocation? location = null, string sku = null, ETag? eTag = null, IReadOnlyDictionary tags = null) + { + data ??= new List(); + tags ??= new Dictionary(); + + return new CostManagementDimension( + id, + name, + resourceType, + systemData, + description, + isFilterEnabled, + isGroupingEnabled, + data?.ToList(), + total, + category, + usageStart, + usageEnd, + nextLink, + location, + sku, + eTag, + tags, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -174,16 +342,22 @@ public static AsyncOperationStatusProperties AsyncOperationStatusProperties(Bene /// The name. /// The resourceType. /// The systemData. - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The managed identity associated with Export. Current supported identity types: None, SystemAssigned. + /// The location of the Export's managed identity. Only required when utilizing managed identity. + /// 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. + /// The format of the export being delivered. /// Has delivery information for the export. /// Has the definition for the export. /// If requested, has the most recent run history for the export. - /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + /// The export description set by customer at time of export creation/update. /// If the export has an active schedule, provides an estimate of the next run time. + /// The export suspension reason if export is in SystemSuspended state. This is not populated currently. /// Has schedule information for the export. - /// 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. /// A new instance for mocking. - public static CostManagementExportData CostManagementExportData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExportFormatType? format = null, ExportDeliveryDestination deliveryInfoDestination = null, ExportDefinition definition = null, IEnumerable runHistoryValue = null, bool? partitionData = null, DateTimeOffset? nextRunTimeEstimate = null, ExportSchedule schedule = null, ETag? eTag = null) + public static CostManagementExportData CostManagementExportData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, AzureLocation? location = null, ETag? eTag = null, ExportFormatType? format = null, ExportDeliveryDestination deliveryInfoDestination = null, ExportDefinition definition = null, IEnumerable runHistoryValue = null, bool? partitionData = null, DataOverwriteBehaviorType? dataOverwriteBehavior = null, CompressionModeType? compressionMode = null, string exportDescription = null, DateTimeOffset? nextRunTimeEstimate = null, ExportSuspensionContext systemSuspensionContext = null, ExportSchedule schedule = null) { runHistoryValue ??= new List(); @@ -192,26 +366,36 @@ public static CostManagementExportData CostManagementExportData(ResourceIdentifi name, resourceType, systemData, + identity, + location, + eTag, format, deliveryInfoDestination != null ? new ExportDeliveryInfo(deliveryInfoDestination, serializedAdditionalRawData: null) : null, definition, runHistoryValue != null ? new ExportExecutionListResult(runHistoryValue?.ToList(), serializedAdditionalRawData: null) : null, partitionData, + dataOverwriteBehavior, + compressionMode, + exportDescription, nextRunTimeEstimate, + systemSuspensionContext, schedule, - eTag, serializedAdditionalRawData: null); } /// Initializes a new instance of . - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The format of the export being delivered. /// Has delivery information for the export. /// Has the definition for the export. /// If requested, has the most recent run history for the export. - /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + /// The export description set by customer at time of export creation/update. /// If the export has an active schedule, provides an estimate of the next run time. + /// The export suspension reason if export is in SystemSuspended state. This is not populated currently. /// A new instance for mocking. - public static CommonExportProperties CommonExportProperties(ExportFormatType? format = null, ExportDeliveryDestination deliveryInfoDestination = null, ExportDefinition definition = null, IEnumerable runHistoryValue = null, bool? partitionData = null, DateTimeOffset? nextRunTimeEstimate = null) + public static CommonExportProperties CommonExportProperties(ExportFormatType? format = null, ExportDeliveryDestination deliveryInfoDestination = null, ExportDefinition definition = null, IEnumerable runHistoryValue = null, bool? partitionData = null, DataOverwriteBehaviorType? dataOverwriteBehavior = null, CompressionModeType? compressionMode = null, string exportDescription = null, DateTimeOffset? nextRunTimeEstimate = null, ExportSuspensionContext systemSuspensionContext = null) { runHistoryValue ??= new List(); @@ -221,7 +405,11 @@ public static CommonExportProperties CommonExportProperties(ExportFormatType? fo definition, runHistoryValue != null ? new ExportExecutionListResult(runHistoryValue?.ToList(), serializedAdditionalRawData: null) : null, partitionData, + dataOverwriteBehavior, + compressionMode, + exportDescription, nextRunTimeEstimate, + systemSuspensionContext, serializedAdditionalRawData: null); } @@ -236,12 +424,15 @@ public static CommonExportProperties CommonExportProperties(ExportFormatType? fo /// The time when export was queued to be run. /// The time when export was picked up to be run. /// The time when the export run finished. + /// The start datetime for the export. + /// The end datetime for the export. /// The name of the exported file. + /// The manifest file location(URI location) for the exported files. /// The export settings that were in effect for this run. /// The details of any error. /// 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. /// A new instance for mocking. - public static ExportRun ExportRun(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExportRunExecutionType? executionType = null, ExportRunExecutionStatus? status = null, string submittedBy = null, DateTimeOffset? submittedOn = null, DateTimeOffset? processingStartOn = null, DateTimeOffset? processingEndOn = null, string fileName = null, CommonExportProperties runSettings = null, ExportRunErrorDetails error = null, ETag? eTag = null) + public static ExportRun ExportRun(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExportRunExecutionType? executionType = null, ExportRunExecutionStatus? status = null, string submittedBy = null, DateTimeOffset? submittedOn = null, DateTimeOffset? processingStartOn = null, DateTimeOffset? processingEndOn = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string fileName = null, string manifestFile = null, CommonExportProperties runSettings = null, ExportRunErrorDetails error = null, ETag? eTag = null) { return new ExportRun( id, @@ -254,104 +445,24 @@ public static ExportRun ExportRun(ResourceIdentifier id = null, string name = nu submittedOn, processingStartOn, processingEndOn, + startOn, + endOn, fileName, + manifestFile, runSettings, error, eTag, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// User input name of the view. Required. - /// Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. - /// Date the user created this view. - /// Date when the user last modified this view. - /// Date range of the current view. - /// Currency of the current view. - /// Chart type of the main view in Cost Analysis. Required. - /// Show costs accumulated over time. - /// Metric to use when displaying costs. - /// List of KPIs to show in Cost Analysis UI. - /// Configuration of 3 sub-views in the Cost Analysis UI. - /// The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates. - /// The time frame for pulling data for the report. If custom, then a specific time period must be provided. - /// Has time period for pulling data for the report. - /// Has definition for data in this report config. - /// If true, report includes monetary commitment. - /// 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. - /// A new instance for mocking. - public static CostManagementViewData CostManagementViewData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, ResourceIdentifier scope = null, DateTimeOffset? createdOn = null, DateTimeOffset? modifiedOn = null, string dateRange = null, string currency = null, ViewChartType? chart = null, AccumulatedType? accumulated = null, ViewMetricType? metric = null, IEnumerable kpis = null, IEnumerable pivots = null, ViewReportType? typePropertiesQueryType = null, ReportTimeframeType? timeframe = null, ReportConfigTimePeriod timePeriod = null, ReportConfigDataset dataSet = null, bool? includeMonetaryCommitment = null, ETag? eTag = null) - { - kpis ??= new List(); - pivots ??= new List(); - - return new CostManagementViewData( - id, - name, - resourceType, - systemData, - displayName, - scope, - createdOn, - modifiedOn, - dateRange, - currency, - chart, - accumulated, - metric, - kpis?.ToList(), - pivots?.ToList(), - typePropertiesQueryType, - timeframe, - timePeriod, - dataSet, - includeMonetaryCommitment, - eTag, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// defines the type of alert. - /// Alert description. - /// Source of alert. - /// Alert details. - /// related budget. - /// alert status. - /// dateTime in which alert was created. - /// dateTime in which alert was closed. - /// dateTime in which alert was last modified. - /// User who last modified the alert. - /// dateTime in which the alert status was last modified. - /// 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. - /// A new instance for mocking. - public static CostManagementAlertData CostManagementAlertData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AlertPropertiesDefinition definition = null, string description = null, CostManagementAlertSource? source = null, AlertPropertiesDetails details = null, string costEntityId = null, CostManagementAlertStatus? status = null, DateTimeOffset? createdOn = null, DateTimeOffset? closeOn = null, DateTimeOffset? modifiedOn = null, string statusModificationUserName = null, DateTimeOffset? statusModifiedOn = null, ETag? eTag = null) + /// Initializes a new instance of . + /// The code for export suspension. + /// The detailed reason for export suspension. + /// The time when the export was suspended. + /// A new instance for mocking. + public static ExportSuspensionContext ExportSuspensionContext(string suspensionCode = null, string suspensionReason = null, DateTimeOffset? suspensionOn = null) { - return new CostManagementAlertData( - id, - name, - resourceType, - systemData, - definition, - description, - source, - details, - costEntityId, - status, - createdOn, - closeOn, - modifiedOn, - statusModificationUserName, - statusModifiedOn, - eTag, - serializedAdditionalRawData: null); + return new ExportSuspensionContext(suspensionCode, suspensionReason, suspensionOn, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -417,44 +528,44 @@ public static ForecastColumn ForecastColumn(string name = null, string forecastC return new ForecastColumn(name, forecastColumnType, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The type of the query. + /// The time frame for pulling data for the query. If custom, then a specific time period must be provided. + /// Has time period for pulling data for the query. + /// Has definition for data in this query. + /// A new instance for mocking. + public static QueryDefinition QueryDefinition(ExportType exportType = default, TimeframeType timeframe = default, QueryTimePeriod timePeriod = null, QueryDataset dataset = null) + { + return new QueryDefinition(exportType, timeframe, timePeriod, dataset, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Dimension description. - /// Filter enabled. - /// Grouping enabled. - /// Dimension data. - /// Total number of data for the dimension. - /// Dimension category. - /// Usage start. - /// Usage end. /// The link (url) to the next page of results. + /// Array of columns. + /// Array of rows. /// Location of the resource. /// SKU of the resource. /// ETag of the resource. /// Resource tags. - /// A new instance for mocking. - public static CostManagementDimension CostManagementDimension(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, bool? isFilterEnabled = null, bool? isGroupingEnabled = null, IEnumerable data = null, int? total = null, string category = null, DateTimeOffset? usageStart = null, DateTimeOffset? usageEnd = null, string nextLink = null, AzureLocation? location = null, string sku = null, ETag? eTag = null, IReadOnlyDictionary tags = null) + /// A new instance for mocking. + public static QueryResult QueryResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string nextLink = null, IEnumerable columns = null, IEnumerable> rows = null, AzureLocation? location = null, string sku = null, ETag? eTag = null, IReadOnlyDictionary tags = null) { - data ??= new List(); + columns ??= new List(); + rows ??= new List>(); tags ??= new Dictionary(); - return new CostManagementDimension( + return new QueryResult( id, name, resourceType, systemData, - description, - isFilterEnabled, - isGroupingEnabled, - data?.ToList(), - total, - category, - usageStart, - usageEnd, nextLink, + columns?.ToList(), + rows?.ToList(), location, sku, eTag, @@ -462,58 +573,122 @@ public static CostManagementDimension CostManagementDimension(ResourceIdentifier serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The type of the query. - /// The time frame for pulling data for the query. If custom, then a specific time period must be provided. - /// Has time period for pulling data for the query. - /// Has definition for data in this query. - /// A new instance for mocking. - public static QueryDefinition QueryDefinition(ExportType exportType = default, TimeframeType timeframe = default, QueryTimePeriod timePeriod = null, QueryDataset dataset = null) + /// Initializes a new instance of . + /// The name of column. + /// The type of column. + /// A new instance for mocking. + public static QueryColumn QueryColumn(string name = null, string queryColumnType = null) { - return new QueryDefinition(exportType, timeframe, timePeriod, dataset, serializedAdditionalRawData: null); + return new QueryColumn(name, queryColumnType, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The link (url) to the next page of results. - /// Array of columns. - /// Array of rows. - /// Location of the resource. - /// SKU of the resource. - /// ETag of the resource. - /// Resource tags. - /// A new instance for mocking. - public static QueryResult QueryResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string nextLink = null, IEnumerable columns = null, IEnumerable> rows = null, AzureLocation? location = null, string sku = null, ETag? eTag = null, IReadOnlyDictionary tags = null) + /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. + /// Kind of the scheduled action. + /// Scheduled action name. + /// Destination format of the view data. This is optional. + /// Notification properties based on scheduled action kind. + /// Email address of the point of contact that should get the unsubscribe requests and notification emails. + /// Schedule of the scheduled action. + /// For private scheduled action(Create or Update), scope will be empty.<br /> For shared scheduled action(Create or Update By Scope), Cost Management scope can be 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + /// Status of the scheduled action. + /// Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. + /// A new instance for mocking. + public static ScheduledActionData ScheduledActionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, ScheduledActionKind? kind = null, string displayName = null, IEnumerable fileFormats = null, NotificationProperties notification = null, string notificationEmail = null, ScheduleProperties schedule = null, ResourceIdentifier scope = null, ScheduledActionStatus? status = null, ResourceIdentifier viewId = null) { - columns ??= new List(); - rows ??= new List>(); - tags ??= new Dictionary(); + fileFormats ??= new List(); - return new QueryResult( + return new ScheduledActionData( id, name, resourceType, systemData, - nextLink, - columns?.ToList(), - rows?.ToList(), - location, - sku, eTag, - tags, + kind, + displayName, + fileFormats != null ? new FileDestination(fileFormats?.ToList(), serializedAdditionalRawData: null) : null, + notification, + notificationEmail, + schedule, + scope, + status, + viewId, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The name of column. - /// The type of column. - /// A new instance for mocking. - public static QueryColumn QueryColumn(string name = null, string queryColumnType = null) + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + /// A new instance for mocking. + public static SettingData SettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = null) { - return new QueryColumn(name, queryColumnType, serializedAdditionalRawData: null); + return new UnknownSetting( + id, + name, + resourceType, + systemData, + kind == null ? default : new SettingsKind(kind), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// 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. + /// User input name of the view. Required. + /// Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + /// Date the user created this view. + /// Date when the user last modified this view. + /// Date range of the current view. + /// Currency of the current view. + /// Chart type of the main view in Cost Analysis. Required. + /// Show costs accumulated over time. + /// Metric to use when displaying costs. + /// List of KPIs to show in Cost Analysis UI. + /// Configuration of 3 sub-views in the Cost Analysis UI. + /// The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates. + /// The time frame for pulling data for the report. If custom, then a specific time period must be provided. + /// Has time period for pulling data for the report. + /// Has definition for data in this report config. + /// If true, report includes monetary commitment. + /// A new instance for mocking. + public static CostManagementViewData CostManagementViewData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, string displayName = null, ResourceIdentifier scope = null, DateTimeOffset? createdOn = null, DateTimeOffset? modifiedOn = null, string dateRange = null, string currency = null, ViewChartType? chart = null, AccumulatedType? accumulated = null, ViewMetricType? metric = null, IEnumerable kpis = null, IEnumerable pivots = null, ViewReportType? typePropertiesQueryType = null, ReportTimeframeType? timeframe = null, ReportConfigTimePeriod timePeriod = null, ReportConfigDataset dataSet = null, bool? includeMonetaryCommitment = null) + { + kpis ??= new List(); + pivots ??= new List(); + + return new CostManagementViewData( + id, + name, + resourceType, + systemData, + eTag, + displayName, + scope, + createdOn, + modifiedOn, + dateRange, + currency, + chart, + accumulated, + metric, + kpis?.ToList(), + pivots?.ToList(), + typePropertiesQueryType, + timeframe, + timePeriod, + dataSet, + includeMonetaryCommitment, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -536,55 +711,266 @@ public static DownloadURL DownloadURL(DateTimeOffset? expiryOn = null, DateTimeO return new DownloadURL(expiryOn, validTill, downloadUri, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Scheduled action name. - /// Destination format of the view data. This is optional. - /// Notification properties based on scheduled action kind. - /// Email address of the point of contact that should get the unsubscribe requests and notification emails. - /// Schedule of the scheduled action. - /// Cost Management scope like 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. - /// Status of the scheduled action. - /// Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. - /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. - /// Kind of the scheduled action. - /// A new instance for mocking. - public static ScheduledActionData ScheduledActionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, IEnumerable fileFormats = null, NotificationProperties notification = null, string notificationEmail = null, ScheduleProperties schedule = null, ResourceIdentifier scope = null, ScheduledActionStatus? status = null, ResourceIdentifier viewId = null, ETag? eTag = null, ScheduledActionKind? kind = null) + /// Supported values: 'SavingsPlan'. + /// A new instance for mocking. + public static BenefitUtilizationSummary BenefitUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = null) { - fileFormats ??= new List(); + return new BenefitUtilizationSummary( + id, + name, + resourceType, + systemData, + kind == null ? default : new BillingAccountBenefitKind(kind), + serializedAdditionalRawData: null); + } - return new ScheduledActionData( + /// Initializes a new instance of . + /// Input given to create the benefit utilization summaries report. + /// The status of the creation of the benefit utilization summaries report. + /// Contains sas url to the async benefit utilization summaries report and a date that the url is valid until. These values will be empty if the report is in a Running or Failed state. + /// A new instance for mocking. + public static BenefitUtilizationSummariesOperationStatus BenefitUtilizationSummariesOperationStatus(BenefitUtilizationSummariesContent input = null, OperationStatusType? status = null, AsyncOperationStatusProperties properties = null) + { + return new BenefitUtilizationSummariesOperationStatus(input, status, properties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Sas url to the async benefit utilization summaries report. Will be empty if the report is in Running or Failed state. + /// Sas url to async benefit utilization summaries report in secondary storage in case of primary outage. Will be empty if the report is in Running or Failed state. + /// The date that the sas url provided in reportUrl expires. + /// A new instance for mocking. + public static AsyncOperationStatusProperties AsyncOperationStatusProperties(BenefitUtilizationSummaryReportSchema? reportUri = null, BenefitUtilizationSummaryReportSchema? secondaryReportUri = null, DateTimeOffset? validUntil = null) + { + return new AsyncOperationStatusProperties(reportUri, secondaryReportUri, validUntil, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + /// The URL to download the generated report. + /// The properties in downloaded file. + /// A new instance for mocking. + public static PricesheetDownloadProperties PricesheetDownloadProperties(DateTimeOffset? expiryOn = null, Uri downloadUri = null, MCAPriceSheetProperties downloadFileProperties = null) + { + return new PricesheetDownloadProperties(expiryOn, downloadUri, downloadFileProperties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique identifier for the billing account. + /// Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. + /// Unique identifier for the billing profile. + /// Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. + /// + /// Name of the purchased product plan. Indicates if this pricing is standard Azure Plan pricing, Dev/Test pricing etc. + /// + /// Currently unavailable for Azure 3rd party and ReservedInstance meters. + /// + /// Type of Azure service. For example, Compute, Analytics, and Security. + /// Name of the product accruing the charges. + /// Unique identifier for the product whose meter is consumed. + /// Unique identifier of the SKU. + /// How usage is measured for the service. + /// Unique identifier of the meter. + /// Name of the meter. The meter represents the deployable resource of an Azure service. + /// Name of the meter type. + /// Name of the classification category for the meter. For example, Cloud services, Networking, etc. + /// Name of the meter subclassification category. + /// Name of the Azure region where the meter for the service is available. + /// Defines the lower bound of the tier range for which prices are defined. For example, if the range is 0 to 100, tierMinimumUnits would be 0. + /// Effective start date of the Price Sheet billing period. + /// Effective end date of the Price Sheet billing period. + /// + /// The per-unit price at the time of billing for a given product or service, inclusive of any negotiated discounts on top of the market price. + /// + /// For PriceType ReservedInstance, unit price reflects the total cost of the 1 or 3-year commitment including discounts. + /// + /// Note: The unit price isn't the same as the effective price in usage details downloads when services have differential prices across tiers. + /// + /// If services have multi-tiered pricing, the effective price is a blended rate across the tiers and doesn't show a tier-specific unit price. The blended price or effective price is the net price for the consumed quantity spanning across the multiple tiers (where each tier has a specific unit price). + /// + /// + /// The unit price at the time the customer signs on or the unit price at the time of service meter GA launch if it is after sign-on. + /// + /// This is applicable for Enterprise Agreement users + /// + /// + /// The current list price for a given product or service. This price is without any negotiations and is based on your Microsoft Agreement type. + /// + /// For PriceType Consumption, market price is reflected as the pay-as-you-go price. + /// + /// For PriceType Savings Plan, market price reflects the Savings plan benefit on top of pay-as-you-go price for the corresponding commitment term. + /// + /// For PriceType ReservedInstance, market price reflects the total price of the 1 or 3-year commitment. + /// + /// Currency in which all the prices are reflected. + /// Currency in which charges are posted. + /// Term length for Azure Savings Plan or Reservation term – one year or three years (P1Y or P3Y). + /// Price type for a product. For example, an Azure resource with a pay-as-you-go rate with priceType as Consumption. Other price types include ReservedInstance and Savings Plan. + /// A new instance for mocking. + public static MCAPriceSheetProperties MCAPriceSheetProperties(string billingAccountId = null, string billingAccountName = null, string billingProfileId = null, string billingProfileName = null, string productOrderName = null, float? serviceFamily = null, string product = null, string productId = null, string skuId = null, string unitOfMeasure = null, string meterId = null, string meterName = null, string meterType = null, string meterCategory = null, string meterSubCategory = null, string meterRegion = null, string tierMinimumUnits = null, DateTimeOffset? effectiveStartOn = null, DateTimeOffset? effectiveEndOn = null, string unitPrice = null, string basePrice = null, string marketPrice = null, string currency = null, string billingCurrency = null, string term = null, string priceType = null) + { + return new MCAPriceSheetProperties( + billingAccountId, + billingAccountName, + billingProfileId, + billingProfileName, + productOrderName, + serviceFamily, + product, + productId, + skuId, + unitOfMeasure, + meterId, + meterName, + meterType, + meterCategory, + meterSubCategory, + meterRegion, + tierMinimumUnits, + effectiveStartOn, + effectiveEndOn, + unitPrice, + basePrice, + marketPrice, + currency, + billingCurrency, + term, + priceType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Cost allocation rule properties. + /// A new instance for mocking. + public static CostAllocationRuleDefinitionData CostAllocationRuleDefinitionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CostAllocationRuleProperties properties = null) + { + return new CostAllocationRuleDefinitionData( id, name, resourceType, systemData, - displayName, - fileFormats != null ? new FileDestination(fileFormats?.ToList(), serializedAdditionalRawData: null) : null, - notification, - notificationEmail, - schedule, - scope, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Description of a cost allocation rule. + /// Resource information for the cost allocation rule. + /// Status of the rule. + /// Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation. + /// Time at which the rule was last updated. + /// A new instance for mocking. + public static CostAllocationRuleProperties CostAllocationRuleProperties(string description = null, CostAllocationRuleDetails details = null, RuleStatus status = default, DateTimeOffset? createdOn = null, DateTimeOffset? updatedOn = null) + { + return new CostAllocationRuleProperties( + description, + details, status, - viewId, - eTag, - kind, + createdOn, + updatedOn, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Indicates if the resource name is available. - /// The reason why the given name is not available. - /// Detailed reason why the given name is available. - /// A new instance for mocking. - public static CostManagementNameAvailabilityResult CostManagementNameAvailabilityResult(bool? nameAvailable = null, CostManagementUnavailabilityReason? reason = null, string message = null) + /// Initializes a new instance of . + /// Whether this rule name is available. + /// The reason this name is not available. + /// Error message if the name is not available. + /// A new instance for mocking. + public static CostAllocationRuleCheckNameAvailabilityResponse CostAllocationRuleCheckNameAvailabilityResponse(bool? nameAvailable = null, Reason? reason = null, string message = null) { - return new CostManagementNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData: null); + return new CostAllocationRuleCheckNameAvailabilityResponse(nameAvailable, reason, message, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. + /// The benefit ID is the identifier of the benefit. + /// The benefit order ID is the identifier for a benefit purchase. + /// The benefit type. Supported values: 'SavingsPlan'. + /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. + /// This is the utilized percentage for the benefit ID. + /// A new instance for mocking. + public static IncludedQuantityUtilizationSummary IncludedQuantityUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string armSkuName = null, string benefitId = null, string benefitOrderId = null, BillingAccountBenefitKind? benefitType = null, DateTimeOffset? usageOn = null, decimal? utilizationPercentage = null) + { + return new IncludedQuantityUtilizationSummary( + id, + name, + resourceType, + systemData, + BillingAccountBenefitKind.IncludedQuantity, + serializedAdditionalRawData: null, + armSkuName, + benefitId, + benefitOrderId, + benefitType, + usageOn, + utilizationPercentage); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. + /// The benefit ID is the identifier of the benefit. + /// The benefit order ID is the identifier for a benefit purchase. + /// The benefit type. Supported values: 'SavingsPlan'. + /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. + /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. + /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. + /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. + /// A new instance for mocking. + public static SavingsPlanUtilizationSummary SavingsPlanUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string armSkuName = null, string benefitId = null, string benefitOrderId = null, BillingAccountBenefitKind? benefitType = null, DateTimeOffset? usageOn = null, decimal? avgUtilizationPercentage = null, decimal? minUtilizationPercentage = null, decimal? maxUtilizationPercentage = null) + { + return new SavingsPlanUtilizationSummary( + id, + name, + resourceType, + systemData, + BillingAccountBenefitKind.SavingsPlan, + serializedAdditionalRawData: null, + armSkuName, + benefitId, + benefitOrderId, + benefitType, + usageOn, + avgUtilizationPercentage, + minUtilizationPercentage, + maxUtilizationPercentage); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The properties of the tag inheritance setting. + /// A new instance for mocking. + public static TagInheritanceSetting TagInheritanceSetting(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? preferContainerTags = null) + { + return new TagInheritanceSetting( + id, + name, + resourceType, + systemData, + SettingsKind.Taginheritance, + serializedAdditionalRawData: null, + preferContainerTags.HasValue ? new TagInheritanceProperties(preferContainerTags.Value, serializedAdditionalRawData: null) : null); + } + + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -597,12 +983,10 @@ public static CostManagementNameAvailabilityResult CostManagementNameAvailabilit /// The current cost without benefit, corresponds to 'totalHours' in the look-back period. /// The details of the proposed recommendation. /// The list of all benefit recommendations with the recommendation details. - /// The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope. - /// The resource group that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope and 'ResourceGroup' request scope. - /// A new instance for mocking. - public static SingleScopeBenefitRecommendationProperties SingleScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null, string subscriptionId = null, string resourceGroup = null) + /// A new instance for mocking. + public static SharedScopeBenefitRecommendationProperties SharedScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null) { - return new SingleScopeBenefitRecommendationProperties( + return new SharedScopeBenefitRecommendationProperties( firstConsumptionOn, lastConsumptionOn, lookBackPeriod, @@ -615,13 +999,11 @@ public static SingleScopeBenefitRecommendationProperties SingleScopeBenefitRecom costWithoutBenefit, recommendationDetails, allRecommendationDetails, - BenefitRecommendationScope.Single, - serializedAdditionalRawData: null, - subscriptionId, - resourceGroup); + BenefitRecommendationScope.Shared, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The first usage date used for looking back for computing the recommendations. /// The last usage date used for looking back for computing the recommendations. /// The number of days of usage evaluated for computing the recommendations. @@ -634,10 +1016,12 @@ public static SingleScopeBenefitRecommendationProperties SingleScopeBenefitRecom /// The current cost without benefit, corresponds to 'totalHours' in the look-back period. /// The details of the proposed recommendation. /// The list of all benefit recommendations with the recommendation details. - /// A new instance for mocking. - public static SharedScopeBenefitRecommendationProperties SharedScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null) + /// The subscription ID that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope. + /// The resource group that this single scope recommendation is for. Applicable only if recommendation is for 'Single' scope and 'ResourceGroup' request scope. + /// A new instance for mocking. + public static SingleScopeBenefitRecommendationProperties SingleScopeBenefitRecommendationProperties(DateTimeOffset? firstConsumptionOn = null, DateTimeOffset? lastConsumptionOn = null, LookBackPeriod? lookBackPeriod = null, int? totalHours = null, RecommendationUsageDetails usage = null, string armSkuName = null, BenefitRecommendationPeriodTerm? term = null, BenefitRecommendationUsageGrain? commitmentGranularity = null, string currencyCode = null, decimal? costWithoutBenefit = null, AllSavingsBenefitDetails recommendationDetails = null, AllSavingsList allRecommendationDetails = null, string subscriptionId = null, string resourceGroup = null) { - return new SharedScopeBenefitRecommendationProperties( + return new SingleScopeBenefitRecommendationProperties( firstConsumptionOn, lastConsumptionOn, lookBackPeriod, @@ -650,70 +1034,66 @@ public static SharedScopeBenefitRecommendationProperties SharedScopeBenefitRecom costWithoutBenefit, recommendationDetails, allRecommendationDetails, - BenefitRecommendationScope.Shared, - serializedAdditionalRawData: null); + BenefitRecommendationScope.Single, + serializedAdditionalRawData: null, + subscriptionId, + resourceGroup); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. - /// The benefit ID is the identifier of the benefit. - /// The benefit order ID is the identifier for a benefit purchase. - /// The benefit type. Supported values: 'SavingsPlan'. - /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. - /// This is the utilized percentage for the benefit ID. - /// A new instance for mocking. - public static IncludedQuantityUtilizationSummary IncludedQuantityUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string armSkuName = null, string benefitId = null, string benefitOrderId = null, BillingAccountBenefitKind? benefitType = null, DateTimeOffset? usageOn = null, decimal? utilizationPercentage = null) + /// The format of the export being delivered. Currently only 'Csv' is supported. + /// Has delivery information for the export. + /// Has the definition for the export. + /// If requested, has the most recent run history for the export. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If the export has an active schedule, provides an estimate of the next run time. + /// Has schedule information for the export. + /// 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. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CostManagementExportData CostManagementExportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportFormatType? format, ExportDeliveryDestination deliveryInfoDestination, ExportDefinition definition, IEnumerable runHistoryValue, bool? partitionData, DateTimeOffset? nextRunTimeEstimate, ExportSchedule schedule, ETag? eTag) { - return new IncludedQuantityUtilizationSummary( - id, - name, - resourceType, - systemData, - BillingAccountBenefitKind.IncludedQuantity, - serializedAdditionalRawData: null, - armSkuName, - benefitId, - benefitOrderId, - benefitType, - usageOn, - utilizationPercentage); + return CostManagementExportData(id: id, name: name, resourceType: resourceType, systemData: systemData, identity: default, location: default, eTag: eTag, format: format, deliveryInfoDestination: deliveryInfoDestination, definition: definition, runHistoryValue: runHistoryValue, partitionData: partitionData, dataOverwriteBehavior: default, compressionMode: default, exportDescription: default, nextRunTimeEstimate: nextRunTimeEstimate, systemSuspensionContext: default, schedule: schedule); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The format of the export being delivered. Currently only 'Csv' is supported. + /// Has delivery information for the export. + /// Has the definition for the export. + /// If requested, has the most recent run history for the export. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If the export has an active schedule, provides an estimate of the next run time. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CommonExportProperties CommonExportProperties(ExportFormatType? format, ExportDeliveryDestination deliveryInfoDestination, ExportDefinition definition, IEnumerable runHistoryValue, bool? partitionData, DateTimeOffset? nextRunTimeEstimate) + { + return CommonExportProperties(format: format, deliveryInfoDestination: deliveryInfoDestination, definition: definition, runHistoryValue: runHistoryValue, partitionData: partitionData, dataOverwriteBehavior: default, compressionMode: default, exportDescription: default, nextRunTimeEstimate: nextRunTimeEstimate, systemSuspensionContext: default); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// ARM SKU name. For example, 'Compute_Savings_Plan' for savings plan. - /// The benefit ID is the identifier of the benefit. - /// The benefit order ID is the identifier for a benefit purchase. - /// The benefit type. Supported values: 'SavingsPlan'. - /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. - /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. - /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. - /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. - /// A new instance for mocking. - public static SavingsPlanUtilizationSummary SavingsPlanUtilizationSummary(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string armSkuName = null, string benefitId = null, string benefitOrderId = null, BillingAccountBenefitKind? benefitType = null, DateTimeOffset? usageOn = null, decimal? avgUtilizationPercentage = null, decimal? minUtilizationPercentage = null, decimal? maxUtilizationPercentage = null) + /// The type of the export run. + /// The last known status of the export run. + /// The identifier for the entity that triggered the export. For on-demand runs it is the user email. For scheduled runs it is 'System'. + /// The time when export was queued to be run. + /// The time when export was picked up to be run. + /// The time when the export run finished. + /// The name of the exported file. + /// The export settings that were in effect for this run. + /// The details of any error. + /// 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. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ExportRun ExportRun(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportRunExecutionType? executionType, ExportRunExecutionStatus? status, string submittedBy, DateTimeOffset? submittedOn, DateTimeOffset? processingStartOn, DateTimeOffset? processingEndOn, string fileName, CommonExportProperties runSettings, ExportRunErrorDetails error, ETag? eTag) { - return new SavingsPlanUtilizationSummary( - id, - name, - resourceType, - systemData, - BillingAccountBenefitKind.SavingsPlan, - serializedAdditionalRawData: null, - armSkuName, - benefitId, - benefitOrderId, - benefitType, - usageOn, - avgUtilizationPercentage, - minUtilizationPercentage, - maxUtilizationPercentage); + return ExportRun(id: id, name: name, resourceType: resourceType, systemData: systemData, executionType: executionType, status: status, submittedBy: submittedBy, submittedOn: submittedOn, processingStartOn: processingStartOn, processingEndOn: processingEndOn, startOn: default, endOn: default, fileName: fileName, manifestFile: default, runSettings: runSettings, error: error, eTag: eTag); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetCollection.cs new file mode 100644 index 000000000000..b644e2f1954f --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetCollection.cs @@ -0,0 +1,489 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetBudgets method from an instance of . + /// + public partial class BudgetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _budgetClientDiagnostics; + private readonly BudgetsRestOperations _budgetRestClient; + + /// Initializes a new instance of the class for mocking. + protected BudgetCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal BudgetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _budgetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CostManagement", BudgetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BudgetResource.ResourceType, out string budgetApiVersion); + _budgetRestClient = new BudgetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, budgetApiVersion); + } + + /// + /// The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Budget Name. + /// Parameters supplied to the Create Budget operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string budgetName, BudgetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _budgetRestClient.CreateOrUpdateAsync(Id, budgetName, data, cancellationToken).ConfigureAwait(false); + var uri = _budgetRestClient.CreateCreateOrUpdateRequestUri(Id, budgetName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new BudgetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Budget Name. + /// Parameters supplied to the Create Budget operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string budgetName, BudgetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _budgetRestClient.CreateOrUpdate(Id, budgetName, data, cancellationToken); + var uri = _budgetRestClient.CreateCreateOrUpdateRequestUri(Id, budgetName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new BudgetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.Get"); + scope.Start(); + try + { + var response = await _budgetRestClient.GetAsync(Id, budgetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.Get"); + scope.Start(); + try + { + var response = _budgetRestClient.Get(Id, budgetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets + /// + /// + /// Operation Id + /// Budgets_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _budgetRestClient.CreateListRequest(Id, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _budgetRestClient.CreateListNextPageRequest(nextLink, Id, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BudgetResource(Client, BudgetData.DeserializeBudgetData(e)), _budgetClientDiagnostics, Pipeline, "BudgetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists all budgets for the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets + /// + /// + /// Operation Id + /// Budgets_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _budgetRestClient.CreateListRequest(Id, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _budgetRestClient.CreateListNextPageRequest(nextLink, Id, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BudgetResource(Client, BudgetData.DeserializeBudgetData(e)), _budgetClientDiagnostics, Pipeline, "BudgetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.Exists"); + scope.Start(); + try + { + var response = await _budgetRestClient.GetAsync(Id, budgetName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.Exists"); + scope.Start(); + try + { + var response = _budgetRestClient.Get(Id, budgetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _budgetRestClient.GetAsync(Id, budgetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Budget Name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _budgetRestClient.Get(Id, budgetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetData.Serialization.cs new file mode 100644 index 000000000000..1f36cb598d97 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetData.Serialization.cs @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement +{ + public partial class BudgetData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.Value.ToString()); + } + if (Optional.IsDefined(Amount)) + { + writer.WritePropertyName("amount"u8); + writer.WriteNumberValue(Amount.Value); + } + if (Optional.IsDefined(TimeGrain)) + { + writer.WritePropertyName("timeGrain"u8); + writer.WriteStringValue(TimeGrain.Value.ToString()); + } + if (Optional.IsDefined(TimePeriod)) + { + writer.WritePropertyName("timePeriod"u8); + writer.WriteObjectValue(TimePeriod, options); + } + if (Optional.IsDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteObjectValue(Filter, options); + } + if (options.Format != "W" && Optional.IsDefined(CurrentSpend)) + { + writer.WritePropertyName("currentSpend"u8); + writer.WriteObjectValue(CurrentSpend, options); + } + if (Optional.IsCollectionDefined(Notifications)) + { + writer.WritePropertyName("notifications"u8); + writer.WriteStartObject(); + foreach (var item in Notifications) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsDefined(ForecastSpend)) + { + writer.WritePropertyName("forecastSpend"u8); + writer.WriteObjectValue(ForecastSpend, options); + } + writer.WriteEndObject(); + } + + BudgetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetData(document.RootElement, options); + } + + internal static BudgetData DeserializeBudgetData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? eTag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + CategoryType? category = default; + float? amount = default; + TimeGrainType? timeGrain = default; + BudgetTimePeriod timePeriod = default; + BudgetFilter filter = default; + CurrentSpend currentSpend = default; + IDictionary notifications = default; + ForecastSpend forecastSpend = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerCostManagementContext.Default); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("category"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + category = new CategoryType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("amount"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + amount = property0.Value.GetSingle(); + continue; + } + if (property0.NameEquals("timeGrain"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeGrain = new TimeGrainType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("timePeriod"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timePeriod = BudgetTimePeriod.DeserializeBudgetTimePeriod(property0.Value, options); + continue; + } + if (property0.NameEquals("filter"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filter = BudgetFilter.DeserializeBudgetFilter(property0.Value, options); + continue; + } + if (property0.NameEquals("currentSpend"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + currentSpend = CurrentSpend.DeserializeCurrentSpend(property0.Value, options); + continue; + } + if (property0.NameEquals("notifications"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, Notification.DeserializeNotification(property1.Value, options)); + } + notifications = dictionary; + continue; + } + if (property0.NameEquals("forecastSpend"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forecastSpend = ForecastSpend.DeserializeForecastSpend(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BudgetData( + id, + name, + type, + systemData, + eTag, + category, + amount, + timeGrain, + timePeriod, + filter, + currentSpend, + notifications ?? new ChangeTrackingDictionary(), + forecastSpend, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(BudgetData)} does not support writing '{options.Format}' format."); + } + } + + BudgetData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBudgetData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BudgetData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetData.cs new file mode 100644 index 000000000000..87867a90ae84 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetData.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A class representing the Budget data model. + /// A budget resource. + /// + public partial class BudgetData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BudgetData() + { + Notifications = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// 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. + /// + /// The category of the budget. + /// - 'Cost' defines a Budget. + /// - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + /// + /// + /// The total amount of cost to track with the budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// Required for CategoryType(s): Cost. + /// + /// + /// The time covered by a budget. Tracking of the amount will be reset based on the time grain. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported timeGrainTypes for **CategoryType: Cost** + /// + /// - Monthly + /// - Quarterly + /// - Annually + /// - BillingMonth* + /// - BillingQuarter* + /// - BillingAnnual* + /// + /// *only supported for Web Direct customers. + /// + /// Supported timeGrainTypes for **CategoryType: ReservationUtilization** + /// - Last7Days + /// - Last30Days + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// May be used to filter budgets by user-specified dimensions and/or tags. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// The current amount of cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// + /// Dictionary of notifications associated with the budget. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// - Constraints for **CategoryType: Cost** - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications with thresholdType: Forecasted. + /// - Constraints for **CategoryType: ReservationUtilization** - Only one notification allowed. thresholdType is not applicable. + /// + /// + /// The forecasted cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// Keeps track of any properties unknown to the library. + internal BudgetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, CategoryType? category, float? amount, TimeGrainType? timeGrain, BudgetTimePeriod timePeriod, BudgetFilter filter, CurrentSpend currentSpend, IDictionary notifications, ForecastSpend forecastSpend, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = eTag; + Category = category; + Amount = amount; + TimeGrain = timeGrain; + TimePeriod = timePeriod; + Filter = filter; + CurrentSpend = currentSpend; + Notifications = notifications; + ForecastSpend = forecastSpend; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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. + public ETag? ETag { get; set; } + /// + /// The category of the budget. + /// - 'Cost' defines a Budget. + /// - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + /// + public CategoryType? Category { get; set; } + /// + /// The total amount of cost to track with the budget. + /// + /// Supported for CategoryType(s): Cost. + /// + /// Required for CategoryType(s): Cost. + /// + public float? Amount { get; set; } + /// + /// The time covered by a budget. Tracking of the amount will be reset based on the time grain. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported timeGrainTypes for **CategoryType: Cost** + /// + /// - Monthly + /// - Quarterly + /// - Annually + /// - BillingMonth* + /// - BillingQuarter* + /// - BillingAnnual* + /// + /// *only supported for Web Direct customers. + /// + /// Supported timeGrainTypes for **CategoryType: ReservationUtilization** + /// - Last7Days + /// - Last30Days + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + public TimeGrainType? TimeGrain { get; set; } + /// + /// The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + public BudgetTimePeriod TimePeriod { get; set; } + /// + /// May be used to filter budgets by user-specified dimensions and/or tags. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public BudgetFilter Filter { get; set; } + /// + /// The current amount of cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + public CurrentSpend CurrentSpend { get; } + /// + /// Dictionary of notifications associated with the budget. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// - Constraints for **CategoryType: Cost** - Budget can have up to 5 notifications with thresholdType: Actual and 5 notifications with thresholdType: Forecasted. + /// - Constraints for **CategoryType: ReservationUtilization** - Only one notification allowed. thresholdType is not applicable. + /// + public IDictionary Notifications { get; } + /// + /// The forecasted cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + public ForecastSpend ForecastSpend { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetResource.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetResource.Serialization.cs new file mode 100644 index 000000000000..cf5b568788a6 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetResource.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CostManagement +{ + public partial class BudgetResource : IJsonModel + { + private static BudgetData s_dataDeserializationInstance; + private static BudgetData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + BudgetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerCostManagementContext.Default); + + BudgetData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerCostManagementContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetResource.cs new file mode 100644 index 000000000000..412f2fbf6e79 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/BudgetResource.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A Class representing a Budget along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetBudgetResource method. + /// Otherwise you can get one from its parent resource using the GetBudget method. + /// + public partial class BudgetResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The scope. + /// The budgetName. + public static ResourceIdentifier CreateResourceIdentifier(string scope, string budgetName) + { + var resourceId = $"{scope}/providers/Microsoft.CostManagement/budgets/{budgetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _budgetClientDiagnostics; + private readonly BudgetsRestOperations _budgetRestClient; + private readonly BudgetData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CostManagement/budgets"; + + /// Initializes a new instance of the class for mocking. + protected BudgetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BudgetResource(ArmClient client, BudgetData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BudgetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _budgetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CostManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string budgetApiVersion); + _budgetRestClient = new BudgetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, budgetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual BudgetData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _budgetClientDiagnostics.CreateScope("BudgetResource.Get"); + scope.Start(); + try + { + var response = await _budgetRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the budget for the scope by budget name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _budgetClientDiagnostics.CreateScope("BudgetResource.Get"); + scope.Start(); + try + { + var response = _budgetRestClient.Get(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BudgetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to delete a budget. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _budgetClientDiagnostics.CreateScope("BudgetResource.Delete"); + scope.Start(); + try + { + var response = await _budgetRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _budgetRestClient.CreateDeleteRequestUri(Id.Parent, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to delete a budget. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _budgetClientDiagnostics.CreateScope("BudgetResource.Delete"); + scope.Start(); + try + { + var response = _budgetRestClient.Delete(Id.Parent, Id.Name, cancellationToken); + var uri = _budgetRestClient.CreateDeleteRequestUri(Id.Parent, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the Create Budget operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BudgetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetResource.Update"); + scope.Start(); + try + { + var response = await _budgetRestClient.CreateOrUpdateAsync(Id.Parent, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _budgetRestClient.CreateCreateOrUpdateRequestUri(Id.Parent, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new BudgetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} + /// + /// + /// Operation Id + /// Budgets_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the Create Budget operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BudgetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _budgetClientDiagnostics.CreateScope("BudgetResource.Update"); + scope.Start(); + try + { + var response = _budgetRestClient.CreateOrUpdate(Id.Parent, Id.Name, data, cancellationToken); + var uri = _budgetRestClient.CreateCreateOrUpdateRequestUri(Id.Parent, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new BudgetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionCollection.cs new file mode 100644 index 000000000000..f1df916515e5 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionCollection.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetCostAllocationRuleDefinitions method from an instance of . + /// + public partial class CostAllocationRuleDefinitionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics; + private readonly CostAllocationRulesRestOperations _costAllocationRuleDefinitionCostAllocationRulesRestClient; + private readonly string _billingAccountId; + + /// Initializes a new instance of the class for mocking. + protected CostAllocationRuleDefinitionCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + /// BillingAccount ID. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal CostAllocationRuleDefinitionCollection(ArmClient client, ResourceIdentifier id, string billingAccountId) : base(client, id) + { + _billingAccountId = billingAccountId; + _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CostManagement", CostAllocationRuleDefinitionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(CostAllocationRuleDefinitionResource.ResourceType, out string costAllocationRuleDefinitionCostAllocationRulesApiVersion); + _costAllocationRuleDefinitionCostAllocationRulesRestClient = new CostAllocationRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, costAllocationRuleDefinitionCostAllocationRulesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != TenantResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, TenantResource.ResourceType), nameof(id)); + } + + /// + /// Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string ruleName, CostAllocationRuleDefinitionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateOrUpdateAsync(_billingAccountId, ruleName, data, cancellationToken).ConfigureAwait(false); + var uri = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateCreateOrUpdateRequestUri(_billingAccountId, ruleName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string ruleName, CostAllocationRuleDefinitionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateOrUpdate(_billingAccountId, ruleName, data, cancellationToken); + var uri = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateCreateOrUpdateRequestUri(_billingAccountId, ruleName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.Get"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.GetAsync(_billingAccountId, ruleName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.Get"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.Get(_billingAccountId, ruleName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the list of all cost allocation rules for a billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules + /// + /// + /// Operation Id + /// CostAllocationRules_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateListRequest(_billingAccountId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateListNextPageRequest(nextLink, _billingAccountId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CostAllocationRuleDefinitionResource(Client, CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(e)), _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics, Pipeline, "CostAllocationRuleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the list of all cost allocation rules for a billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules + /// + /// + /// Operation Id + /// CostAllocationRules_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateListRequest(_billingAccountId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateListNextPageRequest(nextLink, _billingAccountId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CostAllocationRuleDefinitionResource(Client, CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(e)), _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics, Pipeline, "CostAllocationRuleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.Exists"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.GetAsync(_billingAccountId, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.Exists"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.Get(_billingAccountId, ruleName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.GetAsync(_billingAccountId, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.Get(_billingAccountId, ruleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionData.Serialization.cs new file mode 100644 index 000000000000..1e69fdaa89d9 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionData.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement +{ + public partial class CostAllocationRuleDefinitionData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleDefinitionData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + CostAllocationRuleDefinitionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleDefinitionData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationRuleDefinitionData(document.RootElement, options); + } + + internal static CostAllocationRuleDefinitionData DeserializeCostAllocationRuleDefinitionData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CostAllocationRuleProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = CostAllocationRuleProperties.DeserializeCostAllocationRuleProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerCostManagementContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationRuleDefinitionData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationRuleDefinitionData)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationRuleDefinitionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationRuleDefinitionData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationRuleDefinitionData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionData.cs new file mode 100644 index 000000000000..d82396134494 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A class representing the CostAllocationRuleDefinition data model. + /// The cost allocation rule model definition + /// + public partial class CostAllocationRuleDefinitionData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CostAllocationRuleDefinitionData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Cost allocation rule properties. + /// Keeps track of any properties unknown to the library. + internal CostAllocationRuleDefinitionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CostAllocationRuleProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Cost allocation rule properties. + public CostAllocationRuleProperties Properties { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionResource.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionResource.Serialization.cs new file mode 100644 index 000000000000..e65ed004fbf3 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionResource.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CostManagement +{ + public partial class CostAllocationRuleDefinitionResource : IJsonModel + { + private static CostAllocationRuleDefinitionData s_dataDeserializationInstance; + private static CostAllocationRuleDefinitionData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + CostAllocationRuleDefinitionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerCostManagementContext.Default); + + CostAllocationRuleDefinitionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerCostManagementContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionResource.cs new file mode 100644 index 000000000000..4e2f53599de0 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostAllocationRuleDefinitionResource.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A Class representing a CostAllocationRuleDefinition along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetCostAllocationRuleDefinitionResource method. + /// Otherwise you can get one from its parent resource using the GetCostAllocationRuleDefinition method. + /// + public partial class CostAllocationRuleDefinitionResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The billingAccountId. + /// The ruleName. + public static ResourceIdentifier CreateResourceIdentifier(string billingAccountId, string ruleName) + { + var resourceId = $"/providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics; + private readonly CostAllocationRulesRestOperations _costAllocationRuleDefinitionCostAllocationRulesRestClient; + private readonly CostAllocationRuleDefinitionData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CostManagement/costAllocationRules"; + + /// Initializes a new instance of the class for mocking. + protected CostAllocationRuleDefinitionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal CostAllocationRuleDefinitionResource(ArmClient client, CostAllocationRuleDefinitionData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal CostAllocationRuleDefinitionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CostManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string costAllocationRuleDefinitionCostAllocationRulesApiVersion); + _costAllocationRuleDefinitionCostAllocationRulesRestClient = new CostAllocationRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, costAllocationRuleDefinitionCostAllocationRulesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual CostAllocationRuleDefinitionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionResource.Get"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.GetAsync(Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionResource.Get"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.Get(Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete cost allocation rule for billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionResource.Delete"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.DeleteAsync(Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateDeleteRequestUri(Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete cost allocation rule for billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionResource.Delete"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.Delete(Id.Parent.Name, Id.Name, cancellationToken); + var uri = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateDeleteRequestUri(Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, CostAllocationRuleDefinitionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionResource.Update"); + scope.Start(); + try + { + var response = await _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateOrUpdateAsync(Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateCreateOrUpdateRequestUri(Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, CostAllocationRuleDefinitionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("CostAllocationRuleDefinitionResource.Update"); + scope.Start(); + try + { + var response = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateOrUpdate(Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _costAllocationRuleDefinitionCostAllocationRulesRestClient.CreateCreateOrUpdateRequestUri(Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new CostAllocationRuleDefinitionResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs index a80c010a3be2..96cd7143bc30 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertCollection.cs @@ -54,7 +54,7 @@ internal CostManagementAlertCollection(ArmClient client, ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -98,7 +98,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual Response Get(string alertId, Cancell /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -171,7 +171,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -200,7 +200,7 @@ public virtual Pageable GetAll(CancellationToken ca /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -242,7 +242,7 @@ public virtual async Task> ExistsAsync(string alertId, Cancellati /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -284,7 +284,7 @@ public virtual Response Exists(string alertId, CancellationToken cancellat /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -328,7 +328,7 @@ public virtual async Task> GetIfEx /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.Serialization.cs index c5d35c8e94d1..8caa1a214482 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.Serialization.cs @@ -286,6 +286,7 @@ internal static CostManagementAlertData DeserializeCostManagementAlertData(JsonE name, type, systemData, + eTag, definition, description, source, @@ -297,7 +298,6 @@ internal static CostManagementAlertData DeserializeCostManagementAlertData(JsonE modificationTime, statusModificationUserName, statusModificationTime, - eTag, serializedAdditionalRawData); } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs index a59cc76dc89b..73216024f546 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertData.cs @@ -61,6 +61,7 @@ public CostManagementAlertData() /// The name. /// The resourceType. /// The systemData. + /// 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. /// defines the type of alert. /// Alert description. /// Source of alert. @@ -72,10 +73,10 @@ public CostManagementAlertData() /// dateTime in which alert was last modified. /// User who last modified the alert. /// dateTime in which the alert status was last modified. - /// 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. /// Keeps track of any properties unknown to the library. - internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AlertPropertiesDefinition definition, string description, CostManagementAlertSource? source, AlertPropertiesDetails details, string costEntityId, CostManagementAlertStatus? status, DateTimeOffset? createdOn, DateTimeOffset? closeOn, DateTimeOffset? modifiedOn, string statusModificationUserName, DateTimeOffset? statusModifiedOn, ETag? eTag, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, AlertPropertiesDefinition definition, string description, CostManagementAlertSource? source, AlertPropertiesDetails details, string costEntityId, CostManagementAlertStatus? status, DateTimeOffset? createdOn, DateTimeOffset? closeOn, DateTimeOffset? modifiedOn, string statusModificationUserName, DateTimeOffset? statusModifiedOn, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + ETag = eTag; Definition = definition; Description = description; Source = source; @@ -87,10 +88,11 @@ internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceTyp ModifiedOn = modifiedOn; StatusModificationUserName = statusModificationUserName; StatusModifiedOn = statusModifiedOn; - ETag = eTag; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// 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. + public ETag? ETag { get; set; } /// defines the type of alert. public AlertPropertiesDefinition Definition { get; set; } /// Alert description. @@ -113,7 +115,5 @@ internal CostManagementAlertData(ResourceIdentifier id, string name, ResourceTyp public string StatusModificationUserName { get; set; } /// dateTime in which the alert status was last modified. public DateTimeOffset? StatusModifiedOn { get; set; } - /// 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. - public ETag? ETag { get; set; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs index 98df91947cea..282b2ec92f09 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementAlertResource.cs @@ -100,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetAsync(Cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -180,7 +180,7 @@ public virtual Response Get(CancellationToken cance /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -222,7 +222,7 @@ public virtual async Task> UpdateAsync(Cos /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs index 143743c49def..c5bfd696fbae 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportCollection.cs @@ -54,7 +54,7 @@ internal CostManagementExportCollection(ArmClient client, ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -105,7 +105,7 @@ public virtual async Task> CreateOrUp /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -156,7 +156,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -202,7 +202,7 @@ public virtual async Task> GetAsync(strin /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -248,7 +248,7 @@ public virtual Response Get(string exportName, str /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -278,7 +278,7 @@ public virtual AsyncPageable GetAllAsync(string ex /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -308,7 +308,7 @@ public virtual Pageable GetAll(string expand = nul /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -352,7 +352,7 @@ public virtual async Task> ExistsAsync(string exportName, string /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -396,7 +396,7 @@ public virtual Response Exists(string exportName, string expand = null, Ca /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -442,7 +442,7 @@ public virtual async Task> GetIfE /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.Serialization.cs index 860c981367e4..958be8b50dd3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.Serialization.cs @@ -38,6 +38,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, options); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } if (Optional.IsDefined(ETag)) { writer.WritePropertyName("eTag"u8); @@ -70,11 +80,31 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("partitionData"u8); writer.WriteBooleanValue(PartitionData.Value); } + if (Optional.IsDefined(DataOverwriteBehavior)) + { + writer.WritePropertyName("dataOverwriteBehavior"u8); + writer.WriteStringValue(DataOverwriteBehavior.Value.ToString()); + } + if (Optional.IsDefined(CompressionMode)) + { + writer.WritePropertyName("compressionMode"u8); + writer.WriteStringValue(CompressionMode.Value.ToString()); + } + if (Optional.IsDefined(ExportDescription)) + { + writer.WritePropertyName("exportDescription"u8); + writer.WriteStringValue(ExportDescription); + } if (options.Format != "W" && Optional.IsDefined(NextRunTimeEstimate)) { writer.WritePropertyName("nextRunTimeEstimate"u8); writer.WriteStringValue(NextRunTimeEstimate.Value, "O"); } + if (options.Format != "W" && Optional.IsDefined(SystemSuspensionContext)) + { + writer.WritePropertyName("systemSuspensionContext"u8); + writer.WriteObjectValue(SystemSuspensionContext, options); + } if (Optional.IsDefined(Schedule)) { writer.WritePropertyName("schedule"u8); @@ -103,6 +133,8 @@ internal static CostManagementExportData DeserializeCostManagementExportData(Jso { return null; } + ManagedServiceIdentity identity = default; + AzureLocation? location = default; ETag? eTag = default; ResourceIdentifier id = default; string name = default; @@ -113,12 +145,34 @@ internal static CostManagementExportData DeserializeCostManagementExportData(Jso ExportDefinition definition = default; ExportExecutionListResult runHistory = default; bool? partitionData = default; + DataOverwriteBehaviorType? dataOverwriteBehavior = default; + CompressionModeType? compressionMode = default; + string exportDescription = default; DateTimeOffset? nextRunTimeEstimate = default; + ExportSuspensionContext systemSuspensionContext = default; ExportSchedule schedule = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerCostManagementContext.Default); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } if (property.NameEquals("eTag"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -206,6 +260,29 @@ internal static CostManagementExportData DeserializeCostManagementExportData(Jso partitionData = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("dataOverwriteBehavior"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataOverwriteBehavior = new DataOverwriteBehaviorType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("compressionMode"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + compressionMode = new CompressionModeType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("exportDescription"u8)) + { + exportDescription = property0.Value.GetString(); + continue; + } if (property0.NameEquals("nextRunTimeEstimate"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -215,6 +292,15 @@ internal static CostManagementExportData DeserializeCostManagementExportData(Jso nextRunTimeEstimate = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("systemSuspensionContext"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemSuspensionContext = ExportSuspensionContext.DeserializeExportSuspensionContext(property0.Value, options); + continue; + } if (property0.NameEquals("schedule"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -238,14 +324,20 @@ internal static CostManagementExportData DeserializeCostManagementExportData(Jso name, type, systemData, + identity, + location, + eTag, format, deliveryInfo, definition, runHistory, partitionData, + dataOverwriteBehavior, + compressionMode, + exportDescription, nextRunTimeEstimate, + systemSuspensionContext, schedule, - eTag, serializedAdditionalRawData); } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs index 7276d23353b5..07f145ef7d6b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportData.cs @@ -61,29 +61,47 @@ public CostManagementExportData() /// The name. /// The resourceType. /// The systemData. - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The managed identity associated with Export. Current supported identity types: None, SystemAssigned. + /// The location of the Export's managed identity. Only required when utilizing managed identity. + /// 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. + /// The format of the export being delivered. /// Has delivery information for the export. /// Has the definition for the export. /// If requested, has the most recent run history for the export. - /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + /// The export description set by customer at time of export creation/update. /// If the export has an active schedule, provides an estimate of the next run time. + /// The export suspension reason if export is in SystemSuspended state. This is not populated currently. /// Has schedule information for the export. - /// 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. /// Keeps track of any properties unknown to the library. - internal CostManagementExportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DateTimeOffset? nextRunTimeEstimate, ExportSchedule schedule, ETag? eTag, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CostManagementExportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, AzureLocation? location, ETag? eTag, ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DataOverwriteBehaviorType? dataOverwriteBehavior, CompressionModeType? compressionMode, string exportDescription, DateTimeOffset? nextRunTimeEstimate, ExportSuspensionContext systemSuspensionContext, ExportSchedule schedule, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + Identity = identity; + Location = location; + ETag = eTag; Format = format; DeliveryInfo = deliveryInfo; Definition = definition; RunHistory = runHistory; PartitionData = partitionData; + DataOverwriteBehavior = dataOverwriteBehavior; + CompressionMode = compressionMode; + ExportDescription = exportDescription; NextRunTimeEstimate = nextRunTimeEstimate; + SystemSuspensionContext = systemSuspensionContext; Schedule = schedule; - ETag = eTag; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The managed identity associated with Export. Current supported identity types: None, SystemAssigned. + public ManagedServiceIdentity Identity { get; set; } + /// The location of the Export's managed identity. Only required when utilizing managed identity. + public AzureLocation? Location { get; set; } + /// 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. + public ETag? ETag { get; set; } + /// The format of the export being delivered. public ExportFormatType? Format { get; set; } /// Has delivery information for the export. internal ExportDeliveryInfo DeliveryInfo { get; set; } @@ -109,13 +127,19 @@ public IReadOnlyList RunHistoryValue } } - /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. public bool? PartitionData { get; set; } + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + public DataOverwriteBehaviorType? DataOverwriteBehavior { get; set; } + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + public CompressionModeType? CompressionMode { get; set; } + /// The export description set by customer at time of export creation/update. + public string ExportDescription { get; set; } /// If the export has an active schedule, provides an estimate of the next run time. public DateTimeOffset? NextRunTimeEstimate { get; } + /// The export suspension reason if export is in SystemSuspended state. This is not populated currently. + public ExportSuspensionContext SystemSuspensionContext { get; } /// Has schedule information for the export. public ExportSchedule Schedule { get; set; } - /// 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. - public ETag? ETag { get; set; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs index d95db81fa6de..7a8d13523968 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementExportResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(strin /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(string expand = null, /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -227,7 +227,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -271,7 +271,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -319,7 +319,7 @@ public virtual async Task> UpdateAsyn /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -367,7 +367,7 @@ public virtual ArmOperation Update(WaitUntil waitU /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -375,14 +375,15 @@ public virtual ArmOperation Update(WaitUntil waitU /// /// /// + /// Parameters supplied to the Execute Export operation. /// The cancellation token to use. - public virtual async Task ExecuteAsync(CancellationToken cancellationToken = default) + public virtual async Task ExecuteAsync(ExportRunContent content = null, CancellationToken cancellationToken = default) { using var scope = _costManagementExportExportsClientDiagnostics.CreateScope("CostManagementExportResource.Execute"); scope.Start(); try { - var response = await _costManagementExportExportsRestClient.ExecuteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _costManagementExportExportsRestClient.ExecuteAsync(Id.Parent, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -405,7 +406,7 @@ public virtual async Task ExecuteAsync(CancellationToken cancellationT /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -413,14 +414,15 @@ public virtual async Task ExecuteAsync(CancellationToken cancellationT /// /// /// + /// Parameters supplied to the Execute Export operation. /// The cancellation token to use. - public virtual Response Execute(CancellationToken cancellationToken = default) + public virtual Response Execute(ExportRunContent content = null, CancellationToken cancellationToken = default) { using var scope = _costManagementExportExportsClientDiagnostics.CreateScope("CostManagementExportResource.Execute"); scope.Start(); try { - var response = _costManagementExportExportsRestClient.Execute(Id.Parent, Id.Name, cancellationToken); + var response = _costManagementExportExportsRestClient.Execute(Id.Parent, Id.Name, content, cancellationToken); return response; } catch (Exception e) @@ -443,7 +445,7 @@ public virtual Response Execute(CancellationToken cancellationToken = default) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -472,7 +474,7 @@ public virtual AsyncPageable GetExecutionHistoryAsync(CancellationTok /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.Serialization.cs index 44b4d423d8e7..4720d3dfc4c3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.Serialization.cs @@ -60,12 +60,12 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("createdOn"u8); writer.WriteStringValue(CreatedOn.Value, "O"); } - if (options.Format != "W" && Optional.IsDefined(ModifiedOn)) + if (Optional.IsDefined(ModifiedOn)) { writer.WritePropertyName("modifiedOn"u8); writer.WriteStringValue(ModifiedOn.Value, "O"); } - if (options.Format != "W" && Optional.IsDefined(DateRange)) + if (Optional.IsDefined(DateRange)) { writer.WritePropertyName("dateRange"u8); writer.WriteStringValue(DateRange); @@ -396,6 +396,7 @@ internal static CostManagementViewData DeserializeCostManagementViewData(JsonEle name, type, systemData, + eTag, displayName, scope, createdOn, @@ -412,7 +413,6 @@ internal static CostManagementViewData DeserializeCostManagementViewData(JsonEle timePeriod, dataSet, includeMonetaryCommitment, - eTag, serializedAdditionalRawData); } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs index 4f6b866af8ff..be473f2f686d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewData.cs @@ -63,6 +63,7 @@ public CostManagementViewData() /// The name. /// The resourceType. /// The systemData. + /// 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. /// User input name of the view. Required. /// Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. /// Date the user created this view. @@ -79,10 +80,10 @@ public CostManagementViewData() /// Has time period for pulling data for the report. /// Has definition for data in this report config. /// If true, report includes monetary commitment. - /// 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. /// Keeps track of any properties unknown to the library. - internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, ResourceIdentifier scope, DateTimeOffset? createdOn, DateTimeOffset? modifiedOn, string dateRange, string currency, ViewChartType? chart, AccumulatedType? accumulated, ViewMetricType? metric, IList kpis, IList pivots, ViewReportType? typePropertiesQueryType, ReportTimeframeType? timeframe, ReportConfigTimePeriod timePeriod, ReportConfigDataset dataSet, bool? includeMonetaryCommitment, ETag? eTag, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, string displayName, ResourceIdentifier scope, DateTimeOffset? createdOn, DateTimeOffset? modifiedOn, string dateRange, string currency, ViewChartType? chart, AccumulatedType? accumulated, ViewMetricType? metric, IList kpis, IList pivots, ViewReportType? typePropertiesQueryType, ReportTimeframeType? timeframe, ReportConfigTimePeriod timePeriod, ReportConfigDataset dataSet, bool? includeMonetaryCommitment, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + ETag = eTag; DisplayName = displayName; Scope = scope; CreatedOn = createdOn; @@ -99,10 +100,11 @@ internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType TimePeriod = timePeriod; DataSet = dataSet; IncludeMonetaryCommitment = includeMonetaryCommitment; - ETag = eTag; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// 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. + public ETag? ETag { get; set; } /// User input name of the view. Required. public string DisplayName { get; set; } /// Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. @@ -110,9 +112,9 @@ internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType /// Date the user created this view. public DateTimeOffset? CreatedOn { get; } /// Date when the user last modified this view. - public DateTimeOffset? ModifiedOn { get; } + public DateTimeOffset? ModifiedOn { get; set; } /// Date range of the current view. - public string DateRange { get; } + public string DateRange { get; set; } /// Currency of the current view. public string Currency { get; } /// Chart type of the main view in Cost Analysis. Required. @@ -135,7 +137,5 @@ internal CostManagementViewData(ResourceIdentifier id, string name, ResourceType public ReportConfigDataset DataSet { get; set; } /// If true, report includes monetary commitment. public bool? IncludeMonetaryCommitment { get; set; } - /// 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. - public ETag? ETag { get; set; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs index 397bfbe5da8e..4bb9acafe0e7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsCollection.cs @@ -54,7 +54,7 @@ internal CostManagementViewsCollection(ArmClient client, ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -105,7 +105,7 @@ public virtual async Task> CreateOrUpd /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -156,7 +156,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUnti /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -201,7 +201,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -246,7 +246,7 @@ public virtual Response Get(string viewName, Cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -276,7 +276,7 @@ public virtual AsyncPageable GetAllAsync(Cancellati /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -306,7 +306,7 @@ public virtual Pageable GetAll(CancellationToken ca /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -349,7 +349,7 @@ public virtual async Task> ExistsAsync(string viewName, Cancellat /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -392,7 +392,7 @@ public virtual Response Exists(string viewName, CancellationToken cancella /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -437,7 +437,7 @@ public virtual async Task> GetIfEx /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs index 68589ae59e6b..afeb097518b2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/CostManagementViewsResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -179,7 +179,7 @@ public virtual Response Get(CancellationToken cance /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -315,7 +315,7 @@ public virtual async Task> UpdateAsync /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs index 3ece39770f65..012dd1f6331d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/CostManagementExtensions.cs @@ -29,663 +29,647 @@ private static MockableCostManagementTenantResource GetMockableCostManagementTen } /// - /// Gets a collection of CostManagementExportResources in the ArmClient. + /// Gets a collection of CostManagementAlertResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// is null. - /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. - public static CostManagementExportCollection GetCostManagementExports(this ArmClient client, ResourceIdentifier scope) + /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. + public static CostManagementAlertCollection GetCostManagementAlerts(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementExports(scope); + return GetMockableCostManagementArmClient(client).GetCostManagementAlerts(scope); } /// - /// The operation to get the export for the defined scope by export name. + /// Gets the alert for the scope by alert ID. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} /// /// /// Operation Id - /// Exports_Get + /// Alerts_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Export Name. - /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// Alert ID. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. [ForwardsClientCalls] - public static async Task> GetCostManagementExportAsync(this ArmClient client, ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) + public static async Task> GetCostManagementAlertAsync(this ArmClient client, ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableCostManagementArmClient(client).GetCostManagementExportAsync(scope, exportName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetCostManagementAlertAsync(scope, alertId, cancellationToken).ConfigureAwait(false); } /// - /// The operation to get the export for the defined scope by export name. + /// Gets the alert for the scope by alert ID. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} /// /// /// Operation Id - /// Exports_Get + /// Alerts_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Export Name. - /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// Alert ID. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. [ForwardsClientCalls] - public static Response GetCostManagementExport(this ArmClient client, ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) + public static Response GetCostManagementAlert(this ArmClient client, ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementExport(scope, exportName, expand, cancellationToken); + return GetMockableCostManagementArmClient(client).GetCostManagementAlert(scope, alertId, cancellationToken); } /// - /// Gets a collection of CostManagementViewsResources in the ArmClient. + /// Gets a collection of BudgetResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// is null. - /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. - public static CostManagementViewsCollection GetAllCostManagementViews(this ArmClient client, ResourceIdentifier scope) + /// An object representing collection of BudgetResources and their operations over a BudgetResource. + public static BudgetCollection GetBudgets(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetAllCostManagementViews(scope); + return GetMockableCostManagementArmClient(client).GetBudgets(scope); } /// - /// Gets the view for the defined scope by view name. + /// Gets the budget for the scope by budget name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} /// /// /// Operation Id - /// Views_GetByScope + /// Budgets_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// View name. + /// Budget Name. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetCostManagementViewsAsync(this ArmClient client, ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + public static async Task> GetBudgetAsync(this ArmClient client, ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableCostManagementArmClient(client).GetCostManagementViewsAsync(scope, viewName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetBudgetAsync(scope, budgetName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the view for the defined scope by view name. + /// Gets the budget for the scope by budget name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} /// /// /// Operation Id - /// Views_GetByScope + /// Budgets_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// View name. + /// Budget Name. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetCostManagementViews(this ArmClient client, ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + public static Response GetBudget(this ArmClient client, ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementViews(scope, viewName, cancellationToken); + return GetMockableCostManagementArmClient(client).GetBudget(scope, budgetName, cancellationToken); } /// - /// Gets a collection of CostManagementAlertResources in the ArmClient. + /// Gets a collection of ScheduledActionResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// is null. - /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. - public static CostManagementAlertCollection GetCostManagementAlerts(this ArmClient client, ResourceIdentifier scope) + /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. + public static ScheduledActionCollection GetScheduledActions(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementAlerts(scope); + return GetMockableCostManagementArmClient(client).GetScheduledActions(scope); } /// - /// Gets the alert for the scope by alert ID. + /// Get the shared scheduled action from the given scope by name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} /// /// /// Operation Id - /// Alerts_Get + /// ScheduledActions_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Alert ID. + /// Scheduled action name. /// The cancellation token to use. - /// or is null. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetCostManagementAlertAsync(this ArmClient client, ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) + public static async Task> GetScheduledActionAsync(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableCostManagementArmClient(client).GetCostManagementAlertAsync(scope, alertId, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetScheduledActionAsync(scope, name, cancellationToken).ConfigureAwait(false); } /// - /// Gets the alert for the scope by alert ID. + /// Get the shared scheduled action from the given scope by name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} /// /// /// Operation Id - /// Alerts_Get + /// ScheduledActions_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Alert ID. + /// Scheduled action name. /// The cancellation token to use. - /// or is null. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetCostManagementAlert(this ArmClient client, ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) + public static Response GetScheduledAction(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementAlert(scope, alertId, cancellationToken); + return GetMockableCostManagementArmClient(client).GetScheduledAction(scope, name, cancellationToken); } /// - /// Gets a collection of ScheduledActionResources in the ArmClient. + /// Gets a collection of CostManagementExportResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// is null. - /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. - public static ScheduledActionCollection GetScheduledActions(this ArmClient client, ResourceIdentifier scope) + /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. + public static CostManagementExportCollection GetCostManagementExports(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetScheduledActions(scope); + return GetMockableCostManagementArmClient(client).GetCostManagementExports(scope); } /// - /// Get the shared scheduled action from the given scope by name. + /// The operation to get the export for the defined scope by export name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} /// /// /// Operation Id - /// ScheduledActions_GetByScope + /// Exports_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Scheduled action name. + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetScheduledActionAsync(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + public static async Task> GetCostManagementExportAsync(this ArmClient client, ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableCostManagementArmClient(client).GetScheduledActionAsync(scope, name, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementArmClient(client).GetCostManagementExportAsync(scope, exportName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Get the shared scheduled action from the given scope by name. + /// The operation to get the export for the defined scope by export name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} /// /// /// Operation Id - /// ScheduledActions_GetByScope + /// Exports_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Scheduled action name. + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetScheduledAction(this ArmClient client, ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + public static Response GetCostManagementExport(this ArmClient client, ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetScheduledAction(scope, name, cancellationToken); + return GetMockableCostManagementArmClient(client).GetCostManagementExport(scope, exportName, expand, cancellationToken); } /// - /// List of recommendations for purchasing savings plan. - /// - /// - /// Request Path - /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations - /// - /// - /// Operation Id - /// BenefitRecommendations_List - /// - /// - /// Default Api Version - /// 2023-03-01 - /// - /// + /// Gets a collection of SettingResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. - /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. - /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. - /// The cancellation token to use. /// is null. - public static AsyncPageable GetBenefitRecommendationsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) + /// An object representing collection of SettingResources and their operations over a SettingResource. + public static SettingCollection GetSettings(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetBenefitRecommendationsAsync(scope, filter, orderby, expand, cancellationToken); + return GetMockableCostManagementArmClient(client).GetSettings(scope); } /// - /// List of recommendations for purchasing savings plan. + /// Get the setting from the given scope by name. /// /// /// Request Path - /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} /// /// /// Operation Id - /// BenefitRecommendations_List + /// Settings_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. - /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. - /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. + /// Setting type. /// The cancellation token to use. /// is null. - public static Pageable GetBenefitRecommendations(this ArmClient client, ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) + [ForwardsClientCalls] + public static async Task> GetSettingAsync(this ArmClient client, ResourceIdentifier scope, SettingType type, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetBenefitRecommendations(scope, filter, orderby, expand, cancellationToken); + return await GetMockableCostManagementArmClient(client).GetSettingAsync(scope, type, cancellationToken).ConfigureAwait(false); } /// - /// Lists the forecast charges for scope defined. + /// Get the setting from the given scope by name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/forecast + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} /// /// /// Operation Id - /// Forecast_Usage + /// Settings_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// Setting type. /// The cancellation token to use. - /// or is null. - public static async Task> UsageForecastAsync(this ArmClient client, ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// is null. + [ForwardsClientCalls] + public static Response GetSetting(this ArmClient client, ResourceIdentifier scope, SettingType type, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableCostManagementArmClient(client).UsageForecastAsync(scope, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementArmClient(client).GetSetting(scope, type, cancellationToken); } /// - /// Lists the forecast charges for scope defined. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/forecast - /// - /// - /// Operation Id - /// Forecast_Usage - /// - /// - /// Default Api Version - /// 2023-03-01 - /// - /// + /// Gets a collection of CostManagementViewsResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// The cancellation token to use. - /// or is null. - public static Response UsageForecast(this ArmClient client, ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// is null. + /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. + public static CostManagementViewsCollection GetAllCostManagementViews(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).UsageForecast(scope, forecastDefinition, filter, cancellationToken); + return GetMockableCostManagementArmClient(client).GetAllCostManagementViews(scope); } /// - /// Lists the dimensions by the defined scope. + /// Gets the view for the defined scope by view name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/dimensions + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} /// /// /// Operation Id - /// Dimensions_List + /// Views_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. - /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - /// 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. - /// May be used to limit the number of results to the most recent N dimension data. + /// View name. /// The cancellation token to use. - /// is null. - public static AsyncPageable GetDimensionsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetCostManagementViewsAsync(this ArmClient client, ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetDimensionsAsync(scope, filter, expand, skiptoken, top, cancellationToken); + return await GetMockableCostManagementArmClient(client).GetCostManagementViewsAsync(scope, viewName, cancellationToken).ConfigureAwait(false); } /// - /// Lists the dimensions by the defined scope. + /// Gets the view for the defined scope by view name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/dimensions + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} /// /// /// Operation Id - /// Dimensions_List + /// Views_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. - /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. - /// 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. - /// May be used to limit the number of results to the most recent N dimension data. + /// View name. /// The cancellation token to use. - /// is null. - public static Pageable GetDimensions(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetCostManagementViews(this ArmClient client, ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetDimensions(scope, filter, expand, skiptoken, top, cancellationToken); + return GetMockableCostManagementArmClient(client).GetCostManagementViews(scope, viewName, cancellationToken); } /// - /// Query the usage data for scope defined. + /// List of recommendations for purchasing savings plan. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/query + /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations /// /// /// Operation Id - /// Query_Usage + /// BenefitRecommendations_List /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. + /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. + /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. /// The cancellation token to use. - /// or is null. - public static async Task> UsageQueryAsync(this ArmClient client, ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// is null. + public static AsyncPageable GetBenefitRecommendationsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableCostManagementArmClient(client).UsageQueryAsync(scope, queryDefinition, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementArmClient(client).GetBenefitRecommendationsAsync(scope, filter, orderby, expand, cancellationToken); } /// - /// Query the usage data for scope defined. + /// List of recommendations for purchasing savings plan. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/query + /// /{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations /// /// /// Operation Id - /// Query_Usage + /// BenefitRecommendations_List /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// Can be used to filter benefitRecommendations by: properties/scope with allowed values ['Single', 'Shared'] and default value 'Shared'; and properties/lookBackPeriod with allowed values ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last60Days'; properties/term with allowed values ['P1Y', 'P3Y'] and default value 'P3Y'; properties/subscriptionId; properties/resourceGroup. + /// May be used to order the recommendations by: properties/armSkuName. For the savings plan, the results are in order by default. There is no need to use this clause. + /// May be used to expand the properties by: properties/usage, properties/allRecommendationDetails. /// The cancellation token to use. - /// or is null. - public static Response UsageQuery(this ArmClient client, ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// is null. + public static Pageable GetBenefitRecommendations(this ArmClient client, ResourceIdentifier scope, string filter = null, string orderby = null, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).UsageQuery(scope, queryDefinition, cancellationToken); + return GetMockableCostManagementArmClient(client).GetBenefitRecommendations(scope, filter, orderby, expand, cancellationToken); } /// @@ -701,7 +685,7 @@ public static Response UsageQuery(this ArmClient client, ResourceId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// @@ -734,7 +718,7 @@ public static async Task> CheckCo /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// @@ -755,119 +739,475 @@ public static Response CheckCostManagement } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Lists the dimensions by the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/dimensions + /// + /// + /// Operation Id + /// Dimensions_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. + /// The scope that the resource will apply against. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// 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. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. /// is null. - /// Returns a object. - public static CostManagementExportResource GetCostManagementExportResource(this ArmClient client, ResourceIdentifier id) + public static AsyncPageable GetDimensionsAsync(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementExportResource(id); + return GetMockableCostManagementArmClient(client).GetDimensionsAsync(scope, filter, expand, skiptoken, top, cancellationToken); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Lists the dimensions by the defined scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/dimensions + /// + /// + /// Operation Id + /// Dimensions_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. + /// The scope that the resource will apply against. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// 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. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. /// is null. - /// Returns a object. - public static TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) + public static Pageable GetDimensions(this ArmClient client, ResourceIdentifier scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetTenantsCostManagementViewsResource(id); + return GetMockableCostManagementArmClient(client).GetDimensions(scope, filter, expand, skiptoken, top, cancellationToken); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Lists the forecast charges for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/forecast + /// + /// + /// Operation Id + /// Forecast_Usage + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static CostManagementViewsResource GetCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// The cancellation token to use. + /// or is null. + public static async Task> UsageForecastAsync(this ArmClient client, ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementViewsResource(id); + return await GetMockableCostManagementArmClient(client).UsageForecastAsync(scope, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Lists the forecast charges for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/forecast + /// + /// + /// Operation Id + /// Forecast_Usage + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static CostManagementAlertResource GetCostManagementAlertResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// The cancellation token to use. + /// or is null. + public static Response UsageForecast(this ArmClient client, ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetCostManagementAlertResource(id); + return GetMockableCostManagementArmClient(client).UsageForecast(scope, forecastDefinition, filter, cancellationToken); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Query the usage data for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/query + /// + /// + /// Operation Id + /// Query_Usage + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static TenantScheduledActionResource GetTenantScheduledActionResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The cancellation token to use. + /// or is null. + public static async Task> UsageQueryAsync(this ArmClient client, ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableCostManagementArmClient(client).GetTenantScheduledActionResource(id); + return await GetMockableCostManagementArmClient(client).UsageQueryAsync(scope, queryDefinition, cancellationToken).ConfigureAwait(false); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Query the usage data for scope defined. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/query + /// + /// + /// Operation Id + /// Query_Usage + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static ScheduledActionResource GetScheduledActionResource(this ArmClient client, ResourceIdentifier id) + /// The scope that the resource will apply against. + /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The cancellation token to use. + /// or is null. + public static Response UsageQuery(this ArmClient client, ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).UsageQuery(scope, queryDefinition, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static CostManagementAlertResource GetCostManagementAlertResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetCostManagementAlertResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static BudgetResource GetBudgetResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetBudgetResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ScheduledActionResource GetScheduledActionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); return GetMockableCostManagementArmClient(client).GetScheduledActionResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static TenantScheduledActionResource GetTenantScheduledActionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetTenantScheduledActionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static CostManagementExportResource GetCostManagementExportResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetCostManagementExportResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SettingResource GetSettingResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetSettingResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static CostManagementViewsResource GetCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetCostManagementViewsResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetTenantsCostManagementViewsResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static CostAllocationRuleDefinitionResource GetCostAllocationRuleDefinitionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCostManagementArmClient(client).GetCostAllocationRuleDefinitionResource(id); + } + + /// + /// Gets a collection of TenantScheduledActionResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. + public static TenantScheduledActionCollection GetTenantScheduledActions(this TenantResource tenantResource) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledActions(); + } + + /// + /// Get the private scheduled action by name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Scheduled action name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetTenantScheduledActionAsync(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return await GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledActionAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the private scheduled action by name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Scheduled action name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetTenantScheduledAction(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledAction(name, cancellationToken); + } + /// /// Gets a collection of TenantsCostManagementViewsResources in the TenantResource. /// @@ -882,1532 +1222,1714 @@ public static TenantsCostManagementViewsCollection GetAllTenantsCostManagementVi { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetAllTenantsCostManagementViews(); + return GetMockableCostManagementTenantResource(tenantResource).GetAllTenantsCostManagementViews(); + } + + /// + /// Gets the view by view name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// View name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetTenantsCostManagementViewsAsync(this TenantResource tenantResource, string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return await GetMockableCostManagementTenantResource(tenantResource).GetTenantsCostManagementViewsAsync(viewName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the view by view name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// View name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetTenantsCostManagementViews(this TenantResource tenantResource, string viewName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCostManagementTenantResource(tenantResource).GetTenantsCostManagementViews(viewName, cancellationToken); + } + + /// + /// Gets a collection of CostAllocationRuleDefinitionResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// BillingAccount ID. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of CostAllocationRuleDefinitionResources and their operations over a CostAllocationRuleDefinitionResource. + public static CostAllocationRuleDefinitionCollection GetCostAllocationRuleDefinitions(this TenantResource tenantResource, string billingAccountId) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableCostManagementTenantResource(tenantResource).GetCostAllocationRuleDefinitions(billingAccountId); + } + + /// + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} + /// + /// + /// Operation Id + /// CostAllocationRules_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetCostAllocationRuleDefinitionAsync(this TenantResource tenantResource, string billingAccountId, string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return await GetMockableCostManagementTenantResource(tenantResource).GetCostAllocationRuleDefinitionAsync(billingAccountId, ruleName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the view by view name. + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/views/{viewName} + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} /// /// /// Operation Id - /// Views_Get + /// CostAllocationRules_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// View name. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetTenantsCostManagementViewsAsync(this TenantResource tenantResource, string viewName, CancellationToken cancellationToken = default) + public static Response GetCostAllocationRuleDefinition(this TenantResource tenantResource, string billingAccountId, string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GetTenantsCostManagementViewsAsync(viewName, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementTenantResource(tenantResource).GetCostAllocationRuleDefinition(billingAccountId, ruleName, cancellationToken); } /// - /// Gets the view by view name. + /// Lists the Alerts for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/views/{viewName} + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts /// /// /// Operation Id - /// Views_Get + /// Alerts_ListExternal /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// View name. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetTenantsCostManagementViews(this TenantResource tenantResource, string viewName, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetCostManagementAlertsAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetTenantsCostManagementViews(viewName, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId, cancellationToken); } /// - /// Gets a collection of TenantScheduledActionResources in the TenantResource. + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// + /// + /// Operation Id + /// Alerts_ListExternal + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// is null. - /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. - public static TenantScheduledActionCollection GetTenantScheduledActions(this TenantResource tenantResource) + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetCostManagementAlerts(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledActions(); + return GetMockableCostManagementTenantResource(tenantResource).GetCostManagementAlerts(externalCloudProviderType, externalCloudProviderId, cancellationToken); } /// - /// Get the private scheduled action by name. + /// Checks availability and correctness of the name for a scheduled action. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// /providers/Microsoft.CostManagement/checkNameAvailability /// /// /// Operation Id - /// ScheduledActions_Get + /// ScheduledActions_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 - /// - /// - /// Resource - /// + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Scheduled action name. + /// The request body. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetTenantScheduledActionAsync(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) + /// or is null. + public static async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(this TenantResource tenantResource, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledActionAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).CheckCostManagementNameAvailabilityByScheduledActionAsync(content, cancellationToken).ConfigureAwait(false); } /// - /// Get the private scheduled action by name. + /// Checks availability and correctness of the name for a scheduled action. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// /providers/Microsoft.CostManagement/checkNameAvailability /// /// /// Operation Id - /// ScheduledActions_Get + /// ScheduledActions_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 - /// - /// - /// Resource - /// + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Scheduled action name. + /// The request body. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetTenantScheduledAction(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) + /// or is null. + public static Response CheckCostManagementNameAvailabilityByScheduledAction(this TenantResource tenantResource, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetTenantScheduledAction(name, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).CheckCostManagementNameAvailabilityByScheduledAction(content, cancellationToken); } /// - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists the dimensions by the external cloud provider type. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingAccountId + /// Dimensions_ByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Billing account ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(this TenantResource tenantResource, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(this TenantResource tenantResource, TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingAccountIdAsync(billingAccountId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByExternalCloudProviderTypeDimensionsAsync(options, cancellationToken); } /// - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists the dimensions by the external cloud provider type. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingAccountId + /// Dimensions_ByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Billing account ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetBenefitUtilizationSummariesByBillingAccountId(this TenantResource tenantResource, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable ByExternalCloudProviderTypeDimensions(this TenantResource tenantResource, TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingAccountId(billingAccountId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByExternalCloudProviderTypeDimensions(options, cancellationToken); } /// - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists the forecast charges for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingProfileId + /// Forecast_ExternalCloudProviderUsage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Billing account ID. - /// Billing profile ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(this TenantResource tenantResource, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> ExternalCloudProviderUsageForecastAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingProfileIdAsync(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); + return await GetMockableCostManagementTenantResource(tenantResource).ExternalCloudProviderUsageForecastAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); } /// - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists the forecast charges for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingProfileId + /// Forecast_ExternalCloudProviderUsage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Billing account ID. - /// Billing profile ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetBenefitUtilizationSummariesByBillingProfileId(this TenantResource tenantResource, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static Response ExternalCloudProviderUsageForecast(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingProfileId(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ExternalCloudProviderUsageForecast(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Query the usage data for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// Query_UsageByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Savings plan order ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(this TenantResource tenantResource, string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> UsageByExternalCloudProviderTypeQueryAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(savingsPlanOrderId, filter, grainParameter, cancellationToken); + return await GetMockableCostManagementTenantResource(tenantResource).UsageByExternalCloudProviderTypeQueryAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Query the usage data for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// Query_UsageByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Savings plan order ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(this TenantResource tenantResource, string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static Response UsageByExternalCloudProviderTypeQuery(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrder(savingsPlanOrderId, filter, grainParameter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).UsageByExternalCloudProviderTypeQuery(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + /// + /// **Migrate to version 2025-03-01** + /// + /// You can use the 2025-03-01 API version with the new URI: + /// + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + /// + /// With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + /// + /// The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + /// + /// The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + /// + /// All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// PriceSheet_DownloadByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Savings plan order ID. - /// Savings plan ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Billing Period Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(this TenantResource tenantResource, string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> DownloadByBillingAccountPriceSheetAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); - } - - /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + return await GetMockableCostManagementTenantResource(tenantResource).DownloadByBillingAccountPriceSheetAsync(waitUntil, billingAccountId, billingPeriodName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + /// + /// **Migrate to version 2025-03-01** + /// + /// You can use the 2025-03-01 API version with the new URI: + /// + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + /// + /// With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + /// + /// The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + /// + /// The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + /// + /// All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// PriceSheet_DownloadByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// - /// - /// The instance the method will execute against. - /// Savings plan order ID. - /// Savings plan ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// + /// The instance the method will execute against. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Billing Period Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetBenefitUtilizationSummariesBySavingsPlanId(this TenantResource tenantResource, string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public static ArmOperation DownloadByBillingAccountPriceSheet(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanId(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).DownloadByBillingAccountPriceSheet(waitUntil, billingAccountId, billingPeriodName, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByInvoice /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. + /// The ID that uniquely identifies an invoice. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static async Task> DownloadPriceSheetAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(waitUntil, billingAccountId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheetAsync(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); } /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByInvoice /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. + /// The ID that uniquely identifies an invoice. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static ArmOperation DownloadPriceSheet(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScope(waitUntil, billingAccountId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheet(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + /// + /// Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> DownloadPriceSheetByBillingProfileAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(waitUntil, billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheetByBillingProfileAsync(waitUntil, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); } /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + /// + /// Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public static ArmOperation DownloadPriceSheetByBillingProfile(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScope(waitUntil, billingAccountId, billingProfileId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheetByBillingProfile(waitUntil, billingAccountName, billingProfileName, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(this TenantResource tenantResource, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(waitUntil, reservationOrderId, content, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingProfileIdAsync(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetBenefitUtilizationSummariesByBillingProfileId(this TenantResource tenantResource, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScope(waitUntil, reservationOrderId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingProfileId(billingAccountId, billingProfileId, grainParameter, filter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// ReservationScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListByBillingAccountId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(this TenantResource tenantResource, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScopeAsync(waitUntil, reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingAccountIdAsync(billingAccountId, grainParameter, filter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// ReservationScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListByBillingAccountId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetBenefitUtilizationSummariesByBillingAccountId(this TenantResource tenantResource, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScope(waitUntil, reservationOrderId, reservationId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesByBillingAccountId(billingAccountId, grainParameter, filter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// Lists the savings plan utilization summaries for daily or monthly grain. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListBySavingsPlanOrder /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(this TenantResource tenantResource, string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(waitUntil, savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(savingsPlanOrderId, filter, grainParameter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// Lists the savings plan utilization summaries for daily or monthly grain. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListBySavingsPlanOrder /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(this TenantResource tenantResource, string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(waitUntil, savingsPlanOrderId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanOrder(savingsPlanOrderId, filter, grainParameter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// Lists the savings plan utilization summaries for daily or monthly grain. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync + /// BenefitUtilizationSummaries_ListBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(this TenantResource tenantResource, string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// Lists the savings plan utilization summaries for daily or monthly grain. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync + /// BenefitUtilizationSummaries_ListBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetBenefitUtilizationSummariesBySavingsPlanId(this TenantResource tenantResource, string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GetBenefitUtilizationSummariesBySavingsPlanId(savingsPlanOrderId, savingsPlanId, filter, grainParameter, cancellationToken); } /// - /// Lists the Alerts for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Alerts_ListExternal + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 - /// - /// - /// Resource - /// + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Billing Profile ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetCostManagementAlertsAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId, cancellationToken); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(waitUntil, billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); } /// - /// Lists the Alerts for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Alerts_ListExternal + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 - /// - /// - /// Resource - /// + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Billing Profile ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetCostManagementAlerts(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).GetCostManagementAlerts(externalCloudProviderType, externalCloudProviderId, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingProfileScope(waitUntil, billingAccountId, billingProfileId, content, cancellationToken); } /// - /// Lists the forecast charges for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Forecast_ExternalCloudProviderUsage + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// - /// - /// The instance the method will execute against. - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// + /// The instance the method will execute against. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> ExternalCloudProviderUsageForecastAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).ExternalCloudProviderUsageForecastAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(waitUntil, billingAccountId, content, cancellationToken).ConfigureAwait(false); } /// - /// Lists the forecast charges for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Forecast_ExternalCloudProviderUsage + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static Response ExternalCloudProviderUsageForecast(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).ExternalCloudProviderUsageForecast(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportBillingAccountScope(waitUntil, billingAccountId, content, cancellationToken); } /// - /// Lists the dimensions by the external cloud provider type. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Dimensions_ByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(this TenantResource tenantResource, TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).ByExternalCloudProviderTypeDimensionsAsync(options, cancellationToken); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(waitUntil, savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); } /// - /// Lists the dimensions by the external cloud provider type. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Dimensions_ByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable ByExternalCloudProviderTypeDimensions(this TenantResource tenantResource, TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).ByExternalCloudProviderTypeDimensions(options, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(waitUntil, savingsPlanOrderId, content, cancellationToken); } /// - /// Query the usage data for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Query_UsageByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> UsageByExternalCloudProviderTypeQueryAsync(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).UsageByExternalCloudProviderTypeQueryAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); } /// - /// Query the usage data for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Query_UsageByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public static Response UsageByExternalCloudProviderTypeQuery(this TenantResource tenantResource, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(this TenantResource tenantResource, WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).UsageByExternalCloudProviderTypeQuery(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(waitUntil, savingsPlanOrderId, savingsPlanId, content, cancellationToken); } /// - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingAccountId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Enrollment ID (Legacy BillingAccount ID). - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , , or is null. - public static async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).ByBillingAccountIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(waitUntil, reservationOrderId, content, cancellationToken).ConfigureAwait(false); } /// - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingAccountId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Enrollment ID (Legacy BillingAccount ID). - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , , or is null. - public static ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).ByBillingAccountIdGenerateReservationDetailsReport(waitUntil, billingAccountId, startDate, endDate, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationOrderScope(waitUntil, reservationOrderId, content, cancellationToken); } /// - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + /// Triggers generation of a benefit utilization summaries report for the provided reservation. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingProfileId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , , or is null. - public static async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).ByBillingProfileIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScopeAsync(waitUntil, reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); } /// - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + /// Triggers generation of a benefit utilization summaries report for the provided reservation. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingProfileId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , , or is null. - public static ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public static ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(this TenantResource tenantResource, WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).ByBillingProfileIdGenerateReservationDetailsReport(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).GenerateBenefitUtilizationSummariesReportReservationScope(waitUntil, reservationOrderId, reservationId, content, cancellationToken); } /// - /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_Download + /// GenerateReservationDetailsReport_ByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice. + /// BillingAccount ID. + /// Billing Profile ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static async Task> DownloadPriceSheetAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public static async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheetAsync(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).ByBillingProfileIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); } /// - /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_Download + /// GenerateReservationDetailsReport_ByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice. + /// BillingAccount ID. + /// Billing Profile ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static ArmOperation DownloadPriceSheet(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , , or is null. + public static ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).DownloadPriceSheet(waitUntil, billingAccountName, billingProfileName, invoiceName, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByBillingProfileIdGenerateReservationDetailsReport(waitUntil, billingAccountId, billingProfileId, startDate, endDate, cancellationToken); } /// - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_DownloadByBillingProfile + /// GenerateReservationDetailsReport_ByBillingAccountId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// BillingAccount ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> DownloadByBillingProfilePriceSheetAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , , or is null. + public static async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).DownloadByBillingProfilePriceSheetAsync(waitUntil, billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).ByBillingAccountIdGenerateReservationDetailsReportAsync(waitUntil, billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); } /// - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_DownloadByBillingProfile + /// GenerateReservationDetailsReport_ByBillingAccountId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// BillingAccount ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public static ArmOperation DownloadByBillingProfilePriceSheet(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , , or is null. + public static ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(this TenantResource tenantResource, WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).DownloadByBillingProfilePriceSheet(waitUntil, billingAccountName, billingProfileName, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).ByBillingAccountIdGenerateReservationDetailsReport(waitUntil, billingAccountId, startDate, endDate, cancellationToken); } /// - /// Checks availability and correctness of the name for a scheduled action. + /// Checks availability and correctness of a name for a cost allocation rule /// /// /// Request Path - /// /providers/Microsoft.CostManagement/checkNameAvailability + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability /// /// /// Operation Id - /// ScheduledActions_CheckNameAvailability + /// CostAllocationRules_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Scheduled action to be created or updated. + /// Cost allocation rule to be created or updated. /// The cancellation token to use. /// or is null. - public static async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(this TenantResource tenantResource, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + public static async Task> CheckNameAvailabilityCostAllocationRuleAsync(this TenantResource tenantResource, CostAllocationRuleCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return await GetMockableCostManagementTenantResource(tenantResource).CheckCostManagementNameAvailabilityByScheduledActionAsync(content, cancellationToken).ConfigureAwait(false); + return await GetMockableCostManagementTenantResource(tenantResource).CheckNameAvailabilityCostAllocationRuleAsync(content, cancellationToken).ConfigureAwait(false); } /// - /// Checks availability and correctness of the name for a scheduled action. + /// Checks availability and correctness of a name for a cost allocation rule /// /// /// Request Path - /// /providers/Microsoft.CostManagement/checkNameAvailability + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability /// /// /// Operation Id - /// ScheduledActions_CheckNameAvailability + /// CostAllocationRules_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Scheduled action to be created or updated. + /// Cost allocation rule to be created or updated. /// The cancellation token to use. /// or is null. - public static Response CheckCostManagementNameAvailabilityByScheduledAction(this TenantResource tenantResource, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + public static Response CheckNameAvailabilityCostAllocationRule(this TenantResource tenantResource, CostAllocationRuleCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - return GetMockableCostManagementTenantResource(tenantResource).CheckCostManagementNameAvailabilityByScheduledAction(content, cancellationToken); + return GetMockableCostManagementTenantResource(tenantResource).CheckNameAvailabilityCostAllocationRule(content, cancellationToken); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs index dc50f2c2bacc..cfb34a1bb4be 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementArmClient.cs @@ -20,14 +20,14 @@ public partial class MockableCostManagementArmClient : ArmResource { private ClientDiagnostics _benefitRecommendationsClientDiagnostics; private BenefitRecommendationsRestOperations _benefitRecommendationsRestClient; - private ClientDiagnostics _forecastClientDiagnostics; - private ForecastRestOperations _forecastRestClient; + private ClientDiagnostics _scheduledActionsClientDiagnostics; + private ScheduledActionsRestOperations _scheduledActionsRestClient; private ClientDiagnostics _dimensionsClientDiagnostics; private DimensionsRestOperations _dimensionsRestClient; + private ClientDiagnostics _forecastClientDiagnostics; + private ForecastRestOperations _forecastRestClient; private ClientDiagnostics _queryClientDiagnostics; private QueryRestOperations _queryRestClient; - private ClientDiagnostics _scheduledActionsClientDiagnostics; - private ScheduledActionsRestOperations _scheduledActionsRestClient; /// Initializes a new instance of the class for mocking. protected MockableCostManagementArmClient() @@ -47,14 +47,14 @@ internal MockableCostManagementArmClient(ArmClient client) : this(client, Resour private ClientDiagnostics BenefitRecommendationsClientDiagnostics => _benefitRecommendationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); private BenefitRecommendationsRestOperations BenefitRecommendationsRestClient => _benefitRecommendationsRestClient ??= new BenefitRecommendationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics DimensionsClientDiagnostics => _dimensionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); private DimensionsRestOperations DimensionsRestClient => _dimensionsRestClient ??= new DimensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics QueryClientDiagnostics => _queryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); private QueryRestOperations QueryRestClient => _queryRestClient ??= new QueryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -62,292 +62,432 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of CostManagementExportResources in the ArmClient. + /// Gets a collection of CostManagementAlertResources in the ArmClient. /// The scope that the resource will apply against. - /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. - public virtual CostManagementExportCollection GetCostManagementExports(ResourceIdentifier scope) + /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. + public virtual CostManagementAlertCollection GetCostManagementAlerts(ResourceIdentifier scope) { - return new CostManagementExportCollection(Client, scope); + return new CostManagementAlertCollection(Client, scope); } /// - /// The operation to get the export for the defined scope by export name. + /// Gets the alert for the scope by alert ID. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} /// /// /// Operation Id - /// Exports_Get + /// Alerts_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// Export Name. - /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// Alert ID. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public virtual async Task> GetCostManagementExportAsync(ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetCostManagementAlertAsync(ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) { - return await GetCostManagementExports(scope).GetAsync(exportName, expand, cancellationToken).ConfigureAwait(false); + return await GetCostManagementAlerts(scope).GetAsync(alertId, cancellationToken).ConfigureAwait(false); } /// - /// The operation to get the export for the defined scope by export name. + /// Gets the alert for the scope by alert ID. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} + /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} /// /// /// Operation Id - /// Exports_Get + /// Alerts_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// Export Name. - /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. + /// Alert ID. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] - public virtual Response GetCostManagementExport(ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) + public virtual Response GetCostManagementAlert(ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) { - return GetCostManagementExports(scope).Get(exportName, expand, cancellationToken); + return GetCostManagementAlerts(scope).Get(alertId, cancellationToken); } - /// Gets a collection of CostManagementViewsResources in the ArmClient. + /// Gets a collection of BudgetResources in the ArmClient. /// The scope that the resource will apply against. - /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. - public virtual CostManagementViewsCollection GetAllCostManagementViews(ResourceIdentifier scope) + /// An object representing collection of BudgetResources and their operations over a BudgetResource. + public virtual BudgetCollection GetBudgets(ResourceIdentifier scope) { - return new CostManagementViewsCollection(Client, scope); + return new BudgetCollection(Client, scope); } /// - /// Gets the view for the defined scope by view name. + /// Gets the budget for the scope by budget name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} /// /// /// Operation Id - /// Views_GetByScope + /// Budgets_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// View name. + /// Budget Name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetCostManagementViewsAsync(ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + public virtual async Task> GetBudgetAsync(ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) { - return await GetAllCostManagementViews(scope).GetAsync(viewName, cancellationToken).ConfigureAwait(false); + return await GetBudgets(scope).GetAsync(budgetName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the view for the defined scope by view name. + /// Gets the budget for the scope by budget name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// /{scope}/providers/Microsoft.CostManagement/budgets/{budgetName} /// /// /// Operation Id - /// Views_GetByScope + /// Budgets_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// View name. + /// Budget Name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetCostManagementViews(ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + public virtual Response GetBudget(ResourceIdentifier scope, string budgetName, CancellationToken cancellationToken = default) { - return GetAllCostManagementViews(scope).Get(viewName, cancellationToken); + return GetBudgets(scope).Get(budgetName, cancellationToken); } - /// Gets a collection of CostManagementAlertResources in the ArmClient. + /// Gets a collection of ScheduledActionResources in the ArmClient. /// The scope that the resource will apply against. - /// An object representing collection of CostManagementAlertResources and their operations over a CostManagementAlertResource. - public virtual CostManagementAlertCollection GetCostManagementAlerts(ResourceIdentifier scope) + /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. + public virtual ScheduledActionCollection GetScheduledActions(ResourceIdentifier scope) { - return new CostManagementAlertCollection(Client, scope); + return new ScheduledActionCollection(Client, scope); } /// - /// Gets the alert for the scope by alert ID. + /// Get the shared scheduled action from the given scope by name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} /// /// /// Operation Id - /// Alerts_Get + /// ScheduledActions_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// Alert ID. + /// Scheduled action name. /// The cancellation token to use. - /// is null. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetCostManagementAlertAsync(ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) + public virtual async Task> GetScheduledActionAsync(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return await GetCostManagementAlerts(scope).GetAsync(alertId, cancellationToken).ConfigureAwait(false); + return await GetScheduledActions(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); } /// - /// Gets the alert for the scope by alert ID. + /// Get the shared scheduled action from the given scope by name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/alerts/{alertId} + /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} /// /// /// Operation Id - /// Alerts_Get + /// ScheduledActions_GetByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// Alert ID. + /// Scheduled action name. /// The cancellation token to use. - /// is null. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetCostManagementAlert(ResourceIdentifier scope, string alertId, CancellationToken cancellationToken = default) + public virtual Response GetScheduledAction(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) { - return GetCostManagementAlerts(scope).Get(alertId, cancellationToken); + return GetScheduledActions(scope).Get(name, cancellationToken); } - /// Gets a collection of ScheduledActionResources in the ArmClient. + /// Gets a collection of CostManagementExportResources in the ArmClient. /// The scope that the resource will apply against. - /// An object representing collection of ScheduledActionResources and their operations over a ScheduledActionResource. - public virtual ScheduledActionCollection GetScheduledActions(ResourceIdentifier scope) + /// An object representing collection of CostManagementExportResources and their operations over a CostManagementExportResource. + public virtual CostManagementExportCollection GetCostManagementExports(ResourceIdentifier scope) { - return new ScheduledActionCollection(Client, scope); + return new CostManagementExportCollection(Client, scope); } /// - /// Get the shared scheduled action from the given scope by name. + /// The operation to get the export for the defined scope by export name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} /// /// /// Operation Id - /// ScheduledActions_GetByScope + /// Exports_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// Scheduled action name. + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetScheduledActionAsync(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + public virtual async Task> GetCostManagementExportAsync(ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) { - return await GetScheduledActions(scope).GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetCostManagementExports(scope).GetAsync(exportName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Get the shared scheduled action from the given scope by name. + /// The operation to get the export for the defined scope by export name. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/scheduledActions/{name} + /// /{scope}/providers/Microsoft.CostManagement/exports/{exportName} /// /// /// Operation Id - /// ScheduledActions_GetByScope + /// Exports_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The scope that the resource will apply against. - /// Scheduled action name. + /// Export Name. + /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetScheduledAction(ResourceIdentifier scope, string name, CancellationToken cancellationToken = default) + public virtual Response GetCostManagementExport(ResourceIdentifier scope, string exportName, string expand = null, CancellationToken cancellationToken = default) { - return GetScheduledActions(scope).Get(name, cancellationToken); + return GetCostManagementExports(scope).Get(exportName, expand, cancellationToken); + } + + /// Gets a collection of SettingResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of SettingResources and their operations over a SettingResource. + public virtual SettingCollection GetSettings(ResourceIdentifier scope) + { + return new SettingCollection(Client, scope); + } + + /// + /// Get the setting from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// Setting type. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetSettingAsync(ResourceIdentifier scope, SettingType type, CancellationToken cancellationToken = default) + { + return await GetSettings(scope).GetAsync(type, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the setting from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// Setting type. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetSetting(ResourceIdentifier scope, SettingType type, CancellationToken cancellationToken = default) + { + return GetSettings(scope).Get(type, cancellationToken); + } + + /// Gets a collection of CostManagementViewsResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of CostManagementViewsResources and their operations over a CostManagementViewsResource. + public virtual CostManagementViewsCollection GetAllCostManagementViews(ResourceIdentifier scope) + { + return new CostManagementViewsCollection(Client, scope); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// View name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCostManagementViewsAsync(ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + { + return await GetAllCostManagementViews(scope).GetAsync(viewName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the view for the defined scope by view name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/views/{viewName} + /// + /// + /// Operation Id + /// Views_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// View name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCostManagementViews(ResourceIdentifier scope, string viewName, CancellationToken cancellationToken = default) + { + return GetAllCostManagementViews(scope).Get(viewName, cancellationToken); } /// @@ -363,7 +503,7 @@ public virtual Response GetScheduledAction(ResourceIden /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// @@ -396,7 +536,7 @@ public virtual AsyncPageable GetBenefitRecommendatio /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// @@ -417,37 +557,36 @@ public virtual Pageable GetBenefitRecommendations(Re } /// - /// Lists the forecast charges for scope defined. + /// Checks availability and correctness of the name for a scheduled action within the given scope. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/forecast + /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability /// /// /// Operation Id - /// Forecast_Usage + /// ScheduledActions_CheckNameAvailabilityByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// Scheduled action to be created or updated. /// The cancellation token to use. - /// or is null. - public virtual async Task> UsageForecastAsync(ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + Argument.AssertNotNull(content, nameof(content)); - using var scope0 = ForecastClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageForecast"); + using var scope0 = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementArmClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); scope0.Start(); try { - var response = await ForecastRestClient.UsageAsync(scope, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + var response = await ScheduledActionsRestClient.CheckNameAvailabilityByScopeAsync(scope, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -458,37 +597,36 @@ public virtual async Task> UsageForecastAsync(ResourceI } /// - /// Lists the forecast charges for scope defined. + /// Checks availability and correctness of the name for a scheduled action within the given scope. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/forecast + /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability /// /// /// Operation Id - /// Forecast_Usage + /// ScheduledActions_CheckNameAvailabilityByScope /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// Scheduled action to be created or updated. /// The cancellation token to use. - /// or is null. - public virtual Response UsageForecast(ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual Response CheckCostManagementNameAvailabilityByScopeScheduledAction(ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + Argument.AssertNotNull(content, nameof(content)); - using var scope0 = ForecastClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageForecast"); + using var scope0 = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementArmClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); scope0.Start(); try { - var response = ForecastRestClient.Usage(scope, forecastDefinition, filter, cancellationToken); + var response = ScheduledActionsRestClient.CheckNameAvailabilityByScope(scope, content, cancellationToken); return response; } catch (Exception e) @@ -511,7 +649,7 @@ public virtual Response UsageForecast(ResourceIdentifier scope, /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// @@ -528,7 +666,8 @@ public virtual AsyncPageable GetDimensionsAsync(Resourc Argument.AssertNotNull(scope, nameof(scope)); HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateListRequest(scope, filter, expand, skiptoken, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetDimensions", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DimensionsRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand, skiptoken, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetDimensions", "value", "nextLink", cancellationToken); } /// @@ -544,7 +683,7 @@ public virtual AsyncPageable GetDimensionsAsync(Resourc /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// @@ -561,40 +700,42 @@ public virtual Pageable GetDimensions(ResourceIdentifie Argument.AssertNotNull(scope, nameof(scope)); HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateListRequest(scope, filter, expand, skiptoken, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetDimensions", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DimensionsRestClient.CreateListNextPageRequest(nextLink, scope, filter, expand, skiptoken, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementArmClient.GetDimensions", "value", "nextLink", cancellationToken); } /// - /// Query the usage data for scope defined. + /// Lists the forecast charges for scope defined. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/query + /// /{scope}/providers/Microsoft.CostManagement/forecast /// /// /// Operation Id - /// Query_Usage + /// Forecast_Usage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. - /// or is null. - public virtual async Task> UsageQueryAsync(ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> UsageForecastAsync(ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - using var scope0 = QueryClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageQuery"); + using var scope0 = ForecastClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageForecast"); scope0.Start(); try { - var response = await QueryRestClient.UsageAsync(scope, queryDefinition, cancellationToken).ConfigureAwait(false); + var response = await ForecastRestClient.UsageAsync(scope, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -605,36 +746,37 @@ public virtual async Task> UsageQueryAsync(ResourceIdentif } /// - /// Query the usage data for scope defined. + /// Lists the forecast charges for scope defined. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/query + /// /{scope}/providers/Microsoft.CostManagement/forecast /// /// /// Operation Id - /// Query_Usage + /// Forecast_Usage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// The scope that the resource will apply against. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. - /// or is null. - public virtual Response UsageQuery(ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// or is null. + public virtual Response UsageForecast(ResourceIdentifier scope, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - using var scope0 = QueryClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageQuery"); + using var scope0 = ForecastClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageForecast"); scope0.Start(); try { - var response = QueryRestClient.Usage(scope, queryDefinition, cancellationToken); + var response = ForecastRestClient.Usage(scope, forecastDefinition, filter, cancellationToken); return response; } catch (Exception e) @@ -645,36 +787,36 @@ public virtual Response UsageQuery(ResourceIdentifier scope, QueryD } /// - /// Checks availability and correctness of the name for a scheduled action within the given scope. + /// Query the usage data for scope defined. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability + /// /{scope}/providers/Microsoft.CostManagement/query /// /// /// Operation Id - /// ScheduledActions_CheckNameAvailabilityByScope + /// Query_Usage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// The scope that the resource will apply against. - /// Scheduled action to be created or updated. + /// Parameters supplied to the CreateOrUpdate Query Config operation. /// The cancellation token to use. - /// or is null. - public virtual async Task> CheckCostManagementNameAvailabilityByScopeScheduledActionAsync(ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> UsageQueryAsync(ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - using var scope0 = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementArmClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); + using var scope0 = QueryClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageQuery"); scope0.Start(); try { - var response = await ScheduledActionsRestClient.CheckNameAvailabilityByScopeAsync(scope, content, cancellationToken).ConfigureAwait(false); + var response = await QueryRestClient.UsageAsync(scope, queryDefinition, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -685,36 +827,36 @@ public virtual async Task> CheckC } /// - /// Checks availability and correctness of the name for a scheduled action within the given scope. + /// Query the usage data for scope defined. /// /// /// Request Path - /// /{scope}/providers/Microsoft.CostManagement/checkNameAvailability + /// /{scope}/providers/Microsoft.CostManagement/query /// /// /// Operation Id - /// ScheduledActions_CheckNameAvailabilityByScope + /// Query_Usage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// The scope that the resource will apply against. - /// Scheduled action to be created or updated. + /// Parameters supplied to the CreateOrUpdate Query Config operation. /// The cancellation token to use. - /// or is null. - public virtual Response CheckCostManagementNameAvailabilityByScopeScheduledAction(ResourceIdentifier scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is null. + public virtual Response UsageQuery(ResourceIdentifier scope, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - using var scope0 = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementArmClient.CheckCostManagementNameAvailabilityByScopeScheduledAction"); + using var scope0 = QueryClientDiagnostics.CreateScope("MockableCostManagementArmClient.UsageQuery"); scope0.Start(); try { - var response = ScheduledActionsRestClient.CheckNameAvailabilityByScope(scope, content, cancellationToken); + var response = QueryRestClient.Usage(scope, queryDefinition, cancellationToken); return response; } catch (Exception e) @@ -723,6 +865,54 @@ public virtual Response CheckCostManagemen throw; } } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CostManagementAlertResource GetCostManagementAlertResource(ResourceIdentifier id) + { + CostManagementAlertResource.ValidateResourceId(id); + return new CostManagementAlertResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BudgetResource GetBudgetResource(ResourceIdentifier id) + { + BudgetResource.ValidateResourceId(id); + return new BudgetResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ScheduledActionResource GetScheduledActionResource(ResourceIdentifier id) + { + ScheduledActionResource.ValidateResourceId(id); + return new ScheduledActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TenantScheduledActionResource GetTenantScheduledActionResource(ResourceIdentifier id) + { + TenantScheduledActionResource.ValidateResourceId(id); + return new TenantScheduledActionResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -736,15 +926,15 @@ public virtual CostManagementExportResource GetCostManagementExportResource(Reso } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(ResourceIdentifier id) + /// Returns a object. + public virtual SettingResource GetSettingResource(ResourceIdentifier id) { - TenantsCostManagementViewsResource.ValidateResourceId(id); - return new TenantsCostManagementViewsResource(Client, id); + SettingResource.ValidateResourceId(id); + return new SettingResource(Client, id); } /// @@ -760,39 +950,27 @@ public virtual CostManagementViewsResource GetCostManagementViewsResource(Resour } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual CostManagementAlertResource GetCostManagementAlertResource(ResourceIdentifier id) - { - CostManagementAlertResource.ValidateResourceId(id); - return new CostManagementAlertResource(Client, id); - } - - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual TenantScheduledActionResource GetTenantScheduledActionResource(ResourceIdentifier id) + /// Returns a object. + public virtual TenantsCostManagementViewsResource GetTenantsCostManagementViewsResource(ResourceIdentifier id) { - TenantScheduledActionResource.ValidateResourceId(id); - return new TenantScheduledActionResource(Client, id); + TenantsCostManagementViewsResource.ValidateResourceId(id); + return new TenantsCostManagementViewsResource(Client, id); } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual ScheduledActionResource GetScheduledActionResource(ResourceIdentifier id) + /// Returns a object. + public virtual CostAllocationRuleDefinitionResource GetCostAllocationRuleDefinitionResource(ResourceIdentifier id) { - ScheduledActionResource.ValidateResourceId(id); - return new ScheduledActionResource(Client, id); + CostAllocationRuleDefinitionResource.ValidateResourceId(id); + return new CostAllocationRuleDefinitionResource(Client, id); } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs index 6122ee1cd6ff..ecd85cd69d85 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/MockableCostManagementTenantResource.cs @@ -18,34 +18,26 @@ namespace Azure.ResourceManager.CostManagement.Mocking /// A class to add extension methods to TenantResource. public partial class MockableCostManagementTenantResource : ArmResource { - private ClientDiagnostics _benefitUtilizationSummariesClientDiagnostics; - private BenefitUtilizationSummariesRestOperations _benefitUtilizationSummariesRestClient; - private ClientDiagnostics _billingAccountScopeClientDiagnostics; - private BillingAccountScopeRestOperations _billingAccountScopeRestClient; - private ClientDiagnostics _billingProfileScopeClientDiagnostics; - private BillingProfileScopeRestOperations _billingProfileScopeRestClient; - private ClientDiagnostics _reservationOrderScopeClientDiagnostics; - private ReservationOrderScopeRestOperations _reservationOrderScopeRestClient; - private ClientDiagnostics _reservationScopeClientDiagnostics; - private ReservationScopeRestOperations _reservationScopeRestClient; - private ClientDiagnostics _savingsPlanOrderScopeClientDiagnostics; - private SavingsPlanOrderScopeRestOperations _savingsPlanOrderScopeRestClient; - private ClientDiagnostics _savingsPlanScopeClientDiagnostics; - private SavingsPlanScopeRestOperations _savingsPlanScopeRestClient; private ClientDiagnostics _costManagementAlertAlertsClientDiagnostics; private AlertsRestOperations _costManagementAlertAlertsRestClient; - private ClientDiagnostics _forecastClientDiagnostics; - private ForecastRestOperations _forecastRestClient; + private ClientDiagnostics _scheduledActionsClientDiagnostics; + private ScheduledActionsRestOperations _scheduledActionsRestClient; private ClientDiagnostics _dimensionsClientDiagnostics; private DimensionsRestOperations _dimensionsRestClient; + private ClientDiagnostics _forecastClientDiagnostics; + private ForecastRestOperations _forecastRestClient; private ClientDiagnostics _queryClientDiagnostics; private QueryRestOperations _queryRestClient; - private ClientDiagnostics _generateReservationDetailsReportClientDiagnostics; - private GenerateReservationDetailsReportRestOperations _generateReservationDetailsReportRestClient; private ClientDiagnostics _priceSheetClientDiagnostics; private PriceSheetRestOperations _priceSheetRestClient; - private ClientDiagnostics _scheduledActionsClientDiagnostics; - private ScheduledActionsRestOperations _scheduledActionsRestClient; + private ClientDiagnostics _benefitUtilizationSummariesClientDiagnostics; + private BenefitUtilizationSummariesRestOperations _benefitUtilizationSummariesRestClient; + private ClientDiagnostics _generateBenefitUtilizationSummariesReportClientDiagnostics; + private GenerateBenefitUtilizationSummariesReportRestOperations _generateBenefitUtilizationSummariesReportRestClient; + private ClientDiagnostics _generateReservationDetailsReportClientDiagnostics; + private GenerateReservationDetailsReportRestOperations _generateReservationDetailsReportRestClient; + private ClientDiagnostics _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics; + private CostAllocationRulesRestOperations _costAllocationRuleDefinitionCostAllocationRulesRestClient; /// Initializes a new instance of the class for mocking. protected MockableCostManagementTenantResource() @@ -59,34 +51,26 @@ internal MockableCostManagementTenantResource(ArmClient client, ResourceIdentifi { } - private ClientDiagnostics BenefitUtilizationSummariesClientDiagnostics => _benefitUtilizationSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BenefitUtilizationSummariesRestOperations BenefitUtilizationSummariesRestClient => _benefitUtilizationSummariesRestClient ??= new BenefitUtilizationSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BillingAccountScopeClientDiagnostics => _billingAccountScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BillingAccountScopeRestOperations BillingAccountScopeRestClient => _billingAccountScopeRestClient ??= new BillingAccountScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics BillingProfileScopeClientDiagnostics => _billingProfileScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private BillingProfileScopeRestOperations BillingProfileScopeRestClient => _billingProfileScopeRestClient ??= new BillingProfileScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationOrderScopeClientDiagnostics => _reservationOrderScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationOrderScopeRestOperations ReservationOrderScopeRestClient => _reservationOrderScopeRestClient ??= new ReservationOrderScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ReservationScopeClientDiagnostics => _reservationScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ReservationScopeRestOperations ReservationScopeRestClient => _reservationScopeRestClient ??= new ReservationScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SavingsPlanOrderScopeClientDiagnostics => _savingsPlanOrderScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SavingsPlanOrderScopeRestOperations SavingsPlanOrderScopeRestClient => _savingsPlanOrderScopeRestClient ??= new SavingsPlanOrderScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics SavingsPlanScopeClientDiagnostics => _savingsPlanScopeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private SavingsPlanScopeRestOperations SavingsPlanScopeRestClient => _savingsPlanScopeRestClient ??= new SavingsPlanScopeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics CostManagementAlertAlertsClientDiagnostics => _costManagementAlertAlertsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", CostManagementAlertResource.ResourceType.Namespace, Diagnostics); private AlertsRestOperations CostManagementAlertAlertsRestClient => _costManagementAlertAlertsRestClient ??= new AlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CostManagementAlertResource.ResourceType)); - private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics DimensionsClientDiagnostics => _dimensionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); private DimensionsRestOperations DimensionsRestClient => _dimensionsRestClient ??= new DimensionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ForecastClientDiagnostics => _forecastClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ForecastRestOperations ForecastRestClient => _forecastRestClient ??= new ForecastRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics QueryClientDiagnostics => _queryClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); private QueryRestOperations QueryRestClient => _queryRestClient ??= new QueryRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics GenerateReservationDetailsReportClientDiagnostics => _generateReservationDetailsReportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private GenerateReservationDetailsReportRestOperations GenerateReservationDetailsReportRestClient => _generateReservationDetailsReportRestClient ??= new GenerateReservationDetailsReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics PriceSheetClientDiagnostics => _priceSheetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); private PriceSheetRestOperations PriceSheetRestClient => _priceSheetRestClient ??= new PriceSheetRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics ScheduledActionsClientDiagnostics => _scheduledActionsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ScheduledActionsRestOperations ScheduledActionsRestClient => _scheduledActionsRestClient ??= new ScheduledActionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics BenefitUtilizationSummariesClientDiagnostics => _benefitUtilizationSummariesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private BenefitUtilizationSummariesRestOperations BenefitUtilizationSummariesRestClient => _benefitUtilizationSummariesRestClient ??= new BenefitUtilizationSummariesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics GenerateBenefitUtilizationSummariesReportClientDiagnostics => _generateBenefitUtilizationSummariesReportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GenerateBenefitUtilizationSummariesReportRestOperations GenerateBenefitUtilizationSummariesReportRestClient => _generateBenefitUtilizationSummariesReportRestClient ??= new GenerateBenefitUtilizationSummariesReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics GenerateReservationDetailsReportClientDiagnostics => _generateReservationDetailsReportClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GenerateReservationDetailsReportRestOperations GenerateReservationDetailsReportRestClient => _generateReservationDetailsReportRestClient ??= new GenerateReservationDetailsReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics CostAllocationRuleDefinitionCostAllocationRulesClientDiagnostics => _costAllocationRuleDefinitionCostAllocationRulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CostManagement", CostAllocationRuleDefinitionResource.ResourceType.Namespace, Diagnostics); + private CostAllocationRulesRestOperations CostAllocationRuleDefinitionCostAllocationRulesRestClient => _costAllocationRuleDefinitionCostAllocationRulesRestClient ??= new CostAllocationRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CostAllocationRuleDefinitionResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -94,6 +78,75 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } + /// Gets a collection of TenantScheduledActionResources in the TenantResource. + /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. + public virtual TenantScheduledActionCollection GetTenantScheduledActions() + { + return GetCachedClient(client => new TenantScheduledActionCollection(client, Id)); + } + + /// + /// Get the private scheduled action by name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Scheduled action name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTenantScheduledActionAsync(string name, CancellationToken cancellationToken = default) + { + return await GetTenantScheduledActions().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the private scheduled action by name. + /// + /// + /// Request Path + /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// + /// + /// Operation Id + /// ScheduledActions_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Scheduled action name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTenantScheduledAction(string name, CancellationToken cancellationToken = default) + { + return GetTenantScheduledActions().Get(name, cancellationToken); + } + /// Gets a collection of TenantsCostManagementViewsResources in the TenantResource. /// An object representing collection of TenantsCostManagementViewsResources and their operations over a TenantsCostManagementViewsResource. public virtual TenantsCostManagementViewsCollection GetAllTenantsCostManagementViews() @@ -114,7 +167,7 @@ public virtual TenantsCostManagementViewsCollection GetAllTenantsCostManagementV /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -145,7 +198,7 @@ public virtual async Task> GetTenan /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -163,384 +216,406 @@ public virtual Response GetTenantsCostManage return GetAllTenantsCostManagementViews().Get(viewName, cancellationToken); } - /// Gets a collection of TenantScheduledActionResources in the TenantResource. - /// An object representing collection of TenantScheduledActionResources and their operations over a TenantScheduledActionResource. - public virtual TenantScheduledActionCollection GetTenantScheduledActions() + /// Gets a collection of CostAllocationRuleDefinitionResources in the TenantResource. + /// BillingAccount ID. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of CostAllocationRuleDefinitionResources and their operations over a CostAllocationRuleDefinitionResource. + public virtual CostAllocationRuleDefinitionCollection GetCostAllocationRuleDefinitions(string billingAccountId) { - return GetCachedClient(client => new TenantScheduledActionCollection(client, Id)); + return new CostAllocationRuleDefinitionCollection(Client, Id, billingAccountId); } /// - /// Get the private scheduled action by name. + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} /// /// /// Operation Id - /// ScheduledActions_Get + /// CostAllocationRules_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// - /// Scheduled action name. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetTenantScheduledActionAsync(string name, CancellationToken cancellationToken = default) + public virtual async Task> GetCostAllocationRuleDefinitionAsync(string billingAccountId, string ruleName, CancellationToken cancellationToken = default) { - return await GetTenantScheduledActions().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetCostAllocationRuleDefinitions(billingAccountId).GetAsync(ruleName, cancellationToken).ConfigureAwait(false); } /// - /// Get the private scheduled action by name. + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/scheduledActions/{name} + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/{ruleName} /// /// /// Operation Id - /// ScheduledActions_Get + /// CostAllocationRules_Get /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// - /// Scheduled action name. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetTenantScheduledAction(string name, CancellationToken cancellationToken = default) + public virtual Response GetCostAllocationRuleDefinition(string billingAccountId, string ruleName, CancellationToken cancellationToken = default) { - return GetTenantScheduledActions().Get(name, cancellationToken); + return GetCostAllocationRuleDefinitions(billingAccountId).Get(ruleName, cancellationToken); } /// - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists the Alerts for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingAccountId + /// Alerts_ListExternal /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// - /// Billing account ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCostManagementAlertsAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetCostManagementAlerts", "value", null, cancellationToken); } /// - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists the Alerts for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingAccountId + /// Alerts_ListExternal /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// - /// Billing account ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesByBillingAccountId(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCostManagementAlerts(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetCostManagementAlerts", "value", null, cancellationToken); } /// - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// Checks availability and correctness of the name for a scheduled action. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/checkNameAvailability /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingProfileId + /// ScheduledActions_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// Billing account ID. - /// Billing profile ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The request body. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckCostManagementNameAvailabilityByScheduledAction"); + scope.Start(); + try + { + var response = await ScheduledActionsRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// Checks availability and correctness of the name for a scheduled action. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/checkNameAvailability /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListByBillingProfileId + /// ScheduledActions_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// Billing account ID. - /// Billing profile ID. - /// Grain. - /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The request body. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesByBillingProfileId(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is null. + public virtual Response CheckCostManagementNameAvailabilityByScheduledAction(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckCostManagementNameAvailabilityByScheduledAction"); + scope.Start(); + try + { + var response = ScheduledActionsRestClient.CheckNameAvailability(content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Lists the dimensions by the external cloud provider type. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// Dimensions_ByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// Savings plan order ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DimensionsRestClient.CreateByExternalCloudProviderTypeNextPageRequest(nextLink, options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.ByExternalCloudProviderTypeDimensions", "value", "nextLink", cancellationToken); } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Lists the dimensions by the external cloud provider type. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// Dimensions_ByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// Savings plan order ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ByExternalCloudProviderTypeDimensions(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(options, nameof(options)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DimensionsRestClient.CreateByExternalCloudProviderTypeNextPageRequest(nextLink, options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.ByExternalCloudProviderTypeDimensions", "value", "nextLink", cancellationToken); } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Lists the forecast charges for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// Forecast_ExternalCloudProviderUsage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// Savings plan order ID. - /// Savings plan ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> ExternalCloudProviderUsageForecastAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); + using var scope = ForecastClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ExternalCloudProviderUsageForecast"); + scope.Start(); + try + { + var response = await ForecastRestClient.ExternalCloudProviderUsageAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists the savings plan utilization summaries for daily or monthly grain. + /// Lists the forecast charges for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast /// /// /// Operation Id - /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// Forecast_ExternalCloudProviderUsage /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// Savings plan order ID. - /// Savings plan ID. - /// Supports filtering by properties/usageDate. - /// Grain. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. + /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanId(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response ExternalCloudProviderUsageForecast(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); - HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); + using var scope = ForecastClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ExternalCloudProviderUsageForecast"); + scope.Start(); + try + { + var response = ForecastRestClient.ExternalCloudProviderUsage(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// Query the usage data for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query /// /// /// Operation Id - /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport + /// Query_UsageByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UsageByExternalCloudProviderTypeQueryAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - using var scope = BillingAccountScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); + using var scope = QueryClientDiagnostics.CreateScope("MockableCostManagementTenantResource.UsageByExternalCloudProviderTypeQuery"); scope.Start(); try { - var response = await BillingAccountScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(billingAccountId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingAccountScopeClientDiagnostics, Pipeline, BillingAccountScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; + var response = await QueryRestClient.UsageByExternalCloudProviderTypeAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); + return response; } catch (Exception e) { @@ -550,42 +625,39 @@ public virtual async Task - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// Query the usage data for external cloud provider type defined. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query /// /// /// Operation Id - /// BillingAccountScope_GenerateBenefitUtilizationSummariesReport + /// Query_UsageByExternalCloudProviderType /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response UsageByExternalCloudProviderTypeQuery(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); - using var scope = BillingAccountScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); + using var scope = QueryClientDiagnostics.CreateScope("MockableCostManagementTenantResource.UsageByExternalCloudProviderTypeQuery"); scope.Start(); try { - var response = BillingAccountScopeRestClient.GenerateBenefitUtilizationSummariesReport(billingAccountId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingAccountScopeClientDiagnostics, Pipeline, BillingAccountScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; + var response = QueryRestClient.UsageByExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); + return response; } catch (Exception e) { @@ -595,41 +667,53 @@ public virtual ArmOperation Generate } /// - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + /// + /// **Migrate to version 2025-03-01** + /// + /// You can use the 2025-03-01 API version with the new URI: + /// + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + /// + /// With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + /// + /// The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + /// + /// The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + /// + /// All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Period Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> DownloadByBillingAccountPriceSheetAsync(WaitUntil waitUntil, string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingPeriodName, nameof(billingPeriodName)); - using var scope = BillingProfileScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingAccountPriceSheet"); scope.Start(); try { - var response = await BillingProfileScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingProfileScopeClientDiagnostics, Pipeline, BillingProfileScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); + var response = await PriceSheetRestClient.DownloadByBillingAccountAsync(billingAccountId, billingPeriodName, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingAccountRequest(billingAccountId, billingPeriodName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -642,41 +726,53 @@ public virtual async Task - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + /// + /// **Migrate to version 2025-03-01** + /// + /// You can use the 2025-03-01 API version with the new URI: + /// + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + /// + /// With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + /// + /// The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + /// + /// The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + /// + /// All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// BillingProfileScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Period Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation DownloadByBillingAccountPriceSheet(WaitUntil waitUntil, string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingPeriodName, nameof(billingPeriodName)); - using var scope = BillingProfileScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingAccountPriceSheet"); scope.Start(); try { - var response = BillingProfileScopeRestClient.GenerateBenefitUtilizationSummariesReport(billingAccountId, billingProfileId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), BillingProfileScopeClientDiagnostics, Pipeline, BillingProfileScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); + var response = PriceSheetRestClient.DownloadByBillingAccount(billingAccountId, billingPeriodName, cancellationToken); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingAccountRequest(billingAccountId, billingPeriodName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -689,39 +785,41 @@ public virtual ArmOperation Generate } /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByInvoice /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. + /// The ID that uniquely identifies an invoice. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> DownloadPriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); - using var scope = ReservationOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheet"); scope.Start(); try { - var response = await ReservationOrderScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(reservationOrderId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationOrderScopeClientDiagnostics, Pipeline, ReservationOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); + var response = await PriceSheetRestClient.DownloadByInvoiceAsync(billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByInvoiceRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -734,39 +832,41 @@ public virtual async Task - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// ReservationOrderScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByInvoice /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. + /// The ID that uniquely identifies an invoice. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation DownloadPriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); - using var scope = ReservationOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheet"); scope.Start(); try { - var response = ReservationOrderScopeRestClient.GenerateBenefitUtilizationSummariesReport(reservationOrderId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationOrderScopeClientDiagnostics, Pipeline, ReservationOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); + var response = PriceSheetRestClient.DownloadByInvoice(billingAccountName, billingProfileName, invoiceName, cancellationToken); + var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByInvoiceRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -779,41 +879,43 @@ public virtual ArmOperation Generate } /// - /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + /// + /// Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// ReservationScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> DownloadPriceSheetByBillingProfileAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - using var scope = ReservationScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationScope"); + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheetByBillingProfile"); scope.Start(); try { - var response = await ReservationScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationScopeClientDiagnostics, Pipeline, ReservationScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); + var response = await PriceSheetRestClient.DownloadByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new PricesheetDownloadPropertiesOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -826,41 +928,43 @@ public virtual async Task - /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + /// + /// Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. /// /// /// Request Path - /// /providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download /// /// /// Operation Id - /// ReservationScope_GenerateBenefitUtilizationSummariesReport + /// PriceSheet_DownloadByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile Name. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation DownloadPriceSheetByBillingProfile(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); + Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - using var scope = ReservationScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationScope"); + using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheetByBillingProfile"); scope.Start(); try { - var response = ReservationScopeRestClient.GenerateBenefitUtilizationSummariesReport(reservationOrderId, reservationId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), ReservationScopeClientDiagnostics, Pipeline, ReservationScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); + var response = PriceSheetRestClient.DownloadByBillingProfile(billingAccountName, billingProfileName, cancellationToken); + var operation = new CostManagementArmOperation(new PricesheetDownloadPropertiesOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -873,294 +977,408 @@ public virtual ArmOperation Generate } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. + /// BillingAccount ID. + /// Billing Profile ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingProfileIdAsync(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var scope = SavingsPlanOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); - scope.Start(); - try - { - var response = await SavingsPlanOrderScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanOrderScopeClientDiagnostics, Pipeline, SavingsPlanOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport + /// BenefitUtilizationSummaries_ListByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// + /// BillingAccount ID. + /// Billing Profile ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// or is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesByBillingProfileId(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingProfileId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListByBillingAccountId + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// + /// BillingAccount ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesByBillingAccountIdAsync(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// + /// + /// Request Path + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListByBillingAccountId + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// + /// BillingAccount ID. + /// Grain. + /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesByBillingAccountId(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesByBillingAccountId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the savings plan utilization summaries for daily or monthly grain. + /// + /// + /// Request Path + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListBySavingsPlanOrder + /// + /// + /// Default Api Version + /// 2025-03-01 /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = SavingsPlanOrderScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); - scope.Start(); - try - { - var response = SavingsPlanOrderScopeRestClient.GenerateBenefitUtilizationSummariesReport(savingsPlanOrderId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanOrderScopeClientDiagnostics, Pipeline, SavingsPlanOrderScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// Lists the savings plan utilization summaries for daily or monthly grain. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync + /// BenefitUtilizationSummaries_ListBySavingsPlanOrder /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// + /// Savings plan order ID. + /// Supports filtering by properties/usageDate. + /// Grain. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanOrder(string savingsPlanOrderId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderRequest(savingsPlanOrderId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanOrderNextPageRequest(nextLink, savingsPlanOrderId, filter, grainParameter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrder", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the savings plan utilization summaries for daily or monthly grain. + /// + /// + /// Request Path + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries + /// + /// + /// Operation Id + /// BenefitUtilizationSummaries_ListBySavingsPlanId + /// + /// + /// Default Api Version + /// 2025-03-01 /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBenefitUtilizationSummariesBySavingsPlanIdAsync(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = SavingsPlanScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); - scope.Start(); - try - { - var response = await SavingsPlanScopeRestClient.GenerateBenefitUtilizationSummariesReportAsyncAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanScopeClientDiagnostics, Pipeline, SavingsPlanScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); } /// - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// Lists the savings plan utilization summaries for daily or monthly grain. /// /// /// Request Path - /// /providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries /// /// /// Operation Id - /// SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync + /// BenefitUtilizationSummaries_ListBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// Savings plan order ID. /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. + /// Supports filtering by properties/usageDate. + /// Grain. /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBenefitUtilizationSummariesBySavingsPlanId(string savingsPlanOrderId, string savingsPlanId, string filter = null, GrainContent? grainParameter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = SavingsPlanScopeClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); - scope.Start(); - try - { - var response = SavingsPlanScopeRestClient.GenerateBenefitUtilizationSummariesReportAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken); - var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), SavingsPlanScopeClientDiagnostics, Pipeline, SavingsPlanScopeRestClient.CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, filter, grainParameter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => BenefitUtilizationSummariesRestClient.CreateListBySavingsPlanIdNextPageRequest(nextLink, savingsPlanOrderId, savingsPlanId, filter, grainParameter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BenefitUtilizationSummary.DeserializeBenefitUtilizationSummary(e), BenefitUtilizationSummariesClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetBenefitUtilizationSummariesBySavingsPlanId", "value", "nextLink", cancellationToken); } /// - /// Lists the Alerts for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Alerts_ListExternal + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 - /// - /// - /// Resource - /// + /// 2025-03-01 /// /// /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Billing Profile ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetCostManagementAlertsAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetCostManagementAlerts", "value", null, cancellationToken); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); + scope.Start(); + try + { + var response = await GenerateBenefitUtilizationSummariesReportRestClient.GenerateByBillingProfileAsync(billingAccountId, billingProfileId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByBillingProfileRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists the Alerts for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Alerts_ListExternal + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingProfile /// /// /// Default Api Version - /// 2023-03-01 - /// - /// - /// Resource - /// + /// 2025-03-01 /// /// /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Billing Profile ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetCostManagementAlerts(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingProfileScope(WaitUntil waitUntil, string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CostManagementAlertAlertsRestClient.CreateListExternalRequest(externalCloudProviderType, externalCloudProviderId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new CostManagementAlertResource(Client, CostManagementAlertData.DeserializeCostManagementAlertData(e)), CostManagementAlertAlertsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.GetCostManagementAlerts", "value", null, cancellationToken); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScope"); + scope.Start(); + try + { + var response = GenerateBenefitUtilizationSummariesReportRestClient.GenerateByBillingProfile(billingAccountId, billingProfileId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByBillingProfileRequest(billingAccountId, billingProfileId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists the forecast charges for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Forecast_ExternalCloudProviderUsage + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> ExternalCloudProviderUsageForecastAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ForecastClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ExternalCloudProviderUsageForecast"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); scope.Start(); try { - var response = await ForecastRestClient.ExternalCloudProviderUsageAsync(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken).ConfigureAwait(false); - return response; + var response = await GenerateBenefitUtilizationSummariesReportRestClient.GenerateByBillingAccountAsync(billingAccountId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByBillingAccountRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -1170,40 +1388,42 @@ public virtual async Task> ExternalCloudProviderUsageFo } /// - /// Lists the forecast charges for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Forecast_ExternalCloudProviderUsage + /// GenerateBenefitUtilizationSummariesReport_GenerateByBillingAccount /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. - /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// BillingAccount ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual Response ExternalCloudProviderUsageForecast(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, ForecastDefinition forecastDefinition, string filter = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportBillingAccountScope(WaitUntil waitUntil, string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(forecastDefinition, nameof(forecastDefinition)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ForecastClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ExternalCloudProviderUsageForecast"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScope"); scope.Start(); try { - var response = ForecastRestClient.ExternalCloudProviderUsage(externalCloudProviderType, externalCloudProviderId, forecastDefinition, filter, cancellationToken); - return response; + var response = GenerateBenefitUtilizationSummariesReportRestClient.GenerateByBillingAccount(billingAccountId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByBillingAccountRequest(billingAccountId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -1213,97 +1433,134 @@ public virtual Response ExternalCloudProviderUsageForecast(Exter } /// - /// Lists the dimensions by the external cloud provider type. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Dimensions_ByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ByExternalCloudProviderTypeDimensionsAsync(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.ByExternalCloudProviderTypeDimensions", "value", null, cancellationToken); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); + scope.Start(); + try + { + var response = await GenerateBenefitUtilizationSummariesReportRestClient.GenerateBySavingsPlanOrderIdAsync(savingsPlanOrderId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateBySavingsPlanOrderIdRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists the dimensions by the external cloud provider type. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Dimensions_ByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ByExternalCloudProviderTypeDimensions(TenantResourceByExternalCloudProviderTypeDimensionsOptions options, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope(WaitUntil waitUntil, string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => DimensionsRestClient.CreateByExternalCloudProviderTypeRequest(options.ExternalCloudProviderType, options.ExternalCloudProviderId, options.Filter, options.Expand, options.Skiptoken, options.Top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => CostManagementDimension.DeserializeCostManagementDimension(e), DimensionsClientDiagnostics, Pipeline, "MockableCostManagementTenantResource.ByExternalCloudProviderTypeDimensions", "value", null, cancellationToken); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope"); + scope.Start(); + try + { + var response = GenerateBenefitUtilizationSummariesReportRestClient.GenerateBySavingsPlanOrderId(savingsPlanOrderId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateBySavingsPlanOrderIdRequest(savingsPlanOrderId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Query the usage data for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Query_UsageByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> UsageByExternalCloudProviderTypeQueryAsync(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = QueryClientDiagnostics.CreateScope("MockableCostManagementTenantResource.UsageByExternalCloudProviderTypeQuery"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); scope.Start(); try { - var response = await QueryRestClient.UsageByExternalCloudProviderTypeAsync(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken).ConfigureAwait(false); - return response; + var response = await GenerateBenefitUtilizationSummariesReportRestClient.GenerateBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -1313,39 +1570,44 @@ public virtual async Task> UsageByExternalCloudProviderTyp } /// - /// Query the usage data for external cloud provider type defined. + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. /// /// /// Request Path - /// /providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query + /// /providers/microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// Query_UsageByExternalCloudProviderType + /// GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// - /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. - /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual Response UsageByExternalCloudProviderTypeQuery(ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, QueryDefinition queryDefinition, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope(WaitUntil waitUntil, string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); - Argument.AssertNotNull(queryDefinition, nameof(queryDefinition)); + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = QueryClientDiagnostics.CreateScope("MockableCostManagementTenantResource.UsageByExternalCloudProviderTypeQuery"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope"); scope.Start(); try { - var response = QueryRestClient.UsageByExternalCloudProviderType(externalCloudProviderType, externalCloudProviderId, queryDefinition, cancellationToken); - return response; + var response = GenerateBenefitUtilizationSummariesReportRestClient.GenerateBySavingsPlanId(savingsPlanOrderId, savingsPlanId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -1355,41 +1617,39 @@ public virtual Response UsageByExternalCloudProviderTypeQuery(Exter } /// - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingAccountId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Enrollment ID (Legacy BillingAccount ID). - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingAccountIdGenerateReservationDetailsReport"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); scope.Start(); try { - var response = await GenerateReservationDetailsReportRestClient.ByBillingAccountIdAsync(billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + var response = await GenerateBenefitUtilizationSummariesReportRestClient.GenerateByReservationOrderIdAsync(reservationOrderId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByReservationOrderIdRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1402,41 +1662,39 @@ public virtual async Task> ByBillingAccountIdGener } /// - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingAccountId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationOrderId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Enrollment ID (Legacy BillingAccount ID). - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationOrderScope(WaitUntil waitUntil, string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingAccountIdGenerateReservationDetailsReport"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScope"); scope.Start(); try { - var response = GenerateReservationDetailsReportRestClient.ByBillingAccountId(billingAccountId, startDate, endDate, cancellationToken); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + var response = GenerateBenefitUtilizationSummariesReportRestClient.GenerateByReservationOrderId(reservationOrderId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByReservationOrderIdRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1449,43 +1707,41 @@ public virtual ArmOperation ByBillingAccountIdGenerateReservati } /// - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + /// Triggers generation of a benefit utilization summaries report for the provided reservation. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingProfileId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public virtual async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> GenerateBenefitUtilizationSummariesReportReservationScopeAsync(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingProfileIdGenerateReservationDetailsReport"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationScope"); scope.Start(); try { - var response = await GenerateReservationDetailsReportRestClient.ByBillingProfileIdAsync(billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + var response = await GenerateBenefitUtilizationSummariesReportRestClient.GenerateByReservationIdAsync(reservationOrderId, reservationId, content, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByReservationIdRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1498,43 +1754,41 @@ public virtual async Task> ByBillingProfileIdGener } /// - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access + /// Triggers generation of a benefit utilization summaries report for the provided reservation. /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport + /// /providers/microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport /// /// /// Operation Id - /// GenerateReservationDetailsReport_ByBillingProfileId + /// GenerateBenefitUtilizationSummariesReport_GenerateByReservationId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Billing account ID. - /// Billing profile ID. - /// Start Date. - /// End Date. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// , , or is null. - public virtual ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation GenerateBenefitUtilizationSummariesReportReservationScope(WaitUntil waitUntil, string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(startDate, nameof(startDate)); - Argument.AssertNotNull(endDate, nameof(endDate)); + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingProfileIdGenerateReservationDetailsReport"); + using var scope = GenerateBenefitUtilizationSummariesReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.GenerateBenefitUtilizationSummariesReportReservationScope"); scope.Start(); try { - var response = GenerateReservationDetailsReportRestClient.ByBillingProfileId(billingAccountId, billingProfileId, startDate, endDate, cancellationToken); - var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); + var response = GenerateBenefitUtilizationSummariesReportRestClient.GenerateByReservationId(reservationOrderId, reservationId, content, cancellationToken); + var operation = new CostManagementArmOperation(new BenefitUtilizationSummariesOperationStatusOperationSource(), GenerateBenefitUtilizationSummariesReportClientDiagnostics, Pipeline, GenerateBenefitUtilizationSummariesReportRestClient.CreateGenerateByReservationIdRequest(reservationOrderId, reservationId, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1547,41 +1801,43 @@ public virtual ArmOperation ByBillingProfileIdGenerateReservati } /// - /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_Download + /// GenerateReservationDetailsReport_ByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice. + /// BillingAccount ID. + /// Billing Profile ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual async Task> DownloadPriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual async Task> ByBillingProfileIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); - using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheet"); + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingProfileIdGenerateReservationDetailsReport"); scope.Start(); try { - var response = await PriceSheetRestClient.DownloadAsync(billingAccountName, billingProfileName, invoiceName, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); + var response = await GenerateReservationDetailsReportRestClient.ByBillingProfileIdAsync(billingAccountId, billingProfileId, startDate, endDate, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1594,41 +1850,43 @@ public virtual async Task> DownloadPriceSheetAsync(Wai } /// - /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_Download + /// GenerateReservationDetailsReport_ByBillingProfileId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies an invoice. + /// BillingAccount ID. + /// Billing Profile ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. - /// , or is null. - public virtual ArmOperation DownloadPriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , , or is null. + public virtual ArmOperation ByBillingProfileIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); - using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadPriceSheet"); + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingProfileIdGenerateReservationDetailsReport"); scope.Start(); try { - var response = PriceSheetRestClient.Download(billingAccountName, billingProfileName, invoiceName, cancellationToken); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName).Request, response, OperationFinalStateVia.Location); + var response = GenerateReservationDetailsReportRestClient.ByBillingProfileId(billingAccountId, billingProfileId, startDate, endDate, cancellationToken); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1641,39 +1899,41 @@ public virtual ArmOperation DownloadPriceSheet(WaitUntil waitUntil, } /// - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_DownloadByBillingProfile + /// GenerateReservationDetailsReport_ByBillingAccountId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// BillingAccount ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> DownloadByBillingProfilePriceSheetAsync(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual async Task> ByBillingAccountIdGenerateReservationDetailsReportAsync(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); - using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingProfilePriceSheet"); + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingAccountIdGenerateReservationDetailsReport"); scope.Start(); try { - var response = await PriceSheetRestClient.DownloadByBillingProfileAsync(billingAccountName, billingProfileName, cancellationToken).ConfigureAwait(false); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); + var response = await GenerateReservationDetailsReportRestClient.ByBillingAccountIdAsync(billingAccountId, startDate, endDate, cancellationToken).ConfigureAwait(false); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1686,39 +1946,41 @@ public virtual async Task> DownloadByBillingProfilePri } /// - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role /// /// /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport /// /// /// Operation Id - /// PriceSheet_DownloadByBillingProfile + /// GenerateReservationDetailsReport_ByBillingAccountId /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// BillingAccount ID. + /// Start Date. + /// End Date. /// The cancellation token to use. - /// or is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation DownloadByBillingProfilePriceSheet(WaitUntil waitUntil, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public virtual ArmOperation ByBillingAccountIdGenerateReservationDetailsReport(WaitUntil waitUntil, string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(startDate, nameof(startDate)); + Argument.AssertNotNull(endDate, nameof(endDate)); - using var scope = PriceSheetClientDiagnostics.CreateScope("MockableCostManagementTenantResource.DownloadByBillingProfilePriceSheet"); + using var scope = GenerateReservationDetailsReportClientDiagnostics.CreateScope("MockableCostManagementTenantResource.ByBillingAccountIdGenerateReservationDetailsReport"); scope.Start(); try { - var response = PriceSheetRestClient.DownloadByBillingProfile(billingAccountName, billingProfileName, cancellationToken); - var operation = new CostManagementArmOperation(new DownloadURLOperationSource(), PriceSheetClientDiagnostics, Pipeline, PriceSheetRestClient.CreateDownloadByBillingProfileRequest(billingAccountName, billingProfileName).Request, response, OperationFinalStateVia.Location); + var response = GenerateReservationDetailsReportRestClient.ByBillingAccountId(billingAccountId, startDate, endDate, cancellationToken); + var operation = new CostManagementArmOperation(new OperationStatusOperationSource(), GenerateReservationDetailsReportClientDiagnostics, Pipeline, GenerateReservationDetailsReportRestClient.CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1731,34 +1993,38 @@ public virtual ArmOperation DownloadByBillingProfilePriceSheet(Wait } /// - /// Checks availability and correctness of the name for a scheduled action. + /// Checks availability and correctness of a name for a cost allocation rule /// /// /// Request Path - /// /providers/Microsoft.CostManagement/checkNameAvailability + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability /// /// /// Operation Id - /// ScheduledActions_CheckNameAvailability + /// CostAllocationRules_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// - /// Scheduled action to be created or updated. + /// Cost allocation rule to be created or updated. /// The cancellation token to use. /// is null. - public virtual async Task> CheckCostManagementNameAvailabilityByScheduledActionAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual async Task> CheckNameAvailabilityCostAllocationRuleAsync(CostAllocationRuleCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckCostManagementNameAvailabilityByScheduledAction"); + using var scope = CostAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckNameAvailabilityCostAllocationRule"); scope.Start(); try { - var response = await ScheduledActionsRestClient.CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + var response = await CostAllocationRuleDefinitionCostAllocationRulesRestClient.CheckNameAvailabilityAsync(_billingAccountId, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1769,34 +2035,38 @@ public virtual async Task> CheckC } /// - /// Checks availability and correctness of the name for a scheduled action. + /// Checks availability and correctness of a name for a cost allocation rule /// /// /// Request Path - /// /providers/Microsoft.CostManagement/checkNameAvailability + /// /providers/microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability /// /// /// Operation Id - /// ScheduledActions_CheckNameAvailability + /// CostAllocationRules_CheckNameAvailability /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 + /// + /// + /// Resource + /// /// /// /// - /// Scheduled action to be created or updated. + /// Cost allocation rule to be created or updated. /// The cancellation token to use. /// is null. - public virtual Response CheckCostManagementNameAvailabilityByScheduledAction(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual Response CheckNameAvailabilityCostAllocationRule(CostAllocationRuleCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckCostManagementNameAvailabilityByScheduledAction"); + using var scope = CostAllocationRuleDefinitionCostAllocationRulesClientDiagnostics.CreateScope("MockableCostManagementTenantResource.CheckNameAvailabilityCostAllocationRule"); scope.Start(); try { - var response = ScheduledActionsRestClient.CheckNameAvailability(content, cancellationToken); + var response = CostAllocationRuleDefinitionCostAllocationRulesRestClient.CheckNameAvailability(_billingAccountId, content, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/LongRunningOperation/PricesheetDownloadPropertiesOperationSource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/LongRunningOperation/PricesheetDownloadPropertiesOperationSource.cs new file mode 100644 index 000000000000..c899026b97a3 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/LongRunningOperation/PricesheetDownloadPropertiesOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + internal class PricesheetDownloadPropertiesOperationSource : IOperationSource + { + PricesheetDownloadProperties IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return PricesheetDownloadProperties.DeserializePricesheetDownloadProperties(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return PricesheetDownloadProperties.DeserializePricesheetDownloadProperties(document.RootElement); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AzureResourceManagerCostManagementContext.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AzureResourceManagerCostManagementContext.cs index 9552e290febb..b5e44bddd68a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AzureResourceManagerCostManagementContext.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/AzureResourceManagerCostManagementContext.cs @@ -27,7 +27,23 @@ namespace Azure.ResourceManager.CostManagement [ModelReaderWriterBuildable(typeof(BenefitUtilizationSummariesListResult))] [ModelReaderWriterBuildable(typeof(BenefitUtilizationSummariesOperationStatus))] [ModelReaderWriterBuildable(typeof(BenefitUtilizationSummary))] + [ModelReaderWriterBuildable(typeof(BudgetComparisonExpression))] + [ModelReaderWriterBuildable(typeof(BudgetData))] + [ModelReaderWriterBuildable(typeof(BudgetFilter))] + [ModelReaderWriterBuildable(typeof(BudgetFilterProperties))] + [ModelReaderWriterBuildable(typeof(BudgetResource))] + [ModelReaderWriterBuildable(typeof(BudgetsListResult))] + [ModelReaderWriterBuildable(typeof(BudgetTimePeriod))] [ModelReaderWriterBuildable(typeof(CommonExportProperties))] + [ModelReaderWriterBuildable(typeof(CostAllocationProportion))] + [ModelReaderWriterBuildable(typeof(CostAllocationResource))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleCheckNameAvailabilityContent))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleCheckNameAvailabilityResponse))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleDefinitionData))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleDefinitionResource))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleDetails))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleList))] + [ModelReaderWriterBuildable(typeof(CostAllocationRuleProperties))] [ModelReaderWriterBuildable(typeof(CostManagementAlertData))] [ModelReaderWriterBuildable(typeof(CostManagementAlertPatch))] [ModelReaderWriterBuildable(typeof(CostManagementAlertResource))] @@ -40,6 +56,7 @@ namespace Azure.ResourceManager.CostManagement [ModelReaderWriterBuildable(typeof(CostManagementNameAvailabilityResult))] [ModelReaderWriterBuildable(typeof(CostManagementViewData))] [ModelReaderWriterBuildable(typeof(CostManagementViewsResource))] + [ModelReaderWriterBuildable(typeof(CurrentSpend))] [ModelReaderWriterBuildable(typeof(DownloadURL))] [ModelReaderWriterBuildable(typeof(ExportDataset))] [ModelReaderWriterBuildable(typeof(ExportDatasetConfiguration))] @@ -50,10 +67,13 @@ namespace Azure.ResourceManager.CostManagement [ModelReaderWriterBuildable(typeof(ExportListResult))] [ModelReaderWriterBuildable(typeof(ExportRecurrencePeriod))] [ModelReaderWriterBuildable(typeof(ExportRun))] + [ModelReaderWriterBuildable(typeof(ExportRunContent))] [ModelReaderWriterBuildable(typeof(ExportRunErrorDetails))] [ModelReaderWriterBuildable(typeof(ExportSchedule))] + [ModelReaderWriterBuildable(typeof(ExportSuspensionContext))] [ModelReaderWriterBuildable(typeof(ExportTimePeriod))] [ModelReaderWriterBuildable(typeof(FileDestination))] + [ModelReaderWriterBuildable(typeof(FilterItems))] [ModelReaderWriterBuildable(typeof(ForecastAggregation))] [ModelReaderWriterBuildable(typeof(ForecastColumn))] [ModelReaderWriterBuildable(typeof(ForecastComparisonExpression))] @@ -62,10 +82,15 @@ namespace Azure.ResourceManager.CostManagement [ModelReaderWriterBuildable(typeof(ForecastDefinition))] [ModelReaderWriterBuildable(typeof(ForecastFilter))] [ModelReaderWriterBuildable(typeof(ForecastResult))] + [ModelReaderWriterBuildable(typeof(ForecastSpend))] [ModelReaderWriterBuildable(typeof(ForecastTimePeriod))] [ModelReaderWriterBuildable(typeof(IncludedQuantityUtilizationSummary))] + [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] + [ModelReaderWriterBuildable(typeof(MCAPriceSheetProperties))] + [ModelReaderWriterBuildable(typeof(Notification))] [ModelReaderWriterBuildable(typeof(NotificationProperties))] [ModelReaderWriterBuildable(typeof(OperationStatus))] + [ModelReaderWriterBuildable(typeof(PricesheetDownloadProperties))] [ModelReaderWriterBuildable(typeof(QueryAggregation))] [ModelReaderWriterBuildable(typeof(QueryColumn))] [ModelReaderWriterBuildable(typeof(QueryComparisonExpression))] @@ -91,14 +116,22 @@ namespace Azure.ResourceManager.CostManagement [ModelReaderWriterBuildable(typeof(ScheduledActionListResult))] [ModelReaderWriterBuildable(typeof(ScheduledActionResource))] [ModelReaderWriterBuildable(typeof(ScheduleProperties))] + [ModelReaderWriterBuildable(typeof(SettingData))] + [ModelReaderWriterBuildable(typeof(SettingResource))] + [ModelReaderWriterBuildable(typeof(SettingsListResult))] [ModelReaderWriterBuildable(typeof(SharedScopeBenefitRecommendationProperties))] [ModelReaderWriterBuildable(typeof(SingleScopeBenefitRecommendationProperties))] + [ModelReaderWriterBuildable(typeof(SourceCostAllocationResource))] [ModelReaderWriterBuildable(typeof(SystemData))] + [ModelReaderWriterBuildable(typeof(TagInheritanceProperties))] + [ModelReaderWriterBuildable(typeof(TagInheritanceSetting))] + [ModelReaderWriterBuildable(typeof(TargetCostAllocationResource))] [ModelReaderWriterBuildable(typeof(TenantResourceByExternalCloudProviderTypeDimensionsOptions))] [ModelReaderWriterBuildable(typeof(TenantScheduledActionResource))] [ModelReaderWriterBuildable(typeof(TenantsCostManagementViewsResource))] [ModelReaderWriterBuildable(typeof(UnknownBenefitRecommendationProperties))] [ModelReaderWriterBuildable(typeof(UnknownBenefitUtilizationSummary))] + [ModelReaderWriterBuildable(typeof(UnknownSetting))] [ModelReaderWriterBuildable(typeof(ViewKpiProperties))] [ModelReaderWriterBuildable(typeof(ViewListResult))] [ModelReaderWriterBuildable(typeof(ViewPivotProperties))] diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs index ea66732e43f8..e084ca8bea51 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.Serialization.cs @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink.AbsoluteUri); + writer.WriteStringValue(NextLink); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,7 +87,7 @@ internal static BenefitRecommendationsListResult DeserializeBenefitRecommendatio return null; } IReadOnlyList value = default; - Uri nextLink = default; + string nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -108,11 +108,7 @@ internal static BenefitRecommendationsListResult DeserializeBenefitRecommendatio } if (property.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nextLink = new Uri(property.Value.GetString()); + nextLink = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs index 4ba3ccfc992a..df4f6fd3a56e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitRecommendationsListResult.cs @@ -53,9 +53,9 @@ internal BenefitRecommendationsListResult() /// Initializes a new instance of . /// The list of benefit recommendations. - /// The link (URL) to the next page of results. + /// The link (url) to the next page of results. /// Keeps track of any properties unknown to the library. - internal BenefitRecommendationsListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal BenefitRecommendationsListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -64,7 +64,7 @@ internal BenefitRecommendationsListResult(IReadOnlyList The list of benefit recommendations. public IReadOnlyList Value { get; } - /// The link (URL) to the next page of results. - public Uri NextLink { get; } + /// The link (url) to the next page of results. + public string NextLink { get; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs index 9cd7908e9659..ec5f42b4bbb6 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.Serialization.cs @@ -44,10 +44,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink.AbsoluteUri); + writer.WriteStringValue(NextLink); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,7 +87,7 @@ internal static BenefitUtilizationSummariesListResult DeserializeBenefitUtilizat return null; } IReadOnlyList value = default; - Uri nextLink = default; + string nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -108,11 +108,7 @@ internal static BenefitUtilizationSummariesListResult DeserializeBenefitUtilizat } if (property.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nextLink = new Uri(property.Value.GetString()); + nextLink = property.Value.GetString(); continue; } if (options.Format != "W") diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs index 26ba4da848ec..feb052b0dca8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BenefitUtilizationSummariesListResult.cs @@ -59,7 +59,7 @@ internal BenefitUtilizationSummariesListResult() /// /// The link (URL) to the next page of results. /// Keeps track of any properties unknown to the library. - internal BenefitUtilizationSummariesListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal BenefitUtilizationSummariesListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,6 +73,6 @@ internal BenefitUtilizationSummariesListResult(IReadOnlyList public IReadOnlyList Value { get; } /// The link (URL) to the next page of results. - public Uri NextLink { get; } + public string NextLink { get; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetComparisonExpression.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetComparisonExpression.Serialization.cs new file mode 100644 index 000000000000..421900b9cbac --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetComparisonExpression.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class BudgetComparisonExpression : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetComparisonExpression)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("operator"u8); + writer.WriteStringValue(Operator.ToString()); + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BudgetComparisonExpression IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetComparisonExpression)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetComparisonExpression(document.RootElement, options); + } + + internal static BudgetComparisonExpression DeserializeBudgetComparisonExpression(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + BudgetOperatorType @operator = default; + IList values = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = new BudgetOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BudgetComparisonExpression(name, @operator, values, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(BudgetComparisonExpression)} does not support writing '{options.Format}' format."); + } + } + + BudgetComparisonExpression IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBudgetComparisonExpression(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BudgetComparisonExpression)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetComparisonExpression.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetComparisonExpression.cs new file mode 100644 index 000000000000..a65f32132129 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetComparisonExpression.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The comparison expression to be used in the budgets. + public partial class BudgetComparisonExpression + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the column to use in comparison. + /// The operator to use for comparison. + /// Array of values to use for comparison. + /// or is null. + public BudgetComparisonExpression(string name, BudgetOperatorType @operator, IEnumerable values) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(values, nameof(values)); + + Name = name; + Operator = @operator; + Values = values.ToList(); + } + + /// Initializes a new instance of . + /// The name of the column to use in comparison. + /// The operator to use for comparison. + /// Array of values to use for comparison. + /// Keeps track of any properties unknown to the library. + internal BudgetComparisonExpression(string name, BudgetOperatorType @operator, IList values, IDictionary serializedAdditionalRawData) + { + Name = name; + Operator = @operator; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BudgetComparisonExpression() + { + } + + /// The name of the column to use in comparison. + public string Name { get; set; } + /// The operator to use for comparison. + public BudgetOperatorType Operator { get; set; } + /// Array of values to use for comparison. + public IList Values { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilter.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilter.Serialization.cs new file mode 100644 index 000000000000..935ac0c55608 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilter.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class BudgetFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(And)) + { + writer.WritePropertyName("and"u8); + writer.WriteStartArray(); + foreach (var item in And) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Dimensions)) + { + writer.WritePropertyName("dimensions"u8); + writer.WriteObjectValue(Dimensions, options); + } + if (Optional.IsDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteObjectValue(Tags, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BudgetFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetFilter(document.RootElement, options); + } + + internal static BudgetFilter DeserializeBudgetFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList and = default; + BudgetComparisonExpression dimensions = default; + BudgetComparisonExpression tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("and"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BudgetFilterProperties.DeserializeBudgetFilterProperties(item, options)); + } + and = array; + continue; + } + if (property.NameEquals("dimensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dimensions = BudgetComparisonExpression.DeserializeBudgetComparisonExpression(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tags = BudgetComparisonExpression.DeserializeBudgetComparisonExpression(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BudgetFilter(and ?? new ChangeTrackingList(), dimensions, tags, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(BudgetFilter)} does not support writing '{options.Format}' format."); + } + } + + BudgetFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBudgetFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BudgetFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilter.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilter.cs new file mode 100644 index 000000000000..40291c52c944 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilter.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// May be used to filter budgets by user-specified dimensions and/or tags. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public partial class BudgetFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BudgetFilter() + { + And = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The logical "AND" expression. Must have at least 2 items. + /// + /// Supported for CategoryType(s): Cost. + /// + /// + /// Has comparison expression for a dimension. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported dimension names for **CategoryType: ReservationUtilization** + /// - ReservationId + /// - ReservedResourceType + /// + /// + /// Has comparison expression for a tag. + /// + /// Supported for CategoryType(s): Cost. + /// + /// Keeps track of any properties unknown to the library. + internal BudgetFilter(IList and, BudgetComparisonExpression dimensions, BudgetComparisonExpression tags, IDictionary serializedAdditionalRawData) + { + And = and; + Dimensions = dimensions; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The logical "AND" expression. Must have at least 2 items. + /// + /// Supported for CategoryType(s): Cost. + /// + public IList And { get; } + /// + /// Has comparison expression for a dimension. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported dimension names for **CategoryType: ReservationUtilization** + /// - ReservationId + /// - ReservedResourceType + /// + public BudgetComparisonExpression Dimensions { get; set; } + /// + /// Has comparison expression for a tag. + /// + /// Supported for CategoryType(s): Cost. + /// + public BudgetComparisonExpression Tags { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilterProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilterProperties.Serialization.cs new file mode 100644 index 000000000000..6794efab5938 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilterProperties.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class BudgetFilterProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetFilterProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Dimensions)) + { + writer.WritePropertyName("dimensions"u8); + writer.WriteObjectValue(Dimensions, options); + } + if (Optional.IsDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteObjectValue(Tags, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BudgetFilterProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetFilterProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetFilterProperties(document.RootElement, options); + } + + internal static BudgetFilterProperties DeserializeBudgetFilterProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BudgetComparisonExpression dimensions = default; + BudgetComparisonExpression tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dimensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dimensions = BudgetComparisonExpression.DeserializeBudgetComparisonExpression(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tags = BudgetComparisonExpression.DeserializeBudgetComparisonExpression(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BudgetFilterProperties(dimensions, tags, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(BudgetFilterProperties)} does not support writing '{options.Format}' format."); + } + } + + BudgetFilterProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBudgetFilterProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BudgetFilterProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilterProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilterProperties.cs new file mode 100644 index 000000000000..4d2236be1ba6 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetFilterProperties.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The Dimensions or Tags to filter a budget by. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public partial class BudgetFilterProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BudgetFilterProperties() + { + } + + /// Initializes a new instance of . + /// + /// Has comparison expression for a dimension. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported dimension names for **CategoryType: ReservationUtilization** + /// - ReservationId + /// - ReservedResourceType + /// + /// + /// Has comparison expression for a tag. + /// + /// Supported for CategoryType(s): Cost. + /// + /// Keeps track of any properties unknown to the library. + internal BudgetFilterProperties(BudgetComparisonExpression dimensions, BudgetComparisonExpression tags, IDictionary serializedAdditionalRawData) + { + Dimensions = dimensions; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// Has comparison expression for a dimension. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported dimension names for **CategoryType: ReservationUtilization** + /// - ReservationId + /// - ReservedResourceType + /// + public BudgetComparisonExpression Dimensions { get; set; } + /// + /// Has comparison expression for a tag. + /// + /// Supported for CategoryType(s): Cost. + /// + public BudgetComparisonExpression Tags { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetNotificationOperatorType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetNotificationOperatorType.cs new file mode 100644 index 000000000000..4f4e2cd7597b --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetNotificationOperatorType.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The comparison operator. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported operators for **CategoryType: Cost** + /// - GreaterThan + /// - GreaterThanOrEqualTo + /// + /// Supported operators for **CategoryType: ReservationUtilization** + /// - LessThan + /// + public readonly partial struct BudgetNotificationOperatorType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BudgetNotificationOperatorType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EqualToValue = "EqualTo"; + private const string GreaterThanValue = "GreaterThan"; + private const string GreaterThanOrEqualToValue = "GreaterThanOrEqualTo"; + private const string LessThanValue = "LessThan"; + + /// + /// Notification 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. + /// + /// Supported for CategoryType(s): Cost. + /// + public static BudgetNotificationOperatorType EqualTo { get; } = new BudgetNotificationOperatorType(EqualToValue); + /// + /// Notification will be triggered if the evaluated cost is greater than the threshold value. Note: This is the recommended OperatorType while configuring Budget Alert. + /// + /// Supported for CategoryType(s): Cost. + /// + public static BudgetNotificationOperatorType GreaterThan { get; } = new BudgetNotificationOperatorType(GreaterThanValue); + /// + /// Notification will be triggered if the evaluated cost is greater than or equal to the threshold value. + /// + /// Supported for CategoryType(s): Cost. + /// + public static BudgetNotificationOperatorType GreaterThanOrEqualTo { get; } = new BudgetNotificationOperatorType(GreaterThanOrEqualToValue); + /// + /// Notification will be triggered if any Reservations in the scope of the Reservation Utilization Alert Rule have a utilization less than the threshold percentage. + /// + /// Supported for CategoryType(s): ReservationUtilization. + /// + public static BudgetNotificationOperatorType LessThan { get; } = new BudgetNotificationOperatorType(LessThanValue); + /// Determines if two values are the same. + public static bool operator ==(BudgetNotificationOperatorType left, BudgetNotificationOperatorType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BudgetNotificationOperatorType left, BudgetNotificationOperatorType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator BudgetNotificationOperatorType(string value) => new BudgetNotificationOperatorType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BudgetNotificationOperatorType other && Equals(other); + /// + public bool Equals(BudgetNotificationOperatorType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetOperatorType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetOperatorType.cs new file mode 100644 index 000000000000..c59b681b78ad --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetOperatorType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The operator to use for comparison. + public readonly partial struct BudgetOperatorType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BudgetOperatorType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InValue = "In"; + + /// In. + public static BudgetOperatorType In { get; } = new BudgetOperatorType(InValue); + /// Determines if two values are the same. + public static bool operator ==(BudgetOperatorType left, BudgetOperatorType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BudgetOperatorType left, BudgetOperatorType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator BudgetOperatorType(string value) => new BudgetOperatorType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BudgetOperatorType other && Equals(other); + /// + public bool Equals(BudgetOperatorType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetTimePeriod.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetTimePeriod.Serialization.cs new file mode 100644 index 000000000000..f10267fa3db1 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetTimePeriod.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class BudgetTimePeriod : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetTimePeriod)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("startDate"u8); + writer.WriteStringValue(StartOn, "O"); + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDate"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BudgetTimePeriod IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetTimePeriod)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetTimePeriod(document.RootElement, options); + } + + internal static BudgetTimePeriod DeserializeBudgetTimePeriod(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset startDate = default; + DateTimeOffset? endDate = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startDate"u8)) + { + startDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BudgetTimePeriod(startDate, endDate, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(BudgetTimePeriod)} does not support writing '{options.Format}' format."); + } + } + + BudgetTimePeriod IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBudgetTimePeriod(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BudgetTimePeriod)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetTimePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetTimePeriod.cs new file mode 100644 index 000000000000..b993cf138870 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetTimePeriod.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The time period that defines the active period of the budget. The budget will evaluate data on or after the startDate and will expire on the endDate. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + public partial class BudgetTimePeriod + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The start date for the budget. + /// + /// - Constraints for **CategoryType: Cost** - 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. + /// + /// - Constraints for **CategoryType: ReservationUtilization** - Must be on or after the current date and less than the end date. + /// + public BudgetTimePeriod(DateTimeOffset startOn) + { + StartOn = startOn; + } + + /// Initializes a new instance of . + /// + /// The start date for the budget. + /// + /// - Constraints for **CategoryType: Cost** - 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. + /// + /// - Constraints for **CategoryType: ReservationUtilization** - Must be on or after the current date and less than the end date. + /// + /// + /// The end date for the budget. + /// + /// - Constraints for **CategoryType: Cost** - No constraints. If not provided, we default this to 10 years from the start date. + /// + /// - Constraints for **CategoryType: ReservationUtilization** - End date cannot be more than 3 years after the start date. + /// + /// Keeps track of any properties unknown to the library. + internal BudgetTimePeriod(DateTimeOffset startOn, DateTimeOffset? endOn, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BudgetTimePeriod() + { + } + + /// + /// The start date for the budget. + /// + /// - Constraints for **CategoryType: Cost** - 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. + /// + /// - Constraints for **CategoryType: ReservationUtilization** - Must be on or after the current date and less than the end date. + /// + public DateTimeOffset StartOn { get; set; } + /// + /// The end date for the budget. + /// + /// - Constraints for **CategoryType: Cost** - No constraints. If not provided, we default this to 10 years from the start date. + /// + /// - Constraints for **CategoryType: ReservationUtilization** - End date cannot be more than 3 years after the start date. + /// + public DateTimeOffset? EndOn { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetsListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetsListResult.Serialization.cs new file mode 100644 index 000000000000..3b53cb91763e --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetsListResult.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + internal partial class BudgetsListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetsListResult)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BudgetsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BudgetsListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBudgetsListResult(document.RootElement, options); + } + + internal static BudgetsListResult DeserializeBudgetsListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BudgetData.DeserializeBudgetData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BudgetsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(BudgetsListResult)} does not support writing '{options.Format}' format."); + } + } + + BudgetsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBudgetsListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BudgetsListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetsListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetsListResult.cs new file mode 100644 index 000000000000..ab115bbe5ba9 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/BudgetsListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Result of listing budgets. It contains a list of available budgets in the scope provided. + internal partial class BudgetsListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal BudgetsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of budgets. + /// The link (url) to the next page of results.\r\nIt's null for now, added for future use. + /// Keeps track of any properties unknown to the library. + internal BudgetsListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of budgets. + public IReadOnlyList Value { get; } + /// The link (url) to the next page of results.\r\nIt's null for now, added for future use. + public string NextLink { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CategoryType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CategoryType.cs new file mode 100644 index 000000000000..606c5866d4ef --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CategoryType.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The category of the budget. + /// - 'Cost' defines a Budget. + /// - 'ReservationUtilization' defines a Reservation Utilization Alert Rule. + /// + public readonly partial struct CategoryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CategoryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CostValue = "Cost"; + private const string ReservationUtilizationValue = "ReservationUtilization"; + + /// A Budget that evaluates monetary cost of Azure resources against an amount, and alerts based on a configured notification threshold. + public static CategoryType Cost { get; } = new CategoryType(CostValue); + /// An Alert Rule that evaluates the utilization percentage of Azure Reservations, and alerts based on a configured notification threshold. + public static CategoryType ReservationUtilization { get; } = new CategoryType(ReservationUtilizationValue); + /// Determines if two values are the same. + public static bool operator ==(CategoryType left, CategoryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CategoryType left, CategoryType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CategoryType(string value) => new CategoryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CategoryType other && Equals(other); + /// + public bool Equals(CategoryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs index ce060b226c25..f9e9d12aa62c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.Serialization.cs @@ -53,11 +53,31 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("partitionData"u8); writer.WriteBooleanValue(PartitionData.Value); } + if (Optional.IsDefined(DataOverwriteBehavior)) + { + writer.WritePropertyName("dataOverwriteBehavior"u8); + writer.WriteStringValue(DataOverwriteBehavior.Value.ToString()); + } + if (Optional.IsDefined(CompressionMode)) + { + writer.WritePropertyName("compressionMode"u8); + writer.WriteStringValue(CompressionMode.Value.ToString()); + } + if (Optional.IsDefined(ExportDescription)) + { + writer.WritePropertyName("exportDescription"u8); + writer.WriteStringValue(ExportDescription); + } if (options.Format != "W" && Optional.IsDefined(NextRunTimeEstimate)) { writer.WritePropertyName("nextRunTimeEstimate"u8); writer.WriteStringValue(NextRunTimeEstimate.Value, "O"); } + if (options.Format != "W" && Optional.IsDefined(SystemSuspensionContext)) + { + writer.WritePropertyName("systemSuspensionContext"u8); + writer.WriteObjectValue(SystemSuspensionContext, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -100,7 +120,11 @@ internal static CommonExportProperties DeserializeCommonExportProperties(JsonEle ExportDefinition definition = default; ExportExecutionListResult runHistory = default; bool? partitionData = default; + DataOverwriteBehaviorType? dataOverwriteBehavior = default; + CompressionModeType? compressionMode = default; + string exportDescription = default; DateTimeOffset? nextRunTimeEstimate = default; + ExportSuspensionContext systemSuspensionContext = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -142,6 +166,29 @@ internal static CommonExportProperties DeserializeCommonExportProperties(JsonEle partitionData = property.Value.GetBoolean(); continue; } + if (property.NameEquals("dataOverwriteBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataOverwriteBehavior = new DataOverwriteBehaviorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("compressionMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + compressionMode = new CompressionModeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("exportDescription"u8)) + { + exportDescription = property.Value.GetString(); + continue; + } if (property.NameEquals("nextRunTimeEstimate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -151,6 +198,15 @@ internal static CommonExportProperties DeserializeCommonExportProperties(JsonEle nextRunTimeEstimate = property.Value.GetDateTimeOffset("O"); continue; } + if (property.NameEquals("systemSuspensionContext"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemSuspensionContext = ExportSuspensionContext.DeserializeExportSuspensionContext(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -163,7 +219,11 @@ internal static CommonExportProperties DeserializeCommonExportProperties(JsonEle definition, runHistory, partitionData, + dataOverwriteBehavior, + compressionMode, + exportDescription, nextRunTimeEstimate, + systemSuspensionContext, serializedAdditionalRawData); } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs index 85857d950279..8ef95eb3d1b8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CommonExportProperties.cs @@ -59,21 +59,29 @@ public CommonExportProperties(ExportDeliveryInfo deliveryInfo, ExportDefinition } /// Initializes a new instance of . - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The format of the export being delivered. /// Has delivery information for the export. /// Has the definition for the export. /// If requested, has the most recent run history for the export. - /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + /// The export description set by customer at time of export creation/update. /// If the export has an active schedule, provides an estimate of the next run time. + /// The export suspension reason if export is in SystemSuspended state. This is not populated currently. /// Keeps track of any properties unknown to the library. - internal CommonExportProperties(ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DateTimeOffset? nextRunTimeEstimate, IDictionary serializedAdditionalRawData) + internal CommonExportProperties(ExportFormatType? format, ExportDeliveryInfo deliveryInfo, ExportDefinition definition, ExportExecutionListResult runHistory, bool? partitionData, DataOverwriteBehaviorType? dataOverwriteBehavior, CompressionModeType? compressionMode, string exportDescription, DateTimeOffset? nextRunTimeEstimate, ExportSuspensionContext systemSuspensionContext, IDictionary serializedAdditionalRawData) { Format = format; DeliveryInfo = deliveryInfo; Definition = definition; RunHistory = runHistory; PartitionData = partitionData; + DataOverwriteBehavior = dataOverwriteBehavior; + CompressionMode = compressionMode; + ExportDescription = exportDescription; NextRunTimeEstimate = nextRunTimeEstimate; + SystemSuspensionContext = systemSuspensionContext; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -82,7 +90,7 @@ internal CommonExportProperties() { } - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The format of the export being delivered. public ExportFormatType? Format { get; set; } /// Has delivery information for the export. internal ExportDeliveryInfo DeliveryInfo { get; set; } @@ -108,9 +116,17 @@ public IReadOnlyList RunHistoryValue } } - /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. Note: this option is currently available only for Microsoft Customer Agreement commerce scopes. + /// If set to true, exported data will be partitioned by size and placed in a blob directory together with a manifest file. public bool? PartitionData { get; set; } + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + public DataOverwriteBehaviorType? DataOverwriteBehavior { get; set; } + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + public CompressionModeType? CompressionMode { get; set; } + /// The export description set by customer at time of export creation/update. + public string ExportDescription { get; set; } /// If the export has an active schedule, provides an estimate of the next run time. public DateTimeOffset? NextRunTimeEstimate { get; } + /// The export suspension reason if export is in SystemSuspended state. This is not populated currently. + public ExportSuspensionContext SystemSuspensionContext { get; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CompressionModeType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CompressionModeType.cs new file mode 100644 index 000000000000..1fc35f345244 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CompressionModeType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Allow customers to select compress data for exports. This setting will enable destination file compression scheme at runtime. By default set to None. Gzip is for csv and snappy for parquet. + public readonly partial struct CompressionModeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CompressionModeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GzipValue = "gzip"; + private const string SnappyValue = "snappy"; + private const string NoneValue = "none"; + + /// gzip. + public static CompressionModeType Gzip { get; } = new CompressionModeType(GzipValue); + /// snappy. + public static CompressionModeType Snappy { get; } = new CompressionModeType(SnappyValue); + /// none. + public static CompressionModeType None { get; } = new CompressionModeType(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(CompressionModeType left, CompressionModeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CompressionModeType left, CompressionModeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CompressionModeType(string value) => new CompressionModeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CompressionModeType other && Equals(other); + /// + public bool Equals(CompressionModeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationPolicyType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationPolicyType.cs new file mode 100644 index 000000000000..80b373209133 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationPolicyType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Method to use for allocating cost. FixedProportion indicates that cost will be split based on specified percentage values. + public readonly partial struct CostAllocationPolicyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CostAllocationPolicyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FixedProportionValue = "FixedProportion"; + + /// FixedProportion. + public static CostAllocationPolicyType FixedProportion { get; } = new CostAllocationPolicyType(FixedProportionValue); + /// Determines if two values are the same. + public static bool operator ==(CostAllocationPolicyType left, CostAllocationPolicyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CostAllocationPolicyType left, CostAllocationPolicyType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CostAllocationPolicyType(string value) => new CostAllocationPolicyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CostAllocationPolicyType other && Equals(other); + /// + public bool Equals(CostAllocationPolicyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationProportion.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationProportion.Serialization.cs new file mode 100644 index 000000000000..db8fb63a9494 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationProportion.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CostAllocationProportion : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationProportion)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("percentage"u8); + writer.WriteNumberValue(Percentage); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationProportion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationProportion)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationProportion(document.RootElement, options); + } + + internal static CostAllocationProportion DeserializeCostAllocationProportion(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + float percentage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentage"u8)) + { + percentage = property.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationProportion(name, percentage, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationProportion)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationProportion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationProportion(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationProportion)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationProportion.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationProportion.cs new file mode 100644 index 000000000000..304e4a4c5f29 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationProportion.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Target resources and allocation. + public partial class CostAllocationProportion + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Target resource for cost allocation. + /// Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. + /// is null. + public CostAllocationProportion(string name, float percentage) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + Percentage = percentage; + } + + /// Initializes a new instance of . + /// Target resource for cost allocation. + /// Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. + /// Keeps track of any properties unknown to the library. + internal CostAllocationProportion(string name, float percentage, IDictionary serializedAdditionalRawData) + { + Name = name; + Percentage = percentage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CostAllocationProportion() + { + } + + /// Target resource for cost allocation. + public string Name { get; set; } + /// Percentage of source cost to allocate to this resource. This value can be specified to two decimal places and the total percentage of all resources in this rule must sum to 100.00. + public float Percentage { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResource.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResource.Serialization.cs new file mode 100644 index 000000000000..7b75c1f08482 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResource.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CostAllocationResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationResource)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationResource(document.RootElement, options); + } + + internal static CostAllocationResource DeserializeCostAllocationResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CostAllocationResourceType resourceType = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceType"u8)) + { + resourceType = new CostAllocationResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationResource(resourceType, name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationResource)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResource.cs new file mode 100644 index 000000000000..589119364607 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Common values for resources for cost allocation. + public partial class CostAllocationResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Type of resources contained in this cost allocation rule. + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + /// is null. + public CostAllocationResource(CostAllocationResourceType resourceType, string name) + { + Argument.AssertNotNull(name, nameof(name)); + + ResourceType = resourceType; + Name = name; + } + + /// Initializes a new instance of . + /// Type of resources contained in this cost allocation rule. + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + /// Keeps track of any properties unknown to the library. + internal CostAllocationResource(CostAllocationResourceType resourceType, string name, IDictionary serializedAdditionalRawData) + { + ResourceType = resourceType; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CostAllocationResource() + { + } + + /// Type of resources contained in this cost allocation rule. + public CostAllocationResourceType ResourceType { get; set; } + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + public string Name { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResourceType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResourceType.cs new file mode 100644 index 000000000000..8786a248fb31 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationResourceType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Category of resource to use for allocation. + public readonly partial struct CostAllocationResourceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CostAllocationResourceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DimensionValue = "Dimension"; + private const string TagValue = "Tag"; + + /// Indicates an Azure dimension such as a subscription id or resource group name is being used for allocation. + public static CostAllocationResourceType Dimension { get; } = new CostAllocationResourceType(DimensionValue); + /// Allocates cost based on Azure Tag key value pairs. + public static CostAllocationResourceType Tag { get; } = new CostAllocationResourceType(TagValue); + /// Determines if two values are the same. + public static bool operator ==(CostAllocationResourceType left, CostAllocationResourceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CostAllocationResourceType left, CostAllocationResourceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CostAllocationResourceType(string value) => new CostAllocationResourceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CostAllocationResourceType other && Equals(other); + /// + public bool Equals(CostAllocationResourceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityContent.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityContent.Serialization.cs new file mode 100644 index 000000000000..7ffca586419f --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityContent.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CostAllocationRuleCheckNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationRuleCheckNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationRuleCheckNameAvailabilityContent(document.RootElement, options); + } + + internal static CostAllocationRuleCheckNameAvailabilityContent DeserializeCostAllocationRuleCheckNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationRuleCheckNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityContent)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationRuleCheckNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationRuleCheckNameAvailabilityContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityContent.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityContent.cs new file mode 100644 index 000000000000..ba3f26c88556 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The cost allocation rule check name availability request. + public partial class CostAllocationRuleCheckNameAvailabilityContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CostAllocationRuleCheckNameAvailabilityContent() + { + } + + /// Initializes a new instance of . + /// Rule name. + /// Resource type. This is expected to be Microsoft.CostManagement/costAllocationRules. + /// Keeps track of any properties unknown to the library. + internal CostAllocationRuleCheckNameAvailabilityContent(string name, string resourceType, IDictionary serializedAdditionalRawData) + { + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Rule name. + public string Name { get; set; } + /// Resource type. This is expected to be Microsoft.CostManagement/costAllocationRules. + public string ResourceType { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityResponse.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityResponse.Serialization.cs new file mode 100644 index 000000000000..2c8b108b41f9 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityResponse.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CostAllocationRuleCheckNameAvailabilityResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityResponse)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(NameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationRuleCheckNameAvailabilityResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationRuleCheckNameAvailabilityResponse(document.RootElement, options); + } + + internal static CostAllocationRuleCheckNameAvailabilityResponse DeserializeCostAllocationRuleCheckNameAvailabilityResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? nameAvailable = default; + Reason? reason = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nameAvailable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nameAvailable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("reason"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reason = new Reason(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationRuleCheckNameAvailabilityResponse(nameAvailable, reason, message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityResponse)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationRuleCheckNameAvailabilityResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationRuleCheckNameAvailabilityResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationRuleCheckNameAvailabilityResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityResponse.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityResponse.cs new file mode 100644 index 000000000000..2f411aebf7a5 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleCheckNameAvailabilityResponse.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The cost allocation rule check name availability response. + public partial class CostAllocationRuleCheckNameAvailabilityResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CostAllocationRuleCheckNameAvailabilityResponse() + { + } + + /// Initializes a new instance of . + /// Whether this rule name is available. + /// The reason this name is not available. + /// Error message if the name is not available. + /// Keeps track of any properties unknown to the library. + internal CostAllocationRuleCheckNameAvailabilityResponse(bool? nameAvailable, Reason? reason, string message, IDictionary serializedAdditionalRawData) + { + NameAvailable = nameAvailable; + Reason = reason; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether this rule name is available. + public bool? NameAvailable { get; } + /// The reason this name is not available. + public Reason? Reason { get; } + /// Error message if the name is not available. + public string Message { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleDetails.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleDetails.Serialization.cs new file mode 100644 index 000000000000..c8b9691e0d1a --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleDetails.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CostAllocationRuleDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(SourceResources)) + { + writer.WritePropertyName("sourceResources"u8); + writer.WriteStartArray(); + foreach (var item in SourceResources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TargetResources)) + { + writer.WritePropertyName("targetResources"u8); + writer.WriteStartArray(); + foreach (var item in TargetResources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationRuleDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationRuleDetails(document.RootElement, options); + } + + internal static CostAllocationRuleDetails DeserializeCostAllocationRuleDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList sourceResources = default; + IList targetResources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceResources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SourceCostAllocationResource.DeserializeSourceCostAllocationResource(item, options)); + } + sourceResources = array; + continue; + } + if (property.NameEquals("targetResources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TargetCostAllocationResource.DeserializeTargetCostAllocationResource(item, options)); + } + targetResources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationRuleDetails(sourceResources ?? new ChangeTrackingList(), targetResources ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationRuleDetails)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationRuleDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationRuleDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationRuleDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleDetails.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleDetails.cs new file mode 100644 index 000000000000..1d3feca1a65c --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleDetails.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Resource details of the cost allocation rule. + public partial class CostAllocationRuleDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CostAllocationRuleDetails() + { + SourceResources = new ChangeTrackingList(); + TargetResources = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Source resources for cost allocation. At this time, this list can contain no more than one element. + /// Target resources for cost allocation. At this time, this list can contain no more than one element. + /// Keeps track of any properties unknown to the library. + internal CostAllocationRuleDetails(IList sourceResources, IList targetResources, IDictionary serializedAdditionalRawData) + { + SourceResources = sourceResources; + TargetResources = targetResources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Source resources for cost allocation. At this time, this list can contain no more than one element. + public IList SourceResources { get; } + /// Target resources for cost allocation. At this time, this list can contain no more than one element. + public IList TargetResources { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleList.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleList.Serialization.cs new file mode 100644 index 000000000000..45350194b996 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleList.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + internal partial class CostAllocationRuleList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationRuleList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationRuleList(document.RootElement, options); + } + + internal static CostAllocationRuleList DeserializeCostAllocationRuleList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationRuleList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationRuleList)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationRuleList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationRuleList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationRuleList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleList.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleList.cs new file mode 100644 index 000000000000..57eccebad313 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Result of listing cost allocation rules. It contains a list of available rules in the billing account or enterprise enrollment provided. + internal partial class CostAllocationRuleList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CostAllocationRuleList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of cost allocation rules. + /// URL to get the next set of rule list results if there are any. + /// Keeps track of any properties unknown to the library. + internal CostAllocationRuleList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of cost allocation rules. + public IReadOnlyList Value { get; } + /// URL to get the next set of rule list results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleProperties.Serialization.cs new file mode 100644 index 000000000000..faa2d6f8ef3c --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleProperties.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CostAllocationRuleProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("details"u8); + writer.WriteObjectValue(Details, options); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(UpdatedOn)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CostAllocationRuleProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CostAllocationRuleProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCostAllocationRuleProperties(document.RootElement, options); + } + + internal static CostAllocationRuleProperties DeserializeCostAllocationRuleProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + CostAllocationRuleDetails details = default; + RuleStatus status = default; + DateTimeOffset? createdDate = default; + DateTimeOffset? updatedDate = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + details = CostAllocationRuleDetails.DeserializeCostAllocationRuleDetails(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new RuleStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CostAllocationRuleProperties( + description, + details, + status, + createdDate, + updatedDate, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CostAllocationRuleProperties)} does not support writing '{options.Format}' format."); + } + } + + CostAllocationRuleProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCostAllocationRuleProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CostAllocationRuleProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleProperties.cs new file mode 100644 index 000000000000..647857d85f3e --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostAllocationRuleProperties.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The properties of a cost allocation rule. + public partial class CostAllocationRuleProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Resource information for the cost allocation rule. + /// Status of the rule. + /// is null. + public CostAllocationRuleProperties(CostAllocationRuleDetails details, RuleStatus status) + { + Argument.AssertNotNull(details, nameof(details)); + + Details = details; + Status = status; + } + + /// Initializes a new instance of . + /// Description of a cost allocation rule. + /// Resource information for the cost allocation rule. + /// Status of the rule. + /// Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation. + /// Time at which the rule was last updated. + /// Keeps track of any properties unknown to the library. + internal CostAllocationRuleProperties(string description, CostAllocationRuleDetails details, RuleStatus status, DateTimeOffset? createdOn, DateTimeOffset? updatedOn, IDictionary serializedAdditionalRawData) + { + Description = description; + Details = details; + Status = status; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CostAllocationRuleProperties() + { + } + + /// Description of a cost allocation rule. + public string Description { get; set; } + /// Resource information for the cost allocation rule. + public CostAllocationRuleDetails Details { get; set; } + /// Status of the rule. + public RuleStatus Status { get; set; } + /// Time at which the rule was created. Rules that change cost for the same resource are applied in order of creation. + public DateTimeOffset? CreatedOn { get; } + /// Time at which the rule was last updated. + public DateTimeOffset? UpdatedOn { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs index c66733d378c8..008623b60754 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.Serialization.cs @@ -44,6 +44,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -82,6 +87,7 @@ internal static CostManagementDimensionsListResult DeserializeCostManagementDime return null; } IReadOnlyList value = default; + string nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -100,13 +106,18 @@ internal static CostManagementDimensionsListResult DeserializeCostManagementDime value = array; continue; } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new CostManagementDimensionsListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new CostManagementDimensionsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs index 65807a5d6521..d6cf940b5b92 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CostManagementDimensionsListResult.cs @@ -53,14 +53,18 @@ internal CostManagementDimensionsListResult() /// Initializes a new instance of . /// The list of dimensions. + /// The link (url) to the next page of results. /// Keeps track of any properties unknown to the library. - internal CostManagementDimensionsListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + internal CostManagementDimensionsListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { Value = value; + NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The list of dimensions. public IReadOnlyList Value { get; } + /// The link (url) to the next page of results. + public string NextLink { get; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CultureCode.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CultureCode.cs new file mode 100644 index 000000000000..124c3b661a3e --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CultureCode.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// Language in which the recipient will receive the notification, + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public readonly partial struct CultureCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CultureCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnUsValue = "en-us"; + private const string JaJpValue = "ja-jp"; + private const string ZhCnValue = "zh-cn"; + private const string DeDeValue = "de-de"; + private const string EsEsValue = "es-es"; + private const string FrFrValue = "fr-fr"; + private const string ItItValue = "it-it"; + private const string KoKrValue = "ko-kr"; + private const string PtBrValue = "pt-br"; + private const string RuRuValue = "ru-ru"; + private const string ZhTwValue = "zh-tw"; + private const string CsCzValue = "cs-cz"; + private const string PlPlValue = "pl-pl"; + private const string TrTrValue = "tr-tr"; + private const string DaDkValue = "da-dk"; + private const string EnGbValue = "en-gb"; + private const string HuHuValue = "hu-hu"; + private const string NbNoValue = "nb-no"; + private const string NlNlValue = "nl-nl"; + private const string PtPtValue = "pt-pt"; + private const string SvSeValue = "sv-se"; + + /// en-us. + public static CultureCode EnUs { get; } = new CultureCode(EnUsValue); + /// ja-jp. + public static CultureCode JaJp { get; } = new CultureCode(JaJpValue); + /// zh-cn. + public static CultureCode ZhCn { get; } = new CultureCode(ZhCnValue); + /// de-de. + public static CultureCode DeDe { get; } = new CultureCode(DeDeValue); + /// es-es. + public static CultureCode EsEs { get; } = new CultureCode(EsEsValue); + /// fr-fr. + public static CultureCode FrFr { get; } = new CultureCode(FrFrValue); + /// it-it. + public static CultureCode ItIt { get; } = new CultureCode(ItItValue); + /// ko-kr. + public static CultureCode KoKr { get; } = new CultureCode(KoKrValue); + /// pt-br. + public static CultureCode PtBr { get; } = new CultureCode(PtBrValue); + /// ru-ru. + public static CultureCode RuRu { get; } = new CultureCode(RuRuValue); + /// zh-tw. + public static CultureCode ZhTw { get; } = new CultureCode(ZhTwValue); + /// cs-cz. + public static CultureCode CsCz { get; } = new CultureCode(CsCzValue); + /// pl-pl. + public static CultureCode PlPl { get; } = new CultureCode(PlPlValue); + /// tr-tr. + public static CultureCode TrTr { get; } = new CultureCode(TrTrValue); + /// da-dk. + public static CultureCode DaDk { get; } = new CultureCode(DaDkValue); + /// en-gb. + public static CultureCode EnGb { get; } = new CultureCode(EnGbValue); + /// hu-hu. + public static CultureCode HuHu { get; } = new CultureCode(HuHuValue); + /// nb-no. + public static CultureCode NbNo { get; } = new CultureCode(NbNoValue); + /// nl-nl. + public static CultureCode NlNl { get; } = new CultureCode(NlNlValue); + /// pt-pt. + public static CultureCode PtPt { get; } = new CultureCode(PtPtValue); + /// sv-se. + public static CultureCode SvSe { get; } = new CultureCode(SvSeValue); + /// Determines if two values are the same. + public static bool operator ==(CultureCode left, CultureCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CultureCode left, CultureCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CultureCode(string value) => new CultureCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CultureCode other && Equals(other); + /// + public bool Equals(CultureCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CurrentSpend.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CurrentSpend.Serialization.cs new file mode 100644 index 000000000000..a9c141bc0399 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CurrentSpend.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class CurrentSpend : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrentSpend)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Amount)) + { + writer.WritePropertyName("amount"u8); + writer.WriteNumberValue(Amount.Value); + } + if (options.Format != "W" && Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CurrentSpend IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrentSpend)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCurrentSpend(document.RootElement, options); + } + + internal static CurrentSpend DeserializeCurrentSpend(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + float? amount = default; + string unit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("amount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + amount = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CurrentSpend(amount, unit, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(CurrentSpend)} does not support writing '{options.Format}' format."); + } + } + + CurrentSpend IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCurrentSpend(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CurrentSpend)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CurrentSpend.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CurrentSpend.cs new file mode 100644 index 000000000000..9f518736b276 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/CurrentSpend.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The current amount of cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + public partial class CurrentSpend + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CurrentSpend() + { + } + + /// Initializes a new instance of . + /// The total amount of cost which is being tracked by the budget. + /// The unit of measure for the budget amount. + /// Keeps track of any properties unknown to the library. + internal CurrentSpend(float? amount, string unit, IDictionary serializedAdditionalRawData) + { + Amount = amount; + Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The total amount of cost which is being tracked by the budget. + public float? Amount { get; } + /// The unit of measure for the budget amount. + public string Unit { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DataOverwriteBehaviorType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DataOverwriteBehaviorType.cs new file mode 100644 index 000000000000..0abfd1014a11 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DataOverwriteBehaviorType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Allow customers to select overwrite data(OverwritePreviousReport) for exports. This setting will enable overwrite data for the same month in customer storage account. By default set to CreateNewReport. + public readonly partial struct DataOverwriteBehaviorType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataOverwriteBehaviorType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OverwritePreviousReportValue = "OverwritePreviousReport"; + private const string CreateNewReportValue = "CreateNewReport"; + + /// OverwritePreviousReport. + public static DataOverwriteBehaviorType OverwritePreviousReport { get; } = new DataOverwriteBehaviorType(OverwritePreviousReportValue); + /// CreateNewReport. + public static DataOverwriteBehaviorType CreateNewReport { get; } = new DataOverwriteBehaviorType(CreateNewReportValue); + /// Determines if two values are the same. + public static bool operator ==(DataOverwriteBehaviorType left, DataOverwriteBehaviorType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataOverwriteBehaviorType left, DataOverwriteBehaviorType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataOverwriteBehaviorType(string value) => new DataOverwriteBehaviorType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataOverwriteBehaviorType other && Equals(other); + /// + public bool Equals(DataOverwriteBehaviorType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DestinationType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DestinationType.cs new file mode 100644 index 000000000000..02d1af660a9c --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/DestinationType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The export delivery destination type. Currently only 'AzureBlob' is supported. + public readonly partial struct DestinationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DestinationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureBlobValue = "AzureBlob"; + + /// AzureBlob. + public static DestinationType AzureBlob { get; } = new DestinationType(AzureBlobValue); + /// Determines if two values are the same. + public static bool operator ==(DestinationType left, DestinationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DestinationType left, DestinationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DestinationType(string value) => new DestinationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DestinationType other && Equals(other); + /// + public bool Equals(DestinationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs index adae4222e4c0..741fcb03564f 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDataset.cs @@ -51,7 +51,7 @@ public ExportDataset() } /// Initializes a new instance of . - /// The granularity of rows in the export. Currently only 'Daily' is supported. + /// The granularity of rows in the export. Currently 'Daily' is supported for most cases. /// The export dataset configuration. /// Keeps track of any properties unknown to the library. internal ExportDataset(GranularityType? granularity, ExportDatasetConfiguration configuration, IDictionary serializedAdditionalRawData) @@ -61,19 +61,9 @@ internal ExportDataset(GranularityType? granularity, ExportDatasetConfiguration _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The granularity of rows in the export. Currently only 'Daily' is supported. + /// The granularity of rows in the export. Currently 'Daily' is supported for most cases. public GranularityType? Granularity { get; set; } /// The export dataset configuration. - internal ExportDatasetConfiguration Configuration { get; set; } - /// Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). - public IList Columns - { - get - { - if (Configuration is null) - Configuration = new ExportDatasetConfiguration(); - return Configuration.Columns; - } - } + public ExportDatasetConfiguration Configuration { get; set; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs index 1d0c7cbf5ee7..7729cfe54840 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.Serialization.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.CostManagement.Models { - internal partial class ExportDatasetConfiguration : IUtf8JsonSerializable, IJsonModel + public partial class ExportDatasetConfiguration : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -44,6 +44,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(DataVersion)) + { + writer.WritePropertyName("dataVersion"u8); + writer.WriteStringValue(DataVersion); + } + if (Optional.IsCollectionDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteStartArray(); + foreach (var item in Filters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -82,6 +97,8 @@ internal static ExportDatasetConfiguration DeserializeExportDatasetConfiguration return null; } IList columns = default; + string dataVersion = default; + IList filters = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -100,13 +117,32 @@ internal static ExportDatasetConfiguration DeserializeExportDatasetConfiguration columns = array; continue; } + if (property.NameEquals("dataVersion"u8)) + { + dataVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FilterItems.DeserializeFilterItems(item, options)); + } + filters = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ExportDatasetConfiguration(columns ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ExportDatasetConfiguration(columns ?? new ChangeTrackingList(), dataVersion, filters ?? new ChangeTrackingList(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs index bcec27db48d9..11502a0dad54 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDatasetConfiguration.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.CostManagement.Models { - /// The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. - internal partial class ExportDatasetConfiguration + /// This is on path to deprecation and will not be supported going forward. + public partial class ExportDatasetConfiguration { /// /// Keeps track of any properties unknown to the library. @@ -49,18 +49,27 @@ internal partial class ExportDatasetConfiguration public ExportDatasetConfiguration() { Columns = new ChangeTrackingList(); + Filters = new ChangeTrackingList(); } /// Initializes a new instance of . /// Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). + /// The data version for the selected for the export. If not provided then the export will default to latest data version. + /// Filters associated with the data sets. /// Keeps track of any properties unknown to the library. - internal ExportDatasetConfiguration(IList columns, IDictionary serializedAdditionalRawData) + internal ExportDatasetConfiguration(IList columns, string dataVersion, IList filters, IDictionary serializedAdditionalRawData) { Columns = columns; + DataVersion = dataVersion; + Filters = filters; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). public IList Columns { get; } + /// The data version for the selected for the export. If not provided then the export will default to latest data version. + public string DataVersion { get; set; } + /// Filters associated with the data sets. + public IList Filters { get; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs index b9d5f1e8618e..824ba0167050 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.Serialization.cs @@ -34,6 +34,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ExportDeliveryDestination)} does not support writing '{format}' format."); } + if (Optional.IsDefined(DestinationType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DestinationType.Value.ToString()); + } if (Optional.IsDefined(ResourceId)) { writer.WritePropertyName("resourceId"u8); @@ -93,6 +98,7 @@ internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(J { return null; } + DestinationType? type = default; ResourceIdentifier resourceId = default; string container = default; string rootFolderPath = default; @@ -102,6 +108,15 @@ internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(J Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new DestinationType(property.Value.GetString()); + continue; + } if (property.NameEquals("resourceId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -138,6 +153,7 @@ internal static ExportDeliveryDestination DeserializeExportDeliveryDestination(J } serializedAdditionalRawData = rawDataDictionary; return new ExportDeliveryDestination( + type, resourceId, container, rootFolderPath, diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs index 5427da057a6a..439d501c8eb9 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs @@ -57,14 +57,16 @@ public ExportDeliveryDestination(string container) } /// Initializes a new instance of . + /// The export delivery destination type. Currently only 'AzureBlob' is supported. /// The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified. /// The name of the container where exports will be uploaded. If the container does not exist it will be created. /// The name of the directory where exports will be uploaded. /// A SAS token for the storage account. For a restricted set of Azure customers this together with storageAccount can be specified instead of resourceId. Note: the value returned by the API for this property will always be obfuscated. Returning this same obfuscated value will not result in the SAS token being updated. To update this value a new SAS token must be specified. /// The storage account where exports will be uploaded. For a restricted set of Azure customers this together with sasToken can be specified instead of resourceId. /// Keeps track of any properties unknown to the library. - internal ExportDeliveryDestination(ResourceIdentifier resourceId, string container, string rootFolderPath, string sasToken, string storageAccount, IDictionary serializedAdditionalRawData) + internal ExportDeliveryDestination(DestinationType? destinationType, ResourceIdentifier resourceId, string container, string rootFolderPath, string sasToken, string storageAccount, IDictionary serializedAdditionalRawData) { + DestinationType = destinationType; ResourceId = resourceId; Container = container; RootFolderPath = rootFolderPath; @@ -78,6 +80,8 @@ internal ExportDeliveryDestination() { } + /// The export delivery destination type. Currently only 'AzureBlob' is supported. + public DestinationType? DestinationType { get; set; } /// The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified. public ResourceIdentifier ResourceId { get; set; } /// The name of the container where exports will be uploaded. If the container does not exist it will be created. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportFormatType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportFormatType.cs index 02216b6279e7..1b7d586c8d3b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportFormatType.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportFormatType.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CostManagement.Models { - /// The format of the export being delivered. Currently only 'Csv' is supported. + /// The format of the export being delivered. public readonly partial struct ExportFormatType : IEquatable { private readonly string _value; @@ -23,9 +23,12 @@ public ExportFormatType(string value) } private const string CsvValue = "Csv"; + private const string ParquetValue = "Parquet"; /// Csv. public static ExportFormatType Csv { get; } = new ExportFormatType(CsvValue); + /// Parquet. + public static ExportFormatType Parquet { get; } = new ExportFormatType(ParquetValue); /// Determines if two values are the same. public static bool operator ==(ExportFormatType left, ExportFormatType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs index 86ad945d8824..afeb468fa3b7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.Serialization.cs @@ -74,11 +74,26 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("processingEndTime"u8); writer.WriteStringValue(ProcessingEndOn.Value, "O"); } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDate"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDate"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } if (Optional.IsDefined(FileName)) { writer.WritePropertyName("fileName"u8); writer.WriteStringValue(FileName); } + if (Optional.IsDefined(ManifestFile)) + { + writer.WritePropertyName("manifestFile"u8); + writer.WriteStringValue(ManifestFile); + } if (Optional.IsDefined(RunSettings)) { writer.WritePropertyName("runSettings"u8); @@ -123,7 +138,10 @@ internal static ExportRun DeserializeExportRun(JsonElement element, ModelReaderW DateTimeOffset? submittedTime = default; DateTimeOffset? processingStartTime = default; DateTimeOffset? processingEndTime = default; + DateTimeOffset? startDate = default; + DateTimeOffset? endDate = default; string fileName = default; + string manifestFile = default; CommonExportProperties runSettings = default; ExportRunErrorDetails error = default; IDictionary serializedAdditionalRawData = default; @@ -222,11 +240,34 @@ internal static ExportRun DeserializeExportRun(JsonElement element, ModelReaderW processingEndTime = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("startDate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startDate = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("endDate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDate = property0.Value.GetDateTimeOffset("O"); + continue; + } if (property0.NameEquals("fileName"u8)) { fileName = property0.Value.GetString(); continue; } + if (property0.NameEquals("manifestFile"u8)) + { + manifestFile = property0.Value.GetString(); + continue; + } if (property0.NameEquals("runSettings"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -265,7 +306,10 @@ internal static ExportRun DeserializeExportRun(JsonElement element, ModelReaderW submittedTime, processingStartTime, processingEndTime, + startDate, + endDate, fileName, + manifestFile, runSettings, error, eTag, diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs index eb56fc72c247..77ffad6a4f18 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRun.cs @@ -63,12 +63,15 @@ public ExportRun() /// The time when export was queued to be run. /// The time when export was picked up to be run. /// The time when the export run finished. + /// The start datetime for the export. + /// The end datetime for the export. /// The name of the exported file. + /// The manifest file location(URI location) for the exported files. /// The export settings that were in effect for this run. /// The details of any error. /// 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. /// Keeps track of any properties unknown to the library. - internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportRunExecutionType? executionType, ExportRunExecutionStatus? status, string submittedBy, DateTimeOffset? submittedOn, DateTimeOffset? processingStartOn, DateTimeOffset? processingEndOn, string fileName, CommonExportProperties runSettings, ExportRunErrorDetails error, ETag? eTag, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExportRunExecutionType? executionType, ExportRunExecutionStatus? status, string submittedBy, DateTimeOffset? submittedOn, DateTimeOffset? processingStartOn, DateTimeOffset? processingEndOn, DateTimeOffset? startOn, DateTimeOffset? endOn, string fileName, string manifestFile, CommonExportProperties runSettings, ExportRunErrorDetails error, ETag? eTag, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ExecutionType = executionType; Status = status; @@ -76,7 +79,10 @@ internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType SubmittedOn = submittedOn; ProcessingStartOn = processingStartOn; ProcessingEndOn = processingEndOn; + StartOn = startOn; + EndOn = endOn; FileName = fileName; + ManifestFile = manifestFile; RunSettings = runSettings; Error = error; ETag = eTag; @@ -95,8 +101,14 @@ internal ExportRun(ResourceIdentifier id, string name, ResourceType resourceType public DateTimeOffset? ProcessingStartOn { get; set; } /// The time when the export run finished. public DateTimeOffset? ProcessingEndOn { get; set; } + /// The start datetime for the export. + public DateTimeOffset? StartOn { get; set; } + /// The end datetime for the export. + public DateTimeOffset? EndOn { get; set; } /// The name of the exported file. public string FileName { get; set; } + /// The manifest file location(URI location) for the exported files. + public string ManifestFile { get; set; } /// The export settings that were in effect for this run. public CommonExportProperties RunSettings { get; set; } /// The details of any error. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunContent.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunContent.Serialization.cs new file mode 100644 index 000000000000..779ac8d41cc9 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunContent.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class ExportRunContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportRunContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(TimePeriod)) + { + writer.WritePropertyName("timePeriod"u8); + writer.WriteObjectValue(TimePeriod, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExportRunContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportRunContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExportRunContent(document.RootElement, options); + } + + internal static ExportRunContent DeserializeExportRunContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExportTimePeriod timePeriod = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timePeriod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timePeriod = ExportTimePeriod.DeserializeExportTimePeriod(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExportRunContent(timePeriod, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(ExportRunContent)} does not support writing '{options.Format}' format."); + } + } + + ExportRunContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExportRunContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExportRunContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunContent.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunContent.cs new file mode 100644 index 000000000000..f98508b96c30 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportRunContent.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The export run request. + public partial class ExportRunContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ExportRunContent() + { + } + + /// Initializes a new instance of . + /// Has time period for pulling data for the export. + /// Keeps track of any properties unknown to the library. + internal ExportRunContent(ExportTimePeriod timePeriod, IDictionary serializedAdditionalRawData) + { + TimePeriod = timePeriod; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Has time period for pulling data for the export. + public ExportTimePeriod TimePeriod { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs index 9f93dffc9cb3..3791e7aa35b2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSchedule.cs @@ -51,7 +51,7 @@ public ExportSchedule() } /// Initializes a new instance of . - /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. + /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. To enable export set the status to be Active and then make a PUT request. /// The schedule recurrence. /// Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. /// Keeps track of any properties unknown to the library. @@ -63,7 +63,7 @@ internal ExportSchedule(ExportScheduleStatusType? status, ExportScheduleRecurren _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. + /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. To enable export set the status to be Active and then make a PUT request. public ExportScheduleStatusType? Status { get; set; } /// The schedule recurrence. public ExportScheduleRecurrenceType? Recurrence { get; set; } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportScheduleStatusType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportScheduleStatusType.cs index d5fc2ee529cc..ad4a998af264 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportScheduleStatusType.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportScheduleStatusType.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CostManagement.Models { - /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. + /// The status of the export's schedule. If 'Inactive', the export's schedule is paused. To enable export set the status to be Active and then make a PUT request. public readonly partial struct ExportScheduleStatusType : IEquatable { private readonly string _value; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSuspensionContext.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSuspensionContext.Serialization.cs new file mode 100644 index 000000000000..cb767e15583e --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSuspensionContext.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class ExportSuspensionContext : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportSuspensionContext)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SuspensionCode)) + { + writer.WritePropertyName("suspensionCode"u8); + writer.WriteStringValue(SuspensionCode); + } + if (Optional.IsDefined(SuspensionReason)) + { + writer.WritePropertyName("suspensionReason"u8); + writer.WriteStringValue(SuspensionReason); + } + if (Optional.IsDefined(SuspensionOn)) + { + writer.WritePropertyName("suspensionTime"u8); + writer.WriteStringValue(SuspensionOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExportSuspensionContext IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportSuspensionContext)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExportSuspensionContext(document.RootElement, options); + } + + internal static ExportSuspensionContext DeserializeExportSuspensionContext(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string suspensionCode = default; + string suspensionReason = default; + DateTimeOffset? suspensionTime = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("suspensionCode"u8)) + { + suspensionCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("suspensionReason"u8)) + { + suspensionReason = property.Value.GetString(); + continue; + } + if (property.NameEquals("suspensionTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + suspensionTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExportSuspensionContext(suspensionCode, suspensionReason, suspensionTime, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(ExportSuspensionContext)} does not support writing '{options.Format}' format."); + } + } + + ExportSuspensionContext IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExportSuspensionContext(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExportSuspensionContext)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSuspensionContext.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSuspensionContext.cs new file mode 100644 index 000000000000..c1b00f908f1b --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportSuspensionContext.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The properties of the export run. This is not populated currently. + public partial class ExportSuspensionContext + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ExportSuspensionContext() + { + } + + /// Initializes a new instance of . + /// The code for export suspension. + /// The detailed reason for export suspension. + /// The time when the export was suspended. + /// Keeps track of any properties unknown to the library. + internal ExportSuspensionContext(string suspensionCode, string suspensionReason, DateTimeOffset? suspensionOn, IDictionary serializedAdditionalRawData) + { + SuspensionCode = suspensionCode; + SuspensionReason = suspensionReason; + SuspensionOn = suspensionOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The code for export suspension. + public string SuspensionCode { get; } + /// The detailed reason for export suspension. + public string SuspensionReason { get; } + /// The time when the export was suspended. + public DateTimeOffset? SuspensionOn { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs index 849bddf54c0f..6d40c27f7086 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportTimePeriod.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CostManagement.Models { - /// The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months. + /// The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 1 calendar month. public partial class ExportTimePeriod { /// diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportType.cs index 0b814c0c3c7b..554dc58fce8e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportType.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ExportType.cs @@ -25,6 +25,11 @@ public ExportType(string value) private const string UsageValue = "Usage"; private const string ActualCostValue = "ActualCost"; private const string AmortizedCostValue = "AmortizedCost"; + private const string FocusCostValue = "FocusCost"; + private const string PriceSheetValue = "PriceSheet"; + private const string ReservationTransactionsValue = "ReservationTransactions"; + private const string ReservationRecommendationsValue = "ReservationRecommendations"; + private const string ReservationDetailsValue = "ReservationDetails"; /// Usage. public static ExportType Usage { get; } = new ExportType(UsageValue); @@ -32,6 +37,16 @@ public ExportType(string value) public static ExportType ActualCost { get; } = new ExportType(ActualCostValue); /// AmortizedCost. public static ExportType AmortizedCost { get; } = new ExportType(AmortizedCostValue); + /// FocusCost. + public static ExportType FocusCost { get; } = new ExportType(FocusCostValue); + /// PriceSheet. + public static ExportType PriceSheet { get; } = new ExportType(PriceSheetValue); + /// ReservationTransactions. + public static ExportType ReservationTransactions { get; } = new ExportType(ReservationTransactionsValue); + /// ReservationRecommendations. + public static ExportType ReservationRecommendations { get; } = new ExportType(ReservationRecommendationsValue); + /// ReservationDetails. + public static ExportType ReservationDetails { get; } = new ExportType(ReservationDetailsValue); /// Determines if two values are the same. public static bool operator ==(ExportType left, ExportType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItemName.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItemName.cs new file mode 100644 index 000000000000..d7ed1d44336e --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItemName.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The name of the filter. This is currently only supported for Export Definition type of ReservationRecommendations. Supported names are ['ReservationScope', 'LookBackPeriod', 'ResourceType']. + public readonly partial struct FilterItemName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilterItemName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ReservationScopeValue = "ReservationScope"; + private const string ResourceTypeValue = "ResourceType"; + private const string LookBackPeriodValue = "LookBackPeriod"; + + /// ReservationScope. + public static FilterItemName ReservationScope { get; } = new FilterItemName(ReservationScopeValue); + /// ResourceType. + public static FilterItemName ResourceType { get; } = new FilterItemName(ResourceTypeValue); + /// LookBackPeriod. + public static FilterItemName LookBackPeriod { get; } = new FilterItemName(LookBackPeriodValue); + /// Determines if two values are the same. + public static bool operator ==(FilterItemName left, FilterItemName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilterItemName left, FilterItemName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FilterItemName(string value) => new FilterItemName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilterItemName other && Equals(other); + /// + public bool Equals(FilterItemName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItems.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItems.Serialization.cs new file mode 100644 index 000000000000..49f47377af61 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItems.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class FilterItems : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilterItems)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FilterItems IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilterItems)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFilterItems(document.RootElement, options); + } + + internal static FilterItems DeserializeFilterItems(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FilterItemName? name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = new FilterItemName(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FilterItems(name, value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(FilterItems)} does not support writing '{options.Format}' format."); + } + } + + FilterItems IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFilterItems(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FilterItems)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItems.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItems.cs new file mode 100644 index 000000000000..eb1b1c81e561 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/FilterItems.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Will contain the filter name and value to operate on. This is currently only supported for Export Definition type of ReservationRecommendations. + public partial class FilterItems + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FilterItems() + { + } + + /// Initializes a new instance of . + /// The name of the filter. This is currently only supported for Export Definition type of ReservationRecommendations. Supported names are ['ReservationScope', 'LookBackPeriod', 'ResourceType']. + /// Value to filter by. Currently values supported per name are, for 'ReservationScope' supported values are ['Single', 'Shared'], for 'LookBackPeriod' supported values are ['Last7Days', 'Last30Days', 'Last60Days'] and for 'ResourceType' supported values are ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple']. + /// Keeps track of any properties unknown to the library. + internal FilterItems(FilterItemName? name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the filter. This is currently only supported for Export Definition type of ReservationRecommendations. Supported names are ['ReservationScope', 'LookBackPeriod', 'ResourceType']. + public FilterItemName? Name { get; set; } + /// Value to filter by. Currently values supported per name are, for 'ReservationScope' supported values are ['Single', 'Shared'], for 'LookBackPeriod' supported values are ['Last7Days', 'Last30Days', 'Last60Days'] and for 'ResourceType' supported values are ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple']. + public string Value { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastSpend.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastSpend.Serialization.cs new file mode 100644 index 000000000000..52589704e1c3 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastSpend.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class ForecastSpend : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ForecastSpend)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Amount)) + { + writer.WritePropertyName("amount"u8); + writer.WriteNumberValue(Amount.Value); + } + if (options.Format != "W" && Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ForecastSpend IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ForecastSpend)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeForecastSpend(document.RootElement, options); + } + + internal static ForecastSpend DeserializeForecastSpend(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + float? amount = default; + string unit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("amount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + amount = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ForecastSpend(amount, unit, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(ForecastSpend)} does not support writing '{options.Format}' format."); + } + } + + ForecastSpend IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeForecastSpend(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ForecastSpend)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastSpend.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastSpend.cs new file mode 100644 index 000000000000..cb1286a6e592 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ForecastSpend.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The forecasted cost which is being tracked for a budget. + /// + /// Supported for CategoryType(s): Cost. + /// + public partial class ForecastSpend + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ForecastSpend() + { + } + + /// Initializes a new instance of . + /// 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. + /// The unit of measure for the budget amount. + /// Keeps track of any properties unknown to the library. + internal ForecastSpend(float? amount, string unit, IDictionary serializedAdditionalRawData) + { + Amount = amount; + Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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. + public float? Amount { get; } + /// The unit of measure for the budget amount. + public string Unit { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Frequency.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Frequency.cs new file mode 100644 index 000000000000..935a04b20c09 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Frequency.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold breach. If not specified, the frequency will be set by default based on the timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + /// + /// Supported for CategoryType(s): ReservationUtilization. + /// + public readonly partial struct Frequency : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Frequency(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DailyValue = "Daily"; + private const string WeeklyValue = "Weekly"; + private const string MonthlyValue = "Monthly"; + + /// After the threshold breaches and an Alert is fired, no further alerts will be sent until the next calendar day. + public static Frequency Daily { get; } = new Frequency(DailyValue); + /// After the threshold breaches and an Alert is fired, no further alerts will be sent for 7 calendar days. + public static Frequency Weekly { get; } = new Frequency(WeeklyValue); + /// After the threshold breaches and an Alert is fired, no further alerts will be sent for 30 calendar days. + public static Frequency Monthly { get; } = new Frequency(MonthlyValue); + /// Determines if two values are the same. + public static bool operator ==(Frequency left, Frequency right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Frequency left, Frequency right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Frequency(string value) => new Frequency(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Frequency other && Equals(other); + /// + public bool Equals(Frequency other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/GranularityType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/GranularityType.cs index 653caa6bbfdc..7764c189bd88 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/GranularityType.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/GranularityType.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CostManagement.Models { - /// The granularity of rows in the export. Currently only 'Daily' is supported. + /// The granularity of rows in the export. Currently 'Daily' is supported for most cases. public readonly partial struct GranularityType : IEquatable { private readonly string _value; @@ -23,9 +23,12 @@ public GranularityType(string value) } private const string DailyValue = "Daily"; + private const string MonthlyValue = "Monthly"; /// Daily. public static GranularityType Daily { get; } = new GranularityType(DailyValue); + /// Monthly. + public static GranularityType Monthly { get; } = new GranularityType(MonthlyValue); /// Determines if two values are the same. public static bool operator ==(GranularityType left, GranularityType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/MCAPriceSheetProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/MCAPriceSheetProperties.Serialization.cs new file mode 100644 index 000000000000..ae90f5cf1511 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/MCAPriceSheetProperties.Serialization.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class MCAPriceSheetProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MCAPriceSheetProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(BillingAccountId)) + { + writer.WritePropertyName("billingAccountID"u8); + writer.WriteStringValue(BillingAccountId); + } + if (options.Format != "W" && Optional.IsDefined(BillingAccountName)) + { + writer.WritePropertyName("billingAccountName"u8); + writer.WriteStringValue(BillingAccountName); + } + if (options.Format != "W" && Optional.IsDefined(BillingProfileId)) + { + writer.WritePropertyName("billingProfileId"u8); + writer.WriteStringValue(BillingProfileId); + } + if (options.Format != "W" && Optional.IsDefined(BillingProfileName)) + { + writer.WritePropertyName("billingProfileName"u8); + writer.WriteStringValue(BillingProfileName); + } + if (options.Format != "W" && Optional.IsDefined(ProductOrderName)) + { + writer.WritePropertyName("productOrderName"u8); + writer.WriteStringValue(ProductOrderName); + } + if (options.Format != "W" && Optional.IsDefined(ServiceFamily)) + { + writer.WritePropertyName("serviceFamily"u8); + writer.WriteNumberValue(ServiceFamily.Value); + } + if (options.Format != "W" && Optional.IsDefined(Product)) + { + writer.WritePropertyName("product"u8); + writer.WriteStringValue(Product); + } + if (options.Format != "W" && Optional.IsDefined(ProductId)) + { + writer.WritePropertyName("productId"u8); + writer.WriteStringValue(ProductId); + } + if (options.Format != "W" && Optional.IsDefined(SkuId)) + { + writer.WritePropertyName("skuId"u8); + writer.WriteStringValue(SkuId); + } + if (options.Format != "W" && Optional.IsDefined(UnitOfMeasure)) + { + writer.WritePropertyName("unitOfMeasure"u8); + writer.WriteStringValue(UnitOfMeasure); + } + if (options.Format != "W" && Optional.IsDefined(MeterId)) + { + writer.WritePropertyName("meterId"u8); + writer.WriteStringValue(MeterId); + } + if (options.Format != "W" && Optional.IsDefined(MeterName)) + { + writer.WritePropertyName("meterName"u8); + writer.WriteStringValue(MeterName); + } + if (options.Format != "W" && Optional.IsDefined(MeterType)) + { + writer.WritePropertyName("meterType"u8); + writer.WriteStringValue(MeterType); + } + if (options.Format != "W" && Optional.IsDefined(MeterCategory)) + { + writer.WritePropertyName("meterCategory"u8); + writer.WriteStringValue(MeterCategory); + } + if (options.Format != "W" && Optional.IsDefined(MeterSubCategory)) + { + writer.WritePropertyName("meterSubCategory"u8); + writer.WriteStringValue(MeterSubCategory); + } + if (options.Format != "W" && Optional.IsDefined(MeterRegion)) + { + writer.WritePropertyName("meterRegion"u8); + writer.WriteStringValue(MeterRegion); + } + if (options.Format != "W" && Optional.IsDefined(TierMinimumUnits)) + { + writer.WritePropertyName("tierMinimumUnits"u8); + writer.WriteStringValue(TierMinimumUnits); + } + if (options.Format != "W" && Optional.IsDefined(EffectiveStartOn)) + { + writer.WritePropertyName("effectiveStartDate"u8); + writer.WriteStringValue(EffectiveStartOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(EffectiveEndOn)) + { + writer.WritePropertyName("effectiveEndDate"u8); + writer.WriteStringValue(EffectiveEndOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(UnitPrice)) + { + writer.WritePropertyName("unitPrice"u8); + writer.WriteStringValue(UnitPrice); + } + if (options.Format != "W" && Optional.IsDefined(BasePrice)) + { + writer.WritePropertyName("basePrice"u8); + writer.WriteStringValue(BasePrice); + } + if (options.Format != "W" && Optional.IsDefined(MarketPrice)) + { + writer.WritePropertyName("marketPrice"u8); + writer.WriteStringValue(MarketPrice); + } + if (options.Format != "W" && Optional.IsDefined(Currency)) + { + writer.WritePropertyName("currency"u8); + writer.WriteStringValue(Currency); + } + if (options.Format != "W" && Optional.IsDefined(BillingCurrency)) + { + writer.WritePropertyName("billingCurrency"u8); + writer.WriteStringValue(BillingCurrency); + } + if (options.Format != "W" && Optional.IsDefined(Term)) + { + writer.WritePropertyName("term"u8); + writer.WriteStringValue(Term); + } + if (options.Format != "W" && Optional.IsDefined(PriceType)) + { + writer.WritePropertyName("priceType"u8); + writer.WriteStringValue(PriceType); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MCAPriceSheetProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MCAPriceSheetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMCAPriceSheetProperties(document.RootElement, options); + } + + internal static MCAPriceSheetProperties DeserializeMCAPriceSheetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string billingAccountId = default; + string billingAccountName = default; + string billingProfileId = default; + string billingProfileName = default; + string productOrderName = default; + float? serviceFamily = default; + string product = default; + string productId = default; + string skuId = default; + string unitOfMeasure = default; + string meterId = default; + string meterName = default; + string meterType = default; + string meterCategory = default; + string meterSubCategory = default; + string meterRegion = default; + string tierMinimumUnits = default; + DateTimeOffset? effectiveStartDate = default; + DateTimeOffset? effectiveEndDate = default; + string unitPrice = default; + string basePrice = default; + string marketPrice = default; + string currency = default; + string billingCurrency = default; + string term = default; + string priceType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("billingAccountID"u8)) + { + billingAccountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("billingAccountName"u8)) + { + billingAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("billingProfileId"u8)) + { + billingProfileId = property.Value.GetString(); + continue; + } + if (property.NameEquals("billingProfileName"u8)) + { + billingProfileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("productOrderName"u8)) + { + productOrderName = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceFamily"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceFamily = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("product"u8)) + { + product = property.Value.GetString(); + continue; + } + if (property.NameEquals("productId"u8)) + { + productId = property.Value.GetString(); + continue; + } + if (property.NameEquals("skuId"u8)) + { + skuId = property.Value.GetString(); + continue; + } + if (property.NameEquals("unitOfMeasure"u8)) + { + unitOfMeasure = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterId"u8)) + { + meterId = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterName"u8)) + { + meterName = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterType"u8)) + { + meterType = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterCategory"u8)) + { + meterCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterSubCategory"u8)) + { + meterSubCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterRegion"u8)) + { + meterRegion = property.Value.GetString(); + continue; + } + if (property.NameEquals("tierMinimumUnits"u8)) + { + tierMinimumUnits = property.Value.GetString(); + continue; + } + if (property.NameEquals("effectiveStartDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + effectiveStartDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("effectiveEndDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + effectiveEndDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("unitPrice"u8)) + { + unitPrice = property.Value.GetString(); + continue; + } + if (property.NameEquals("basePrice"u8)) + { + basePrice = property.Value.GetString(); + continue; + } + if (property.NameEquals("marketPrice"u8)) + { + marketPrice = property.Value.GetString(); + continue; + } + if (property.NameEquals("currency"u8)) + { + currency = property.Value.GetString(); + continue; + } + if (property.NameEquals("billingCurrency"u8)) + { + billingCurrency = property.Value.GetString(); + continue; + } + if (property.NameEquals("term"u8)) + { + term = property.Value.GetString(); + continue; + } + if (property.NameEquals("priceType"u8)) + { + priceType = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MCAPriceSheetProperties( + billingAccountId, + billingAccountName, + billingProfileId, + billingProfileName, + productOrderName, + serviceFamily, + product, + productId, + skuId, + unitOfMeasure, + meterId, + meterName, + meterType, + meterCategory, + meterSubCategory, + meterRegion, + tierMinimumUnits, + effectiveStartDate, + effectiveEndDate, + unitPrice, + basePrice, + marketPrice, + currency, + billingCurrency, + term, + priceType, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(MCAPriceSheetProperties)} does not support writing '{options.Format}' format."); + } + } + + MCAPriceSheetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMCAPriceSheetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MCAPriceSheetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/MCAPriceSheetProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/MCAPriceSheetProperties.cs new file mode 100644 index 000000000000..03d5e8fea8f9 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/MCAPriceSheetProperties.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The properties of the price sheet. + public partial class MCAPriceSheetProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal MCAPriceSheetProperties() + { + } + + /// Initializes a new instance of . + /// Unique identifier for the billing account. + /// Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. + /// Unique identifier for the billing profile. + /// Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. + /// + /// Name of the purchased product plan. Indicates if this pricing is standard Azure Plan pricing, Dev/Test pricing etc. + /// + /// Currently unavailable for Azure 3rd party and ReservedInstance meters. + /// + /// Type of Azure service. For example, Compute, Analytics, and Security. + /// Name of the product accruing the charges. + /// Unique identifier for the product whose meter is consumed. + /// Unique identifier of the SKU. + /// How usage is measured for the service. + /// Unique identifier of the meter. + /// Name of the meter. The meter represents the deployable resource of an Azure service. + /// Name of the meter type. + /// Name of the classification category for the meter. For example, Cloud services, Networking, etc. + /// Name of the meter subclassification category. + /// Name of the Azure region where the meter for the service is available. + /// Defines the lower bound of the tier range for which prices are defined. For example, if the range is 0 to 100, tierMinimumUnits would be 0. + /// Effective start date of the Price Sheet billing period. + /// Effective end date of the Price Sheet billing period. + /// + /// The per-unit price at the time of billing for a given product or service, inclusive of any negotiated discounts on top of the market price. + /// + /// For PriceType ReservedInstance, unit price reflects the total cost of the 1 or 3-year commitment including discounts. + /// + /// Note: The unit price isn't the same as the effective price in usage details downloads when services have differential prices across tiers. + /// + /// If services have multi-tiered pricing, the effective price is a blended rate across the tiers and doesn't show a tier-specific unit price. The blended price or effective price is the net price for the consumed quantity spanning across the multiple tiers (where each tier has a specific unit price). + /// + /// + /// The unit price at the time the customer signs on or the unit price at the time of service meter GA launch if it is after sign-on. + /// + /// This is applicable for Enterprise Agreement users + /// + /// + /// The current list price for a given product or service. This price is without any negotiations and is based on your Microsoft Agreement type. + /// + /// For PriceType Consumption, market price is reflected as the pay-as-you-go price. + /// + /// For PriceType Savings Plan, market price reflects the Savings plan benefit on top of pay-as-you-go price for the corresponding commitment term. + /// + /// For PriceType ReservedInstance, market price reflects the total price of the 1 or 3-year commitment. + /// + /// Currency in which all the prices are reflected. + /// Currency in which charges are posted. + /// Term length for Azure Savings Plan or Reservation term – one year or three years (P1Y or P3Y). + /// Price type for a product. For example, an Azure resource with a pay-as-you-go rate with priceType as Consumption. Other price types include ReservedInstance and Savings Plan. + /// Keeps track of any properties unknown to the library. + internal MCAPriceSheetProperties(string billingAccountId, string billingAccountName, string billingProfileId, string billingProfileName, string productOrderName, float? serviceFamily, string product, string productId, string skuId, string unitOfMeasure, string meterId, string meterName, string meterType, string meterCategory, string meterSubCategory, string meterRegion, string tierMinimumUnits, DateTimeOffset? effectiveStartOn, DateTimeOffset? effectiveEndOn, string unitPrice, string basePrice, string marketPrice, string currency, string billingCurrency, string term, string priceType, IDictionary serializedAdditionalRawData) + { + BillingAccountId = billingAccountId; + BillingAccountName = billingAccountName; + BillingProfileId = billingProfileId; + BillingProfileName = billingProfileName; + ProductOrderName = productOrderName; + ServiceFamily = serviceFamily; + Product = product; + ProductId = productId; + SkuId = skuId; + UnitOfMeasure = unitOfMeasure; + MeterId = meterId; + MeterName = meterName; + MeterType = meterType; + MeterCategory = meterCategory; + MeterSubCategory = meterSubCategory; + MeterRegion = meterRegion; + TierMinimumUnits = tierMinimumUnits; + EffectiveStartOn = effectiveStartOn; + EffectiveEndOn = effectiveEndOn; + UnitPrice = unitPrice; + BasePrice = basePrice; + MarketPrice = marketPrice; + Currency = currency; + BillingCurrency = billingCurrency; + Term = term; + PriceType = priceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Unique identifier for the billing account. + public string BillingAccountId { get; } + /// Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. + public string BillingAccountName { get; } + /// Unique identifier for the billing profile. + public string BillingProfileId { get; } + /// Name of the billing profile that is set up to receive invoices. The prices in the price sheet are associated with this billing profile. + public string BillingProfileName { get; } + /// + /// Name of the purchased product plan. Indicates if this pricing is standard Azure Plan pricing, Dev/Test pricing etc. + /// + /// Currently unavailable for Azure 3rd party and ReservedInstance meters. + /// + public string ProductOrderName { get; } + /// Type of Azure service. For example, Compute, Analytics, and Security. + public float? ServiceFamily { get; } + /// Name of the product accruing the charges. + public string Product { get; } + /// Unique identifier for the product whose meter is consumed. + public string ProductId { get; } + /// Unique identifier of the SKU. + public string SkuId { get; } + /// How usage is measured for the service. + public string UnitOfMeasure { get; } + /// Unique identifier of the meter. + public string MeterId { get; } + /// Name of the meter. The meter represents the deployable resource of an Azure service. + public string MeterName { get; } + /// Name of the meter type. + public string MeterType { get; } + /// Name of the classification category for the meter. For example, Cloud services, Networking, etc. + public string MeterCategory { get; } + /// Name of the meter subclassification category. + public string MeterSubCategory { get; } + /// Name of the Azure region where the meter for the service is available. + public string MeterRegion { get; } + /// Defines the lower bound of the tier range for which prices are defined. For example, if the range is 0 to 100, tierMinimumUnits would be 0. + public string TierMinimumUnits { get; } + /// Effective start date of the Price Sheet billing period. + public DateTimeOffset? EffectiveStartOn { get; } + /// Effective end date of the Price Sheet billing period. + public DateTimeOffset? EffectiveEndOn { get; } + /// + /// The per-unit price at the time of billing for a given product or service, inclusive of any negotiated discounts on top of the market price. + /// + /// For PriceType ReservedInstance, unit price reflects the total cost of the 1 or 3-year commitment including discounts. + /// + /// Note: The unit price isn't the same as the effective price in usage details downloads when services have differential prices across tiers. + /// + /// If services have multi-tiered pricing, the effective price is a blended rate across the tiers and doesn't show a tier-specific unit price. The blended price or effective price is the net price for the consumed quantity spanning across the multiple tiers (where each tier has a specific unit price). + /// + public string UnitPrice { get; } + /// + /// The unit price at the time the customer signs on or the unit price at the time of service meter GA launch if it is after sign-on. + /// + /// This is applicable for Enterprise Agreement users + /// + public string BasePrice { get; } + /// + /// The current list price for a given product or service. This price is without any negotiations and is based on your Microsoft Agreement type. + /// + /// For PriceType Consumption, market price is reflected as the pay-as-you-go price. + /// + /// For PriceType Savings Plan, market price reflects the Savings plan benefit on top of pay-as-you-go price for the corresponding commitment term. + /// + /// For PriceType ReservedInstance, market price reflects the total price of the 1 or 3-year commitment. + /// + public string MarketPrice { get; } + /// Currency in which all the prices are reflected. + public string Currency { get; } + /// Currency in which charges are posted. + public string BillingCurrency { get; } + /// Term length for Azure Savings Plan or Reservation term – one year or three years (P1Y or P3Y). + public string Term { get; } + /// Price type for a product. For example, an Azure resource with a pay-as-you-go rate with priceType as Consumption. Other price types include ReservedInstance and Savings Plan. + public string PriceType { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Notification.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Notification.Serialization.cs new file mode 100644 index 000000000000..fd6ab859abc3 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Notification.Serialization.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class Notification : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Notification)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled); + writer.WritePropertyName("operator"u8); + writer.WriteStringValue(Operator.ToString()); + writer.WritePropertyName("threshold"u8); + writer.WriteNumberValue(Threshold); + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + writer.WritePropertyName("contactEmails"u8); + writer.WriteStartArray(); + foreach (var item in ContactEmails) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(ContactRoles)) + { + writer.WritePropertyName("contactRoles"u8); + writer.WriteStartArray(); + foreach (var item in ContactRoles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ContactGroups)) + { + writer.WritePropertyName("contactGroups"u8); + writer.WriteStartArray(); + foreach (var item in ContactGroups) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ThresholdType)) + { + writer.WritePropertyName("thresholdType"u8); + writer.WriteStringValue(ThresholdType.Value.ToString()); + } + if (Optional.IsDefined(Locale)) + { + writer.WritePropertyName("locale"u8); + writer.WriteStringValue(Locale.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Notification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Notification)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotification(document.RootElement, options); + } + + internal static Notification DeserializeNotification(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool enabled = default; + BudgetNotificationOperatorType @operator = default; + float threshold = default; + Frequency? frequency = default; + IList contactEmails = default; + IList contactRoles = default; + IList contactGroups = default; + ThresholdType? thresholdType = default; + CultureCode? locale = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = new BudgetNotificationOperatorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("threshold"u8)) + { + threshold = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("frequency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequency = new Frequency(property.Value.GetString()); + continue; + } + if (property.NameEquals("contactEmails"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contactEmails = array; + continue; + } + if (property.NameEquals("contactRoles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contactRoles = array; + continue; + } + if (property.NameEquals("contactGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + contactGroups = array; + continue; + } + if (property.NameEquals("thresholdType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + thresholdType = new ThresholdType(property.Value.GetString()); + continue; + } + if (property.NameEquals("locale"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + locale = new CultureCode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Notification( + enabled, + @operator, + threshold, + frequency, + contactEmails, + contactRoles ?? new ChangeTrackingList(), + contactGroups ?? new ChangeTrackingList(), + thresholdType, + locale, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(Notification)} does not support writing '{options.Format}' format."); + } + } + + Notification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNotification(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Notification)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Notification.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Notification.cs new file mode 100644 index 000000000000..830dc7fbdad5 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Notification.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The notification associated with a budget. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public partial class Notification + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// The notification is enabled or not. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// The comparison operator. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported operators for **CategoryType: Cost** + /// - GreaterThan + /// - GreaterThanOrEqualTo + /// + /// Supported operators for **CategoryType: ReservationUtilization** + /// - LessThan + /// + /// + /// Threshold value associated with a notification. It is always percent with a maximum of 2 decimal places. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// **CategoryType: Cost** - Must be between 0 and 1000. Notification is sent when the cost exceeded the threshold. + /// + /// **CategoryType: ReservationUtilization** - Must be between 0 and 100. Notification is sent when a reservation has a utilization percentage below the threshold. + /// + /// + /// Email addresses to send the notification to when the threshold is breached. 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. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// is null. + public Notification(bool enabled, BudgetNotificationOperatorType @operator, float threshold, IEnumerable contactEmails) + { + Argument.AssertNotNull(contactEmails, nameof(contactEmails)); + + Enabled = enabled; + Operator = @operator; + Threshold = threshold; + ContactEmails = contactEmails.ToList(); + ContactRoles = new ChangeTrackingList(); + ContactGroups = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The notification is enabled or not. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// The comparison operator. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported operators for **CategoryType: Cost** + /// - GreaterThan + /// - GreaterThanOrEqualTo + /// + /// Supported operators for **CategoryType: ReservationUtilization** + /// - LessThan + /// + /// + /// Threshold value associated with a notification. It is always percent with a maximum of 2 decimal places. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// **CategoryType: Cost** - Must be between 0 and 1000. Notification is sent when the cost exceeded the threshold. + /// + /// **CategoryType: ReservationUtilization** - Must be between 0 and 100. Notification is sent when a reservation has a utilization percentage below the threshold. + /// + /// + /// Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold breach. If not specified, the frequency will be set by default based on the timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + /// + /// Supported for CategoryType(s): ReservationUtilization. + /// + /// + /// Email addresses to send the notification to when the threshold is breached. 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. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// + /// Subscription or Resource Group scopes only. Contact roles to send the notification to when the threshold is breached. + /// + /// Supported for CategoryType(s): Cost. + /// + /// + /// Subscription or Resource Group scopes only. Action groups to send the notification to when the threshold is exceeded. Must be provided as a fully qualified Azure resource id. + /// + /// Supported for CategoryType(s): Cost. + /// + /// + /// The type of threshold. + /// + /// Supported for CategoryType(s): Cost. + /// + /// + /// Language in which the recipient will receive the notification, + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Keeps track of any properties unknown to the library. + internal Notification(bool enabled, BudgetNotificationOperatorType @operator, float threshold, Frequency? frequency, IList contactEmails, IList contactRoles, IList contactGroups, ThresholdType? thresholdType, CultureCode? locale, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + Operator = @operator; + Threshold = threshold; + Frequency = frequency; + ContactEmails = contactEmails; + ContactRoles = contactRoles; + ContactGroups = contactGroups; + ThresholdType = thresholdType; + Locale = locale; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Notification() + { + } + + /// + /// The notification is enabled or not. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public bool Enabled { get; set; } + /// + /// The comparison operator. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported operators for **CategoryType: Cost** + /// - GreaterThan + /// - GreaterThanOrEqualTo + /// + /// Supported operators for **CategoryType: ReservationUtilization** + /// - LessThan + /// + public BudgetNotificationOperatorType Operator { get; set; } + /// + /// Threshold value associated with a notification. It is always percent with a maximum of 2 decimal places. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// **CategoryType: Cost** - Must be between 0 and 1000. Notification is sent when the cost exceeded the threshold. + /// + /// **CategoryType: ReservationUtilization** - Must be between 0 and 100. Notification is sent when a reservation has a utilization percentage below the threshold. + /// + public float Threshold { get; set; } + /// + /// Frequency of a notification. Represents how long the notification will be silent after triggering an alert for a threshold breach. If not specified, the frequency will be set by default based on the timeGrain (Weekly when timeGrain: Last7Days, Monthly when timeGrain: Last30Days). + /// + /// Supported for CategoryType(s): ReservationUtilization. + /// + public Frequency? Frequency { get; set; } + /// + /// Email addresses to send the notification to when the threshold is breached. 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. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public IList ContactEmails { get; } + /// + /// Subscription or Resource Group scopes only. Contact roles to send the notification to when the threshold is breached. + /// + /// Supported for CategoryType(s): Cost. + /// + public IList ContactRoles { get; } + /// + /// Subscription or Resource Group scopes only. Action groups to send the notification to when the threshold is exceeded. Must be provided as a fully qualified Azure resource id. + /// + /// Supported for CategoryType(s): Cost. + /// + public IList ContactGroups { get; } + /// + /// The type of threshold. + /// + /// Supported for CategoryType(s): Cost. + /// + public ThresholdType? ThresholdType { get; set; } + /// + /// Language in which the recipient will receive the notification, + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + public CultureCode? Locale { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatusType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatusType.cs index 505adeb56c2b..8de8a1b7b05d 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatusType.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/OperationStatusType.cs @@ -23,18 +23,15 @@ public OperationStatusType(string value) } private const string RunningValue = "Running"; - private const string CompleteValue = "Complete"; - private const string FailedValue = "Failed"; private const string CompletedValue = "Completed"; + private const string FailedValue = "Failed"; /// Running. public static OperationStatusType Running { get; } = new OperationStatusType(RunningValue); - /// Complete. - public static OperationStatusType Complete { get; } = new OperationStatusType(CompleteValue); - /// Failed. - public static OperationStatusType Failed { get; } = new OperationStatusType(FailedValue); /// Completed. public static OperationStatusType Completed { get; } = new OperationStatusType(CompletedValue); + /// Failed. + public static OperationStatusType Failed { get; } = new OperationStatusType(FailedValue); /// Determines if two values are the same. public static bool operator ==(OperationStatusType left, OperationStatusType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/PricesheetDownloadProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/PricesheetDownloadProperties.Serialization.cs new file mode 100644 index 000000000000..13561269a091 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/PricesheetDownloadProperties.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class PricesheetDownloadProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PricesheetDownloadProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ExpiryOn)) + { + writer.WritePropertyName("expiryTime"u8); + writer.WriteStringValue(ExpiryOn.Value, "O"); + } + if (Optional.IsDefined(DownloadUri)) + { + writer.WritePropertyName("downloadUrl"u8); + writer.WriteStringValue(DownloadUri.AbsoluteUri); + } + if (Optional.IsDefined(DownloadFileProperties)) + { + writer.WritePropertyName("downloadFileProperties"u8); + writer.WriteObjectValue(DownloadFileProperties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PricesheetDownloadProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PricesheetDownloadProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePricesheetDownloadProperties(document.RootElement, options); + } + + internal static PricesheetDownloadProperties DeserializePricesheetDownloadProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? expiryTime = default; + Uri downloadUrl = default; + MCAPriceSheetProperties downloadFileProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("expiryTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiryTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("downloadUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + downloadUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("downloadFileProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + downloadFileProperties = MCAPriceSheetProperties.DeserializeMCAPriceSheetProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PricesheetDownloadProperties(expiryTime, downloadUrl, downloadFileProperties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(PricesheetDownloadProperties)} does not support writing '{options.Format}' format."); + } + } + + PricesheetDownloadProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePricesheetDownloadProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PricesheetDownloadProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/PricesheetDownloadProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/PricesheetDownloadProperties.cs new file mode 100644 index 000000000000..fb199d6571f9 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/PricesheetDownloadProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The URL to download the generated report. + public partial class PricesheetDownloadProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal PricesheetDownloadProperties() + { + } + + /// Initializes a new instance of . + /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + /// The URL to download the generated report. + /// The properties in downloaded file. + /// Keeps track of any properties unknown to the library. + internal PricesheetDownloadProperties(DateTimeOffset? expiryOn, Uri downloadUri, MCAPriceSheetProperties downloadFileProperties, IDictionary serializedAdditionalRawData) + { + ExpiryOn = expiryOn; + DownloadUri = downloadUri; + DownloadFileProperties = downloadFileProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. + public DateTimeOffset? ExpiryOn { get; } + /// The URL to download the generated report. + public Uri DownloadUri { get; } + /// The properties in downloaded file. + public MCAPriceSheetProperties DownloadFileProperties { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Reason.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Reason.cs new file mode 100644 index 000000000000..134557ebc039 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/Reason.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The reason this name is not available. + public readonly partial struct Reason : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Reason(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string AlreadyExistsValue = "AlreadyExists"; + private const string ValidValue = "Valid"; + + /// Invalid. + public static Reason Invalid { get; } = new Reason(InvalidValue); + /// AlreadyExists. + public static Reason AlreadyExists { get; } = new Reason(AlreadyExistsValue); + /// Valid. + public static Reason Valid { get; } = new Reason(ValidValue); + /// Determines if two values are the same. + public static bool operator ==(Reason left, Reason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Reason left, Reason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Reason(string value) => new Reason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Reason other && Equals(other); + /// + public bool Equals(Reason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RuleStatus.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RuleStatus.cs new file mode 100644 index 000000000000..a3526502be34 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/RuleStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Current status of the rule. + public readonly partial struct RuleStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RuleStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotActiveValue = "NotActive"; + private const string ActiveValue = "Active"; + private const string ProcessingValue = "Processing"; + + /// Rule is saved but not used to allocate costs. + public static RuleStatus NotActive { get; } = new RuleStatus(NotActiveValue); + /// Rule is saved and impacting cost allocation. + public static RuleStatus Active { get; } = new RuleStatus(ActiveValue); + /// Rule is saved and cost allocation is being updated. Readonly value that cannot be submitted in a put request. + public static RuleStatus Processing { get; } = new RuleStatus(ProcessingValue); + /// Determines if two values are the same. + public static bool operator ==(RuleStatus left, RuleStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RuleStatus left, RuleStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RuleStatus(string value) => new RuleStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RuleStatus other && Equals(other); + /// + public bool Equals(RuleStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs index 3c2899e0a2e2..f36f84a42787 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SavingsPlanUtilizationSummary.cs @@ -33,9 +33,9 @@ public SavingsPlanUtilizationSummary() /// The benefit order ID is the identifier for a benefit purchase. /// The benefit type. Supported values: 'SavingsPlan'. /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. - /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. - /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. - /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. + /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. + /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. + /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. internal SavingsPlanUtilizationSummary(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BillingAccountBenefitKind kind, IDictionary serializedAdditionalRawData, string armSkuName, string benefitId, string benefitOrderId, BillingAccountBenefitKind? benefitType, DateTimeOffset? usageOn, decimal? avgUtilizationPercentage, decimal? minUtilizationPercentage, decimal? maxUtilizationPercentage) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) { ArmSkuName = armSkuName; @@ -59,11 +59,11 @@ internal SavingsPlanUtilizationSummary(ResourceIdentifier id, string name, Resou public BillingAccountBenefitKind? BenefitType { get; set; } /// Date corresponding to the utilization summary record. If the grain of data is monthly, value for this field will be first day of the month. public DateTimeOffset? UsageOn { get; } - /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. + /// This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. public decimal? AvgUtilizationPercentage { get; } - /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. + /// This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage was 10% at hour 4, then the value for the minUtilizationPercentage in the response will be 10%. public decimal? MinUtilizationPercentage { get; } - /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. + /// This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > 2025-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage was 90% at hour 5, then the value for the maxUtilizationPercentage in the response will be 90%. public decimal? MaxUtilizationPercentage { get; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs index 1eb596f02fc0..975f650b803b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionListResult.Serialization.cs @@ -44,7 +44,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionStatus.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionStatus.cs index 2c94d660b982..791f441b0479 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionStatus.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ScheduledActionStatus.cs @@ -22,16 +22,16 @@ public ScheduledActionStatus(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string DisabledValue = "Disabled"; private const string EnabledValue = "Enabled"; private const string ExpiredValue = "Expired"; + private const string DisabledValue = "Disabled"; - /// Scheduled action is saved but will not be run. - public static ScheduledActionStatus Disabled { get; } = new ScheduledActionStatus(DisabledValue); /// Scheduled action is saved and will be run. public static ScheduledActionStatus Enabled { get; } = new ScheduledActionStatus(EnabledValue); /// Scheduled action is expired. public static ScheduledActionStatus Expired { get; } = new ScheduledActionStatus(ExpiredValue); + /// Scheduled action is saved but will not be run. + public static ScheduledActionStatus Disabled { get; } = new ScheduledActionStatus(DisabledValue); /// Determines if two values are the same. public static bool operator ==(ScheduledActionStatus left, ScheduledActionStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingType.cs new file mode 100644 index 000000000000..fe7127ff3e79 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The SettingType. + public readonly partial struct SettingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SettingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TaginheritanceValue = "taginheritance"; + + /// This setting applies billing profile, invoice section, subscription and resource group tags to current month's usage data of child resources. + public static SettingType Taginheritance { get; } = new SettingType(TaginheritanceValue); + /// Determines if two values are the same. + public static bool operator ==(SettingType left, SettingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SettingType left, SettingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SettingType(string value) => new SettingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SettingType other && Equals(other); + /// + public bool Equals(SettingType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsKind.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsKind.cs new file mode 100644 index 000000000000..4a2993a6627a --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsKind.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Specifies the kind of settings. + internal readonly partial struct SettingsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SettingsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TaginheritanceValue = "taginheritance"; + + /// taginheritance. + public static SettingsKind Taginheritance { get; } = new SettingsKind(TaginheritanceValue); + /// Determines if two values are the same. + public static bool operator ==(SettingsKind left, SettingsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SettingsKind left, SettingsKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SettingsKind(string value) => new SettingsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SettingsKind other && Equals(other); + /// + public bool Equals(SettingsKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsListResult.Serialization.cs new file mode 100644 index 000000000000..1e9c9aa13e18 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsListResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + internal partial class SettingsListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SettingsListResult)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SettingsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SettingsListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSettingsListResult(document.RootElement, options); + } + + internal static SettingsListResult DeserializeSettingsListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SettingData.DeserializeSettingData(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SettingsListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(SettingsListResult)} does not support writing '{options.Format}' format."); + } + } + + SettingsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSettingsListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SettingsListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsListResult.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsListResult.cs new file mode 100644 index 000000000000..4f4557bf7281 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SettingsListResult.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Setting list result. It contains a list of settings. + internal partial class SettingsListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal SettingsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The list of settings. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// Keeps track of any properties unknown to the library. + internal SettingsListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The list of settings. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SourceCostAllocationResource.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SourceCostAllocationResource.Serialization.cs new file mode 100644 index 000000000000..d8f485c19b9f --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SourceCostAllocationResource.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class SourceCostAllocationResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SourceCostAllocationResource)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + + SourceCostAllocationResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SourceCostAllocationResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSourceCostAllocationResource(document.RootElement, options); + } + + internal static SourceCostAllocationResource DeserializeSourceCostAllocationResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList values = default; + CostAllocationResourceType resourceType = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (property.NameEquals("resourceType"u8)) + { + resourceType = new CostAllocationResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SourceCostAllocationResource(resourceType, name, serializedAdditionalRawData, values); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(SourceCostAllocationResource)} does not support writing '{options.Format}' format."); + } + } + + SourceCostAllocationResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSourceCostAllocationResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SourceCostAllocationResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SourceCostAllocationResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SourceCostAllocationResource.cs new file mode 100644 index 000000000000..8623569161f7 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/SourceCostAllocationResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Source resources for cost allocation. + public partial class SourceCostAllocationResource : CostAllocationResource + { + /// Initializes a new instance of . + /// Type of resources contained in this cost allocation rule. + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + /// Source Resources for cost allocation. This list cannot contain more than 25 values. + /// or is null. + public SourceCostAllocationResource(CostAllocationResourceType resourceType, string name, IEnumerable values) : base(resourceType, name) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(values, nameof(values)); + + Values = values.ToList(); + } + + /// Initializes a new instance of . + /// Type of resources contained in this cost allocation rule. + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + /// Keeps track of any properties unknown to the library. + /// Source Resources for cost allocation. This list cannot contain more than 25 values. + internal SourceCostAllocationResource(CostAllocationResourceType resourceType, string name, IDictionary serializedAdditionalRawData, IList values) : base(resourceType, name, serializedAdditionalRawData) + { + Values = values; + } + + /// Initializes a new instance of for deserialization. + internal SourceCostAllocationResource() + { + } + + /// Source Resources for cost allocation. This list cannot contain more than 25 values. + public IList Values { get; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceProperties.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceProperties.Serialization.cs new file mode 100644 index 000000000000..3fd75164a924 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceProperties.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + internal partial class TagInheritanceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TagInheritanceProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("preferContainerTags"u8); + writer.WriteBooleanValue(PreferContainerTags); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TagInheritanceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TagInheritanceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTagInheritanceProperties(document.RootElement, options); + } + + internal static TagInheritanceProperties DeserializeTagInheritanceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool preferContainerTags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("preferContainerTags"u8)) + { + preferContainerTags = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TagInheritanceProperties(preferContainerTags, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(TagInheritanceProperties)} does not support writing '{options.Format}' format."); + } + } + + TagInheritanceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTagInheritanceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TagInheritanceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceProperties.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceProperties.cs new file mode 100644 index 000000000000..de417cfabb06 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceProperties.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// The properties of the tag inheritance setting. + internal partial class TagInheritanceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This property defines the behavior when an inherited tag being applied matches a lower scope tag (Eg. Subscription tag matches the resource tag). If set to true - when tags match, the highest scope tags will be applied. Billing profile is the highest scope, followed by invoice sections, subscriptions and resource groups (allows overriding of lower scope tag values). If set to false - when tags match, the lowest scope tags will be applied. So, if a resource has the same tag as a subscription tag, the resource tag will be applied (does not allow overriding of lower scope tag values). + public TagInheritanceProperties(bool preferContainerTags) + { + PreferContainerTags = preferContainerTags; + } + + /// Initializes a new instance of . + /// This property defines the behavior when an inherited tag being applied matches a lower scope tag (Eg. Subscription tag matches the resource tag). If set to true - when tags match, the highest scope tags will be applied. Billing profile is the highest scope, followed by invoice sections, subscriptions and resource groups (allows overriding of lower scope tag values). If set to false - when tags match, the lowest scope tags will be applied. So, if a resource has the same tag as a subscription tag, the resource tag will be applied (does not allow overriding of lower scope tag values). + /// Keeps track of any properties unknown to the library. + internal TagInheritanceProperties(bool preferContainerTags, IDictionary serializedAdditionalRawData) + { + PreferContainerTags = preferContainerTags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TagInheritanceProperties() + { + } + + /// This property defines the behavior when an inherited tag being applied matches a lower scope tag (Eg. Subscription tag matches the resource tag). If set to true - when tags match, the highest scope tags will be applied. Billing profile is the highest scope, followed by invoice sections, subscriptions and resource groups (allows overriding of lower scope tag values). If set to false - when tags match, the lowest scope tags will be applied. So, if a resource has the same tag as a subscription tag, the resource tag will be applied (does not allow overriding of lower scope tag values). + public bool PreferContainerTags { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceSetting.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceSetting.Serialization.cs new file mode 100644 index 000000000000..55a3f6704c1e --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceSetting.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class TagInheritanceSetting : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TagInheritanceSetting)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + TagInheritanceSetting IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TagInheritanceSetting)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTagInheritanceSetting(document.RootElement, options); + } + + internal static TagInheritanceSetting DeserializeTagInheritanceSetting(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TagInheritanceProperties properties = default; + SettingsKind kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = TagInheritanceProperties.DeserializeTagInheritanceProperties(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new SettingsKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerCostManagementContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TagInheritanceSetting( + id, + name, + type, + systemData, + kind, + serializedAdditionalRawData, + properties); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(TagInheritanceSetting)} does not support writing '{options.Format}' format."); + } + } + + TagInheritanceSetting IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTagInheritanceSetting(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TagInheritanceSetting)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceSetting.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceSetting.cs new file mode 100644 index 000000000000..8b086c313bcd --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TagInheritanceSetting.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Tag Inheritance Setting definition. + public partial class TagInheritanceSetting : SettingData + { + /// Initializes a new instance of . + public TagInheritanceSetting() + { + Kind = SettingsKind.Taginheritance; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + /// Keeps track of any properties unknown to the library. + /// The properties of the tag inheritance setting. + internal TagInheritanceSetting(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SettingsKind kind, IDictionary serializedAdditionalRawData, TagInheritanceProperties properties) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) + { + Properties = properties; + Kind = kind; + } + + /// The properties of the tag inheritance setting. + internal TagInheritanceProperties Properties { get; set; } + /// This property defines the behavior when an inherited tag being applied matches a lower scope tag (Eg. Subscription tag matches the resource tag). If set to true - when tags match, the highest scope tags will be applied. Billing profile is the highest scope, followed by invoice sections, subscriptions and resource groups (allows overriding of lower scope tag values). If set to false - when tags match, the lowest scope tags will be applied. So, if a resource has the same tag as a subscription tag, the resource tag will be applied (does not allow overriding of lower scope tag values). + public bool? PreferContainerTags + { + get => Properties is null ? default(bool?) : Properties.PreferContainerTags; + set + { + Properties = value.HasValue ? new TagInheritanceProperties(value.Value) : null; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TargetCostAllocationResource.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TargetCostAllocationResource.Serialization.cs new file mode 100644 index 000000000000..84e5a437c604 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TargetCostAllocationResource.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CostManagement.Models +{ + public partial class TargetCostAllocationResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetCostAllocationResource)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("policyType"u8); + writer.WriteStringValue(PolicyType.ToString()); + } + + TargetCostAllocationResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetCostAllocationResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetCostAllocationResource(document.RootElement, options); + } + + internal static TargetCostAllocationResource DeserializeTargetCostAllocationResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList values = default; + CostAllocationPolicyType policyType = default; + CostAllocationResourceType resourceType = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CostAllocationProportion.DeserializeCostAllocationProportion(item, options)); + } + values = array; + continue; + } + if (property.NameEquals("policyType"u8)) + { + policyType = new CostAllocationPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + resourceType = new CostAllocationResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetCostAllocationResource(resourceType, name, serializedAdditionalRawData, values, policyType); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(TargetCostAllocationResource)} does not support writing '{options.Format}' format."); + } + } + + TargetCostAllocationResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetCostAllocationResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetCostAllocationResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TargetCostAllocationResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TargetCostAllocationResource.cs new file mode 100644 index 000000000000..3a19170be476 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TargetCostAllocationResource.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Target resources for cost allocation. + public partial class TargetCostAllocationResource : CostAllocationResource + { + /// Initializes a new instance of . + /// Type of resources contained in this cost allocation rule. + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + /// Target resources for cost allocation. This list cannot contain more than 25 values. + /// Method of cost allocation for the rule. + /// or is null. + public TargetCostAllocationResource(CostAllocationResourceType resourceType, string name, IEnumerable values, CostAllocationPolicyType policyType) : base(resourceType, name) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(values, nameof(values)); + + Values = values.ToList(); + PolicyType = policyType; + } + + /// Initializes a new instance of . + /// Type of resources contained in this cost allocation rule. + /// If resource type is dimension, this must be either ResourceGroupName or SubscriptionId. If resource type is tag, this must be a valid Azure tag. + /// Keeps track of any properties unknown to the library. + /// Target resources for cost allocation. This list cannot contain more than 25 values. + /// Method of cost allocation for the rule. + internal TargetCostAllocationResource(CostAllocationResourceType resourceType, string name, IDictionary serializedAdditionalRawData, IList values, CostAllocationPolicyType policyType) : base(resourceType, name, serializedAdditionalRawData) + { + Values = values; + PolicyType = policyType; + } + + /// Initializes a new instance of for deserialization. + internal TargetCostAllocationResource() + { + } + + /// Target resources for cost allocation. This list cannot contain more than 25 values. + public IList Values { get; } + /// Method of cost allocation for the rule. + public CostAllocationPolicyType PolicyType { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ThresholdType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ThresholdType.cs new file mode 100644 index 000000000000..aed39df6db65 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ThresholdType.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The type of threshold. + /// + /// Supported for CategoryType(s): Cost. + /// + public readonly partial struct ThresholdType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ThresholdType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActualValue = "Actual"; + private const string ForecastedValue = "Forecasted"; + + /// Actual costs budget alerts notify when the actual accrued cost exceeds the allocated budget. + public static ThresholdType Actual { get; } = new ThresholdType(ActualValue); + /// 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. + public static ThresholdType Forecasted { get; } = new ThresholdType(ForecastedValue); + /// Determines if two values are the same. + public static bool operator ==(ThresholdType left, ThresholdType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ThresholdType left, ThresholdType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ThresholdType(string value) => new ThresholdType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ThresholdType other && Equals(other); + /// + public bool Equals(ThresholdType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeGrainType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeGrainType.cs new file mode 100644 index 000000000000..15743aff6a5b --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeGrainType.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// + /// The time covered by a budget. Tracking of the amount will be reset based on the time grain. + /// + /// Supported for CategoryType(s): Cost, ReservationUtilization. + /// + /// Supported timeGrainTypes for **CategoryType: Cost** + /// + /// - Monthly + /// - Quarterly + /// - Annually + /// - BillingMonth* + /// - BillingQuarter* + /// - BillingAnnual* + /// + /// *only supported for Web Direct customers. + /// + /// Supported timeGrainTypes for **CategoryType: ReservationUtilization** + /// - Last7Days + /// - Last30Days + /// + /// Required for CategoryType(s): Cost, ReservationUtilization. + /// + public readonly partial struct TimeGrainType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TimeGrainType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MonthlyValue = "Monthly"; + private const string QuarterlyValue = "Quarterly"; + private const string AnnuallyValue = "Annually"; + private const string BillingMonthValue = "BillingMonth"; + private const string BillingQuarterValue = "BillingQuarter"; + private const string BillingAnnualValue = "BillingAnnual"; + private const string Last7DaysValue = "Last7Days"; + private const string Last30DaysValue = "Last30Days"; + + /// + /// The budget will track costs in the current calendar month against the amount. + /// + /// Supported for CategoryType: Cost only. + /// + public static TimeGrainType Monthly { get; } = new TimeGrainType(MonthlyValue); + /// + /// The budget will track costs in the current calendar quarter against the amount. + /// + /// Supported for CategoryType: Cost only. + /// + public static TimeGrainType Quarterly { get; } = new TimeGrainType(QuarterlyValue); + /// + /// The budget will track costs in the current calendar year against the amount. + /// + /// Supported for CategoryType: Cost only. + /// + public static TimeGrainType Annually { get; } = new TimeGrainType(AnnuallyValue); + /// + /// The budget will track costs in the current billing month against the amount. + /// + /// Supported for CategoryType: Cost and Web Direct customers only. + /// + public static TimeGrainType BillingMonth { get; } = new TimeGrainType(BillingMonthValue); + /// + /// The budget will track costs in the current billing quarter against the amount. + /// + /// Supported for CategoryType: Cost and Web Direct customers only. + /// + public static TimeGrainType BillingQuarter { get; } = new TimeGrainType(BillingQuarterValue); + /// + /// The budget will track costs in the current billing year against the amount. + /// + /// Supported for CategoryType: Cost and Web Direct customers only. + /// + public static TimeGrainType BillingAnnual { get; } = new TimeGrainType(BillingAnnualValue); + /// + /// The Reservation Utilization Alert Rule will evaluate reservations based on their 7-Day utilization percentage. + /// + /// Supported for CategoryType: ReservationUtilization only. + /// + public static TimeGrainType Last7Days { get; } = new TimeGrainType(Last7DaysValue); + /// + /// The Reservation Utilization Alert Rule will evaluate reservations based on their 30-Day utilization percentage. + /// + /// Supported for CategoryType: ReservationUtilization only. + /// + public static TimeGrainType Last30Days { get; } = new TimeGrainType(Last30DaysValue); + /// Determines if two values are the same. + public static bool operator ==(TimeGrainType left, TimeGrainType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TimeGrainType left, TimeGrainType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TimeGrainType(string value) => new TimeGrainType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TimeGrainType other && Equals(other); + /// + public bool Equals(TimeGrainType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeframeType.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeframeType.cs index ad92d0e705d5..fd7f669f6ca3 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeframeType.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/TimeframeType.cs @@ -28,6 +28,7 @@ public TimeframeType(string value) private const string TheLastBillingMonthValue = "TheLastBillingMonth"; private const string WeekToDateValue = "WeekToDate"; private const string CustomValue = "Custom"; + private const string TheCurrentMonthValue = "TheCurrentMonth"; /// MonthToDate. public static TimeframeType MonthToDate { get; } = new TimeframeType(MonthToDateValue); @@ -41,6 +42,8 @@ public TimeframeType(string value) public static TimeframeType WeekToDate { get; } = new TimeframeType(WeekToDateValue); /// Custom. public static TimeframeType Custom { get; } = new TimeframeType(CustomValue); + /// TheCurrentMonth. + public static TimeframeType TheCurrentMonth { get; } = new TimeframeType(TheCurrentMonthValue); /// Determines if two values are the same. public static bool operator ==(TimeframeType left, TimeframeType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownSetting.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownSetting.Serialization.cs new file mode 100644 index 000000000000..29a8df1b3cb2 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownSetting.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement.Models +{ + internal partial class UnknownSetting : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SettingData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + SettingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SettingData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSettingData(document.RootElement, options); + } + + internal static UnknownSetting DeserializeUnknownSetting(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SettingsKind kind = "Unknown"; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new SettingsKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerCostManagementContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownSetting( + id, + name, + type, + systemData, + kind, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(SettingData)} does not support writing '{options.Format}' format."); + } + } + + SettingData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSettingData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SettingData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownSetting.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownSetting.cs new file mode 100644 index 000000000000..d0a6494a3200 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/UnknownSetting.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement.Models +{ + /// Unknown version of Setting. + internal partial class UnknownSetting : SettingData + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + /// Keeps track of any properties unknown to the library. + internal UnknownSetting(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SettingsKind kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, kind, serializedAdditionalRawData) + { + Kind = kind; + } + + /// Initializes a new instance of for deserialization. + internal UnknownSetting() + { + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs index 46edde6cee3a..30534a6241a4 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Models/ViewListResult.Serialization.cs @@ -44,7 +44,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs index b0c652e91be4..41c560bb5f19 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/AlertsRestOperations.cs @@ -32,7 +32,7 @@ public AlertsRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -65,7 +65,7 @@ internal HttpMessage CreateListRequest(string scope) } /// Lists the alerts for scope defined. - /// The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// The cancellation token to use. /// is null. public async Task> ListAsync(string scope, CancellationToken cancellationToken = default) @@ -89,7 +89,7 @@ public async Task> ListAsync(string scope, } /// Lists the alerts for scope defined. - /// The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// The cancellation token to use. /// is null. public Response List(string scope, CancellationToken cancellationToken = default) @@ -143,7 +143,7 @@ internal HttpMessage CreateGetRequest(string scope, string alertId) } /// Gets the alert for the scope by alert ID. - /// The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Alert ID. /// The cancellation token to use. /// or is null. @@ -171,7 +171,7 @@ public async Task> GetAsync(string scope, stri } /// Gets the alert for the scope by alert ID. - /// The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Alert ID. /// The cancellation token to use. /// or is null. @@ -233,7 +233,7 @@ internal HttpMessage CreateDismissRequest(string scope, string alertId, CostMana } /// Dismisses the specified alert. - /// The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Alert ID. /// Parameters supplied to the Dismiss Alert operation. /// The cancellation token to use. @@ -261,7 +261,7 @@ public async Task> DismissAsync(string scope, } /// Dismisses the specified alert. - /// The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Alert ID. /// Parameters supplied to the Dismiss Alert operation. /// The cancellation token to use. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitRecommendationsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitRecommendationsRestOperations.cs index adc852189543..846d597b1d06 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitRecommendationsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitRecommendationsRestOperations.cs @@ -32,7 +32,7 @@ public BenefitRecommendationsRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -43,6 +43,7 @@ internal RequestUriBuilder CreateListRequestUri(string billingScope, string filt uri.AppendPath("/", false); uri.AppendPath(billingScope, false); uri.AppendPath("/providers/Microsoft.CostManagement/benefitRecommendations", false); + uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -55,7 +56,6 @@ internal RequestUriBuilder CreateListRequestUri(string billingScope, string filt { uri.AppendQuery("$expand", expand, true); } - uri.AppendQuery("api-version", _apiVersion, true); return uri; } @@ -69,6 +69,7 @@ internal HttpMessage CreateListRequest(string billingScope, string filter, strin uri.AppendPath("/", false); uri.AppendPath(billingScope, false); uri.AppendPath("/providers/Microsoft.CostManagement/benefitRecommendations", false); + uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); @@ -81,7 +82,6 @@ internal HttpMessage CreateListRequest(string billingScope, string filter, strin { uri.AppendQuery("$expand", expand, true); } - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitUtilizationSummariesRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitUtilizationSummariesRestOperations.cs index fd9ae7c53da8..ae472e6a22a2 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitUtilizationSummariesRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BenefitUtilizationSummariesRestOperations.cs @@ -32,16 +32,18 @@ public BenefitUtilizationSummariesRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByBillingAccountIdRequestUri(string billingAccountId, GrainContent? grainParameter, string filter) + internal RequestUriBuilder CreateListByBillingProfileIdRequestUri(string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingProfiles/", false); + uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/benefitUtilizationSummaries", false); uri.AppendQuery("api-version", _apiVersion, true); if (grainParameter != null) @@ -55,15 +57,17 @@ internal RequestUriBuilder CreateListByBillingAccountIdRequestUri(string billing return uri; } - internal HttpMessage CreateListByBillingAccountIdRequest(string billingAccountId, GrainContent? grainParameter, string filter) + internal HttpMessage CreateListByBillingProfileIdRequest(string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingProfiles/", false); + uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/benefitUtilizationSummaries", false); uri.AppendQuery("api-version", _apiVersion, true); if (grainParameter != null) @@ -80,18 +84,20 @@ internal HttpMessage CreateListByBillingAccountIdRequest(string billingAccountId return message; } - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - /// Billing account ID. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// BillingAccount ID. + /// Billing Profile ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListByBillingAccountIdAsync(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByBillingProfileIdAsync(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); + using var message = CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -107,18 +113,20 @@ public async Task> ListByBilling } } - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. - /// Billing account ID. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// BillingAccount ID. + /// Billing Profile ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListByBillingAccountId(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByBillingProfileId(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); + using var message = CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -134,14 +142,12 @@ public Response ListByBillingAccountId(st } } - internal RequestUriBuilder CreateListByBillingProfileIdRequestUri(string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) + internal RequestUriBuilder CreateListByBillingAccountIdRequestUri(string billingAccountId, GrainContent? grainParameter, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/benefitUtilizationSummaries", false); uri.AppendQuery("api-version", _apiVersion, true); if (grainParameter != null) @@ -155,17 +161,15 @@ internal RequestUriBuilder CreateListByBillingProfileIdRequestUri(string billing return uri; } - internal HttpMessage CreateListByBillingProfileIdRequest(string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) + internal HttpMessage CreateListByBillingAccountIdRequest(string billingAccountId, GrainContent? grainParameter, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/benefitUtilizationSummaries", false); uri.AppendQuery("api-version", _apiVersion, true); if (grainParameter != null) @@ -182,20 +186,18 @@ internal HttpMessage CreateListByBillingProfileIdRequest(string billingAccountId return message; } - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - /// Billing account ID. - /// Billing profile ID. + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// BillingAccount ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByBillingProfileIdAsync(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByBillingAccountIdAsync(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); + using var message = CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -211,20 +213,18 @@ public async Task> ListByBilling } } - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. - /// Billing account ID. - /// Billing profile ID. + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// BillingAccount ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByBillingProfileId(string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByBillingAccountId(string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingProfileIdRequest(billingAccountId, billingProfileId, grainParameter, filter); + using var message = CreateListByBillingAccountIdRequest(billingAccountId, grainParameter, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -244,7 +244,7 @@ internal RequestUriBuilder CreateListBySavingsPlanOrderRequestUri(string savings { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); uri.AppendPath(savingsPlanOrderId, true); uri.AppendPath("/providers/Microsoft.CostManagement/benefitUtilizationSummaries", false); uri.AppendQuery("api-version", _apiVersion, true); @@ -266,7 +266,7 @@ internal HttpMessage CreateListBySavingsPlanOrderRequest(string savingsPlanOrder request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); uri.AppendPath(savingsPlanOrderId, true); uri.AppendPath("/providers/Microsoft.CostManagement/benefitUtilizationSummaries", false); uri.AppendQuery("api-version", _apiVersion, true); @@ -342,7 +342,7 @@ internal RequestUriBuilder CreateListBySavingsPlanIdRequestUri(string savingsPla { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); uri.AppendPath(savingsPlanOrderId, true); uri.AppendPath("/savingsPlans/", false); uri.AppendPath(savingsPlanId, true); @@ -366,7 +366,7 @@ internal HttpMessage CreateListBySavingsPlanIdRequest(string savingsPlanOrderId, request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); uri.AppendPath(savingsPlanOrderId, true); uri.AppendPath("/savingsPlans/", false); uri.AppendPath(savingsPlanId, true); @@ -444,7 +444,7 @@ public Response ListBySavingsPlanId(strin } } - internal RequestUriBuilder CreateListByBillingAccountIdNextPageRequestUri(string nextLink, string billingAccountId, GrainContent? grainParameter, string filter) + internal RequestUriBuilder CreateListByBillingProfileIdNextPageRequestUri(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -452,7 +452,7 @@ internal RequestUriBuilder CreateListByBillingAccountIdNextPageRequestUri(string return uri; } - internal HttpMessage CreateListByBillingAccountIdNextPageRequest(string nextLink, string billingAccountId, GrainContent? grainParameter, string filter) + internal HttpMessage CreateListByBillingProfileIdNextPageRequest(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -466,20 +466,22 @@ internal HttpMessage CreateListByBillingAccountIdNextPageRequest(string nextLink return message; } - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. /// The URL to the next page of results. - /// Billing account ID. + /// BillingAccount ID. + /// Billing Profile ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListByBillingAccountIdNextPageAsync(string nextLink, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByBillingProfileIdNextPageAsync(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); + using var message = CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -495,20 +497,22 @@ public async Task> ListByBilling } } - /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. /// The URL to the next page of results. - /// Billing account ID. + /// BillingAccount ID. + /// Billing Profile ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListByBillingAccountIdNextPage(string nextLink, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByBillingProfileIdNextPage(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); + using var message = CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -524,7 +528,7 @@ public Response ListByBillingAccountIdNex } } - internal RequestUriBuilder CreateListByBillingProfileIdNextPageRequestUri(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) + internal RequestUriBuilder CreateListByBillingAccountIdNextPageRequestUri(string nextLink, string billingAccountId, GrainContent? grainParameter, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -532,7 +536,7 @@ internal RequestUriBuilder CreateListByBillingProfileIdNextPageRequestUri(string return uri; } - internal HttpMessage CreateListByBillingProfileIdNextPageRequest(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter, string filter) + internal HttpMessage CreateListByBillingAccountIdNextPageRequest(string nextLink, string billingAccountId, GrainContent? grainParameter, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -546,22 +550,20 @@ internal HttpMessage CreateListByBillingProfileIdNextPageRequest(string nextLink return message; } - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. /// The URL to the next page of results. - /// Billing account ID. - /// Billing profile ID. + /// BillingAccount ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByBillingProfileIdNextPageAsync(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByBillingAccountIdNextPageAsync(string nextLink, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); + using var message = CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -577,22 +579,20 @@ public async Task> ListByBilling } } - /// Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + /// Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. /// The URL to the next page of results. - /// Billing account ID. - /// Billing profile ID. + /// BillingAccount ID. /// Grain. /// Supports filtering by properties/benefitId, properties/benefitOrderId and properties/usageDate. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByBillingProfileIdNextPage(string nextLink, string billingAccountId, string billingProfileId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByBillingAccountIdNextPage(string nextLink, string billingAccountId, GrainContent? grainParameter = null, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - using var message = CreateListByBillingProfileIdNextPageRequest(nextLink, billingAccountId, billingProfileId, grainParameter, filter); + using var message = CreateListByBillingAccountIdNextPageRequest(nextLink, billingAccountId, grainParameter, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs deleted file mode 100644 index af8acdb6a077..000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingAccountScopeRestOperations.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - internal partial class BillingAccountScopeRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of BillingAccountScopeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BillingAccountScopeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGenerateBenefitUtilizationSummariesReportRequestUri(string billingAccountId, BenefitUtilizationSummariesContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(string billingAccountId, BenefitUtilizationSummariesContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task GenerateBenefitUtilizationSummariesReportAsync(string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. - /// Billing account ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response GenerateBenefitUtilizationSummariesReport(string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs deleted file mode 100644 index 1ff4705ae7c5..000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BillingProfileScopeRestOperations.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - internal partial class BillingProfileScopeRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of BillingProfileScopeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BillingProfileScopeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGenerateBenefitUtilizationSummariesReportRequestUri(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountId, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountId, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task GenerateBenefitUtilizationSummariesReportAsync(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. - /// Billing account ID. - /// Billing profile ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response GenerateBenefitUtilizationSummariesReport(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(billingAccountId, billingProfileId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BudgetsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BudgetsRestOperations.cs new file mode 100644 index 000000000000..23e3f0bb82d7 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/BudgetsRestOperations.cs @@ -0,0 +1,457 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + internal partial class BudgetsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BudgetsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public BudgetsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string scope, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string scope, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all budgets for the defined scope. + /// The fully qualified Azure Resource manager identifier of the resource. + /// OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. + /// The cancellation token to use. + /// is null. + public async Task> ListAsync(string scope, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListRequest(scope, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BudgetsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = BudgetsListResult.DeserializeBudgetsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all budgets for the defined scope. + /// The fully qualified Azure Resource manager identifier of the resource. + /// OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. + /// The cancellation token to use. + /// is null. + public Response List(string scope, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListRequest(scope, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BudgetsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = BudgetsListResult.DeserializeBudgetsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string scope, string budgetName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets/", false); + uri.AppendPath(budgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string scope, string budgetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets/", false); + uri.AppendPath(budgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the budget for the scope by budget name. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Budget Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string scope, string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var message = CreateGetRequest(scope, budgetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BudgetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = BudgetData.DeserializeBudgetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BudgetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the budget for the scope by budget name. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Budget Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Get(string scope, string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var message = CreateGetRequest(scope, budgetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BudgetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = BudgetData.DeserializeBudgetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BudgetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string scope, string budgetName, BudgetData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets/", false); + uri.AppendPath(budgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string scope, string budgetName, BudgetData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets/", false); + uri.AppendPath(budgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Budget Name. + /// Parameters supplied to the Create Budget operation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string scope, string budgetName, BudgetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(scope, budgetName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + BudgetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = BudgetData.DeserializeBudgetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain the latest eTag for a given budget, perform a get operation prior to your put operation. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Budget Name. + /// Parameters supplied to the Create Budget operation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string scope, string budgetName, BudgetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(scope, budgetName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + BudgetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = BudgetData.DeserializeBudgetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string scope, string budgetName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets/", false); + uri.AppendPath(budgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string scope, string budgetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/budgets/", false); + uri.AppendPath(budgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// The operation to delete a budget. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Budget Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string scope, string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var message = CreateDeleteRequest(scope, budgetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// The operation to delete a budget. + /// The fully qualified Azure Resource manager identifier of the resource. + /// Budget Name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response Delete(string scope, string budgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(budgetName, nameof(budgetName)); + + using var message = CreateDeleteRequest(scope, budgetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string scope, string filter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string scope, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all budgets for the defined scope. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource. + /// OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. + /// The cancellation token to use. + /// or is null. + public async Task> ListNextPageAsync(string nextLink, string scope, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListNextPageRequest(nextLink, scope, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BudgetsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = BudgetsListResult.DeserializeBudgetsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all budgets for the defined scope. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource. + /// OData filter option. May be used to filter budgets by properties/category. The filter supports 'eq' only. + /// The cancellation token to use. + /// or is null. + public Response ListNextPage(string nextLink, string scope, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListNextPageRequest(nextLink, scope, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BudgetsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = BudgetsListResult.DeserializeBudgetsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/CostAllocationRulesRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/CostAllocationRulesRestOperations.cs new file mode 100644 index 000000000000..a0aa5daf88bf --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/CostAllocationRulesRestOperations.cs @@ -0,0 +1,537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + internal partial class CostAllocationRulesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of CostAllocationRulesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public CostAllocationRulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string billingAccountId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string billingAccountId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of all cost allocation rules for a billing account or enterprise enrollment. + /// BillingAccount ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string billingAccountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + using var message = CreateListRequest(billingAccountId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostAllocationRuleList.DeserializeCostAllocationRuleList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of all cost allocation rules for a billing account or enterprise enrollment. + /// BillingAccount ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string billingAccountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + using var message = CreateListRequest(billingAccountId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostAllocationRuleList.DeserializeCostAllocationRuleList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string billingAccountId, string ruleName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string billingAccountId, string ruleName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string billingAccountId, string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var message = CreateGetRequest(billingAccountId, ruleName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleDefinitionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((CostAllocationRuleDefinitionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a cost allocation rule by rule name and billing account or enterprise enrollment. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string billingAccountId, string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var message = CreateGetRequest(billingAccountId, ruleName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleDefinitionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((CostAllocationRuleDefinitionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string billingAccountId, string ruleName, CostAllocationRuleDefinitionData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string billingAccountId, string ruleName, CostAllocationRuleDefinitionData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string billingAccountId, string ruleName, CostAllocationRuleDefinitionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(billingAccountId, ruleName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + CostAllocationRuleDefinitionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create/Update a rule to allocate cost between different resources within a billing account or enterprise enrollment. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string billingAccountId, string ruleName, CostAllocationRuleDefinitionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(billingAccountId, ruleName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + CostAllocationRuleDefinitionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostAllocationRuleDefinitionData.DeserializeCostAllocationRuleDefinitionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string billingAccountId, string ruleName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string billingAccountId, string ruleName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete cost allocation rule for billing account or enterprise enrollment. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string billingAccountId, string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var message = CreateDeleteRequest(billingAccountId, ruleName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete cost allocation rule for billing account or enterprise enrollment. + /// BillingAccount ID. + /// Cost allocation rule name. The name cannot include spaces or any non alphanumeric characters other than '_' and '-'. The max length is 260 characters. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Delete(string billingAccountId, string ruleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + + using var message = CreateDeleteRequest(billingAccountId, ruleName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string billingAccountId, CostAllocationRuleCheckNameAvailabilityContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCheckNameAvailabilityRequest(string billingAccountId, CostAllocationRuleCheckNameAvailabilityContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/costAllocationRules/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Checks availability and correctness of a name for a cost allocation rule. + /// BillingAccount ID. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CheckNameAvailabilityAsync(string billingAccountId, CostAllocationRuleCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(billingAccountId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleCheckNameAvailabilityResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostAllocationRuleCheckNameAvailabilityResponse.DeserializeCostAllocationRuleCheckNameAvailabilityResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks availability and correctness of a name for a cost allocation rule. + /// BillingAccount ID. + /// Cost allocation rule to be created or updated. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CheckNameAvailability(string billingAccountId, CostAllocationRuleCheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(billingAccountId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleCheckNameAvailabilityResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostAllocationRuleCheckNameAvailabilityResponse.DeserializeCostAllocationRuleCheckNameAvailabilityResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string billingAccountId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string billingAccountId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the list of all cost allocation rules for a billing account or enterprise enrollment. + /// The URL to the next page of results. + /// BillingAccount ID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string billingAccountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + using var message = CreateListNextPageRequest(nextLink, billingAccountId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostAllocationRuleList.DeserializeCostAllocationRuleList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the list of all cost allocation rules for a billing account or enterprise enrollment. + /// The URL to the next page of results. + /// BillingAccount ID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string billingAccountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + + using var message = CreateListNextPageRequest(nextLink, billingAccountId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostAllocationRuleList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostAllocationRuleList.DeserializeCostAllocationRuleList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/DimensionsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/DimensionsRestOperations.cs index 0eecac7af418..017a4e2f5d83 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/DimensionsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/DimensionsRestOperations.cs @@ -32,7 +32,7 @@ public DimensionsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -279,5 +279,177 @@ public Response ByExternalCloudProviderType( throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string scope, string filter, string expand, string skiptoken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string scope, string filter, string expand, string skiptoken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the dimensions by the defined scope. + /// The URL to the next page of results. + /// The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// 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. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. + /// or is null. + public async Task> ListNextPageAsync(string nextLink, string scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListNextPageRequest(nextLink, scope, filter, expand, skiptoken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostManagementDimensionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostManagementDimensionsListResult.DeserializeCostManagementDimensionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue((CostManagementDimensionsListResult)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the dimensions by the defined scope. + /// The URL to the next page of results. + /// The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// 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. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. + /// or is null. + public Response ListNextPage(string nextLink, string scope, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListNextPageRequest(nextLink, scope, filter, expand, skiptoken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostManagementDimensionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostManagementDimensionsListResult.DeserializeCostManagementDimensionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue((CostManagementDimensionsListResult)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateByExternalCloudProviderTypeNextPageRequestUri(string nextLink, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, string filter, string expand, string skiptoken, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateByExternalCloudProviderTypeNextPageRequest(string nextLink, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, string filter, string expand, string skiptoken, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the dimensions by the external cloud provider type. + /// The URL to the next page of results. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// 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. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ByExternalCloudProviderTypeNextPageAsync(string nextLink, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + + using var message = CreateByExternalCloudProviderTypeNextPageRequest(nextLink, externalCloudProviderType, externalCloudProviderId, filter, expand, skiptoken, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostManagementDimensionsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostManagementDimensionsListResult.DeserializeCostManagementDimensionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the dimensions by the external cloud provider type. + /// The URL to the next page of results. + /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. + /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. + /// May be used to filter dimensions by properties/category, properties/usageStart, properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. + /// May be used to expand the properties/data within a dimension category. By default, data is not included when listing dimensions. + /// 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. + /// May be used to limit the number of results to the most recent N dimension data. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ByExternalCloudProviderTypeNextPage(string nextLink, ExternalCloudProviderType externalCloudProviderType, string externalCloudProviderId, string filter = null, string expand = null, string skiptoken = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(externalCloudProviderId, nameof(externalCloudProviderId)); + + using var message = CreateByExternalCloudProviderTypeNextPageRequest(nextLink, externalCloudProviderType, externalCloudProviderId, filter, expand, skiptoken, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostManagementDimensionsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostManagementDimensionsListResult.DeserializeCostManagementDimensionsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs index dbb00797c060..cd07d249350b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ExportsRestOperations.cs @@ -32,7 +32,7 @@ public ExportsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,7 +73,7 @@ internal HttpMessage CreateListRequest(string scope, string expand) } /// The operation to list all exports at the given scope. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last run of each export. /// The cancellation token to use. /// is null. @@ -98,7 +98,7 @@ public async Task> ListAsync(string scope, string exp } /// The operation to list all exports at the given scope. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last run of each export. /// The cancellation token to use. /// is null. @@ -161,7 +161,7 @@ internal HttpMessage CreateGetRequest(string scope, string exportName, string ex } /// The operation to get the export for the defined scope by export name. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. @@ -191,7 +191,7 @@ public async Task> GetAsync(string scope, str } /// The operation to get the export for the defined scope by export name. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// May be used to expand the properties within an export. Currently only 'runHistory' is supported and will return information for the last 10 runs of the export. /// The cancellation token to use. @@ -255,7 +255,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string scope, string exportName } /// The operation to create or update a export. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// Parameters supplied to the CreateOrUpdate Export operation. /// The cancellation token to use. @@ -285,7 +285,7 @@ public async Task> CreateOrUpdateAsync(string } /// The operation to create or update a export. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// Parameters supplied to the CreateOrUpdate Export operation. /// The cancellation token to use. @@ -345,7 +345,7 @@ internal HttpMessage CreateDeleteRequest(string scope, string exportName) } /// The operation to delete a export. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// The cancellation token to use. /// or is null. @@ -367,7 +367,7 @@ public async Task DeleteAsync(string scope, string exportName, Cancell } /// The operation to delete a export. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// The cancellation token to use. /// or is null. @@ -388,7 +388,7 @@ public Response Delete(string scope, string exportName, CancellationToken cancel } } - internal RequestUriBuilder CreateExecuteRequestUri(string scope, string exportName) + internal RequestUriBuilder CreateExecuteRequestUri(string scope, string exportName, ExportRunContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -401,7 +401,7 @@ internal RequestUriBuilder CreateExecuteRequestUri(string scope, string exportNa return uri; } - internal HttpMessage CreateExecuteRequest(string scope, string exportName) + internal HttpMessage CreateExecuteRequest(string scope, string exportName, ExportRunContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -416,22 +416,30 @@ internal HttpMessage CreateExecuteRequest(string scope, string exportName) uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + if (content != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + } _userAgent.Apply(message); return message; } /// The operation to run an export. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. + /// Parameters supplied to the Execute Export operation. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task ExecuteAsync(string scope, string exportName, CancellationToken cancellationToken = default) + public async Task ExecuteAsync(string scope, string exportName, ExportRunContent content = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(exportName, nameof(exportName)); - using var message = CreateExecuteRequest(scope, exportName); + using var message = CreateExecuteRequest(scope, exportName, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -443,17 +451,18 @@ public async Task ExecuteAsync(string scope, string exportName, Cancel } /// The operation to run an export. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. + /// Parameters supplied to the Execute Export operation. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public Response Execute(string scope, string exportName, CancellationToken cancellationToken = default) + public Response Execute(string scope, string exportName, ExportRunContent content = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(exportName, nameof(exportName)); - using var message = CreateExecuteRequest(scope, exportName); + using var message = CreateExecuteRequest(scope, exportName, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -497,7 +506,7 @@ internal HttpMessage CreateGetExecutionHistoryRequest(string scope, string expor } /// The operation to get the run history of an export for the defined scope and export name. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// The cancellation token to use. /// or is null. @@ -524,7 +533,7 @@ public async Task> GetExecutionHistoryAsync( } /// The operation to get the run history of an export for the defined scope and export name. - /// The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' for invoiceSection scope, and '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for partners. + /// The fully qualified Azure Resource manager identifier of the resource. /// Export Name. /// The cancellation token to use. /// or is null. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs index dde47718f193..e224d06209d4 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ForecastRestOperations.cs @@ -32,7 +32,7 @@ public ForecastRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -43,11 +43,11 @@ internal RequestUriBuilder CreateUsageRequestUri(string scope, ForecastDefinitio uri.AppendPath("/", false); uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/forecast", false); + uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", _apiVersion, true); return uri; } @@ -61,11 +61,11 @@ internal HttpMessage CreateUsageRequest(string scope, ForecastDefinition forecas uri.AppendPath("/", false); uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/forecast", false); + uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -143,11 +143,11 @@ internal RequestUriBuilder CreateExternalCloudProviderUsageRequestUri(ExternalCl uri.AppendPath("/", false); uri.AppendPath(externalCloudProviderId, true); uri.AppendPath("/forecast", false); + uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", _apiVersion, true); return uri; } @@ -163,11 +163,11 @@ internal HttpMessage CreateExternalCloudProviderUsageRequest(ExternalCloudProvid uri.AppendPath("/", false); uri.AppendPath(externalCloudProviderId, true); uri.AppendPath("/forecast", false); + uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -181,7 +181,7 @@ internal HttpMessage CreateExternalCloudProviderUsageRequest(ExternalCloudProvid /// Lists the forecast charges for external cloud provider type defined. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// The request body. /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. /// or is null. @@ -210,7 +210,7 @@ public async Task> ExternalCloudProviderUsageAsync(Exte /// Lists the forecast charges for external cloud provider type defined. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// The request body. /// May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. /// The cancellation token to use. /// or is null. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateBenefitUtilizationSummariesReportRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateBenefitUtilizationSummariesReportRestOperations.cs new file mode 100644 index 000000000000..4a283140cf08 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateBenefitUtilizationSummariesReportRestOperations.cs @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + internal partial class GenerateBenefitUtilizationSummariesReportRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GenerateBenefitUtilizationSummariesReportRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public GenerateBenefitUtilizationSummariesReportRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGenerateByBillingProfileRequestUri(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingProfiles/", false); + uri.AppendPath(billingProfileId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateByBillingProfileRequest(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingProfiles/", false); + uri.AppendPath(billingProfileId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// BillingAccount ID. + /// Billing Profile ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task GenerateByBillingProfileAsync(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByBillingProfileRequest(billingAccountId, billingProfileId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Triggers generation of a benefit utilization summaries report for the provided billing account and billing profile. + /// BillingAccount ID. + /// Billing Profile ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GenerateByBillingProfile(string billingAccountId, string billingProfileId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByBillingProfileRequest(billingAccountId, billingProfileId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateByBillingAccountRequestUri(string billingAccountId, BenefitUtilizationSummariesContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateByBillingAccountRequest(string billingAccountId, BenefitUtilizationSummariesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// BillingAccount ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task GenerateByBillingAccountAsync(string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByBillingAccountRequest(billingAccountId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Triggers generation of a benefit utilization summaries report for the provided billing account. This API supports only enrollment accounts. + /// BillingAccount ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GenerateByBillingAccount(string billingAccountId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByBillingAccountRequest(billingAccountId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateBySavingsPlanOrderIdRequestUri(string savingsPlanOrderId, BenefitUtilizationSummariesContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath(savingsPlanOrderId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateBySavingsPlanOrderIdRequest(string savingsPlanOrderId, BenefitUtilizationSummariesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath(savingsPlanOrderId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task GenerateBySavingsPlanOrderIdAsync(string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateBySavingsPlanOrderIdRequest(savingsPlanOrderId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. + /// Savings plan order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GenerateBySavingsPlanOrderId(string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateBySavingsPlanOrderIdRequest(savingsPlanOrderId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateBySavingsPlanIdRequestUri(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath(savingsPlanOrderId, true); + uri.AppendPath("/savingsPlans/", false); + uri.AppendPath(savingsPlanId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateBySavingsPlanIdRequest(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.BillingBenefits/savingsPlanOrders/", false); + uri.AppendPath(savingsPlanOrderId, true); + uri.AppendPath("/savingsPlans/", false); + uri.AppendPath(savingsPlanId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task GenerateBySavingsPlanIdAsync(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Triggers generation of a benefit utilization summaries report for the provided savings plan. + /// Savings plan order ID. + /// Savings plan ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GenerateBySavingsPlanId(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); + Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateBySavingsPlanIdRequest(savingsPlanOrderId, savingsPlanId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateByReservationOrderIdRequestUri(string reservationOrderId, BenefitUtilizationSummariesContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Capacity/reservationorders/", false); + uri.AppendPath(reservationOrderId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateByReservationOrderIdRequest(string reservationOrderId, BenefitUtilizationSummariesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Capacity/reservationorders/", false); + uri.AppendPath(reservationOrderId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task GenerateByReservationOrderIdAsync(string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByReservationOrderIdRequest(reservationOrderId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Triggers generation of a benefit utilization summaries report for the provided reservation order. + /// Reservation Order ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GenerateByReservationOrderId(string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByReservationOrderIdRequest(reservationOrderId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateByReservationIdRequestUri(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Capacity/reservationorders/", false); + uri.AppendPath(reservationOrderId, true); + uri.AppendPath("/reservations/", false); + uri.AppendPath(reservationId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateByReservationIdRequest(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Capacity/reservationorders/", false); + uri.AppendPath(reservationOrderId, true); + uri.AppendPath("/reservations/", false); + uri.AppendPath(reservationId, true); + uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task GenerateByReservationIdAsync(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByReservationIdRequest(reservationOrderId, reservationId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Triggers generation of a benefit utilization summaries report for the provided reservation. + /// Reservation Order ID. + /// Reservation ID. + /// Async Benefit Utilization Summary report to be created. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GenerateByReservationId(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); + Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateGenerateByReservationIdRequest(reservationOrderId, reservationId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateReservationDetailsReportRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateReservationDetailsReportRestOperations.cs index c919fc0e15ba..c8a203b1e75e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateReservationDetailsReportRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/GenerateReservationDetailsReportRestOperations.cs @@ -30,56 +30,62 @@ public GenerateReservationDetailsReportRestOperations(HttpPipeline pipeline, str { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateByBillingAccountIdRequestUri(string billingAccountId, string startDate, string endDate) + internal RequestUriBuilder CreateByBillingProfileIdRequestUri(string billingAccountId, string billingProfileId, string startDate, string endDate) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingProfiles/", false); + uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/generateReservationDetailsReport", false); + uri.AppendQuery("api-version", _apiVersion, true); uri.AppendQuery("startDate", startDate, true); uri.AppendQuery("endDate", endDate, true); - uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateByBillingAccountIdRequest(string billingAccountId, string startDate, string endDate) + internal HttpMessage CreateByBillingProfileIdRequest(string billingAccountId, string billingProfileId, string startDate, string endDate) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingProfiles/", false); + uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/generateReservationDetailsReport", false); + uri.AppendQuery("api-version", _apiVersion, true); uri.AppendQuery("startDate", startDate, true); uri.AppendQuery("endDate", endDate, true); - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. - /// Enrollment ID (Legacy BillingAccount ID). + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + /// BillingAccount ID. + /// Billing Profile ID. /// Start Date. /// End Date. /// The cancellation token to use. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public async Task ByBillingAccountIdAsync(string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// , , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task ByBillingProfileIdAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); Argument.AssertNotNull(startDate, nameof(startDate)); Argument.AssertNotNull(endDate, nameof(endDate)); - using var message = CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate); + using var message = CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -91,20 +97,22 @@ public async Task ByBillingAccountIdAsync(string billingAccountId, str } } - /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. - /// Enrollment ID (Legacy BillingAccount ID). + /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + /// BillingAccount ID. + /// Billing Profile ID. /// Start Date. /// End Date. /// The cancellation token to use. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public Response ByBillingAccountId(string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// , , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ByBillingProfileId(string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); Argument.AssertNotNull(startDate, nameof(startDate)); Argument.AssertNotNull(endDate, nameof(endDate)); - using var message = CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate); + using var message = CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -116,58 +124,52 @@ public Response ByBillingAccountId(string billingAccountId, string startDate, st } } - internal RequestUriBuilder CreateByBillingProfileIdRequestUri(string billingAccountId, string billingProfileId, string startDate, string endDate) + internal RequestUriBuilder CreateByBillingAccountIdRequestUri(string billingAccountId, string startDate, string endDate) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/generateReservationDetailsReport", false); + uri.AppendQuery("api-version", _apiVersion, true); uri.AppendQuery("startDate", startDate, true); uri.AppendQuery("endDate", endDate, true); - uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateByBillingProfileIdRequest(string billingAccountId, string billingProfileId, string startDate, string endDate) + internal HttpMessage CreateByBillingAccountIdRequest(string billingAccountId, string startDate, string endDate) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountId, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileId, true); uri.AppendPath("/providers/Microsoft.CostManagement/generateReservationDetailsReport", false); + uri.AppendQuery("api-version", _apiVersion, true); uri.AppendQuery("startDate", startDate, true); uri.AppendQuery("endDate", endDate, true); - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. - /// Billing account ID. - /// Billing profile ID. + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + /// BillingAccount ID. /// Start Date. /// End Date. /// The cancellation token to use. - /// , , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task ByBillingProfileIdAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task ByBillingAccountIdAsync(string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); Argument.AssertNotNull(startDate, nameof(startDate)); Argument.AssertNotNull(endDate, nameof(endDate)); - using var message = CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate); + using var message = CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -179,22 +181,20 @@ public async Task ByBillingProfileIdAsync(string billingAccountId, str } } - /// Generates the reservations details report for provided date range asynchronously by billing profile. The Reservation usage details can be viewed by only certain enterprise roles by default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. - /// Billing account ID. - /// Billing profile ID. + /// Generates the reservations details report for provided date range asynchronously based on enrollment id. The Reservation usage details can be viewed only by certain enterprise roles. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + /// BillingAccount ID. /// Start Date. /// End Date. /// The cancellation token to use. - /// , , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ByBillingProfileId(string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default) + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ByBillingAccountId(string billingAccountId, string startDate, string endDate, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); - Argument.AssertNotNullOrEmpty(billingProfileId, nameof(billingProfileId)); Argument.AssertNotNull(startDate, nameof(startDate)); Argument.AssertNotNull(endDate, nameof(endDate)); - using var message = CreateByBillingProfileIdRequest(billingAccountId, billingProfileId, startDate, endDate); + using var message = CreateByBillingAccountIdRequest(billingAccountId, startDate, endDate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/PriceSheetRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/PriceSheetRestOperations.cs index e0e0729e0fdf..4cf182783f11 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/PriceSheetRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/PriceSheetRestOperations.cs @@ -30,15 +30,125 @@ public PriceSheetRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateDownloadRequestUri(string billingAccountName, string billingProfileName, string invoiceName) + internal RequestUriBuilder CreateDownloadByBillingAccountRequestUri(string billingAccountId, string billingPeriodName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingPeriods/", false); + uri.AppendPath(billingPeriodName, true); + uri.AppendPath("/providers/Microsoft.CostManagement/pricesheets/default/download", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDownloadByBillingAccountRequest(string billingAccountId, string billingPeriodName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); + uri.AppendPath(billingAccountId, true); + uri.AppendPath("/billingPeriods/", false); + uri.AppendPath(billingPeriodName, true); + uri.AppendPath("/providers/Microsoft.CostManagement/pricesheets/default/download", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// + /// Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + /// + /// **Migrate to version 2025-03-01** + /// + /// You can use the 2025-03-01 API version with the new URI: + /// + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + /// + /// With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + /// + /// The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + /// + /// The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + /// + /// All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + /// + /// BillingAccount ID. + /// Billing Period Name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task DownloadByBillingAccountAsync(string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingPeriodName, nameof(billingPeriodName)); + + using var message = CreateDownloadByBillingAccountRequest(billingAccountId, billingPeriodName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// + /// Generates the pricesheet for the provided billing period asynchronously based on the Enrollment ID. This is for Enterprise Agreement customers. + /// + /// **Migrate to version 2025-03-01** + /// + /// You can use the 2025-03-01 API version with the new URI: + /// + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.CostManagement/pricesheets/default/download' + /// + /// With a new schema detailed below, the new version of the price sheet provides additional information and includes prices for Azure Reserved Instances (RI) for the current billing period. We recommend downloading an Azure Price Sheet for when entering a new billing period if you would maintain an ongoing record of past Azure Reserved Instance (RI) pricing. + /// + /// The EA Azure price sheet is available for billing periods in the past 13 months. To request a price sheet for a billing period older than 13 months, please contact support. + /// + /// The Azure price sheet download experience has been updated from a single .csv file to a zip file containing multiple .csv files, each with max size of 75MB. The 2023-11-01 version has been upgraded to use http POST method; details can be found below. + /// + /// All versions of the Microsoft.Consumption Azure Price Sheet - Download by Billing Account (including 2022-06-01, 2021-10-01, 2020-01-01-preview, 2019-10-01, 2019-05-01) are scheduled to be retired on 01 June 2026 and will no longer be supported after this date. + /// + /// BillingAccount ID. + /// Billing Period Name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response DownloadByBillingAccount(string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(billingAccountId, nameof(billingAccountId)); + Argument.AssertNotNullOrEmpty(billingPeriodName, nameof(billingPeriodName)); + + using var message = CreateDownloadByBillingAccountRequest(billingAccountId, billingPeriodName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDownloadByInvoiceRequestUri(string billingAccountName, string billingProfileName, string invoiceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountName, true); uri.AppendPath("/billingProfiles/", false); uri.AppendPath(billingProfileName, true); @@ -49,14 +159,14 @@ internal RequestUriBuilder CreateDownloadRequestUri(string billingAccountName, s return uri; } - internal HttpMessage CreateDownloadRequest(string billingAccountName, string billingProfileName, string invoiceName) + internal HttpMessage CreateDownloadByInvoiceRequest(string billingAccountName, string billingProfileName, string invoiceName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountName, true); uri.AppendPath("/billingProfiles/", false); uri.AppendPath(billingProfileName, true); @@ -71,19 +181,19 @@ internal HttpMessage CreateDownloadRequest(string billingAccountName, string bil } /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// BillingAccount ID. + /// Billing Profile Name. /// The ID that uniquely identifies an invoice. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DownloadAsync(string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + public async Task DownloadByInvoiceAsync(string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); - using var message = CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName); + using var message = CreateDownloadByInvoiceRequest(billingAccountName, billingProfileName, invoiceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -96,19 +206,19 @@ public async Task DownloadAsync(string billingAccountName, string bill } /// Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// BillingAccount ID. + /// Billing Profile Name. /// The ID that uniquely identifies an invoice. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Download(string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) + public Response DownloadByInvoice(string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); Argument.AssertNotNullOrEmpty(invoiceName, nameof(invoiceName)); - using var message = CreateDownloadRequest(billingAccountName, billingProfileName, invoiceName); + using var message = CreateDownloadByInvoiceRequest(billingAccountName, billingProfileName, invoiceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -124,7 +234,7 @@ internal RequestUriBuilder CreateDownloadByBillingProfileRequestUri(string billi { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountName, true); uri.AppendPath("/billingProfiles/", false); uri.AppendPath(billingProfileName, true); @@ -140,7 +250,7 @@ internal HttpMessage CreateDownloadByBillingProfileRequest(string billingAccount request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); + uri.AppendPath("/providers/microsoft.Billing/billingAccounts/", false); uri.AppendPath(billingAccountName, true); uri.AppendPath("/billingProfiles/", false); uri.AppendPath(billingProfileName, true); @@ -152,9 +262,15 @@ internal HttpMessage CreateDownloadByBillingProfileRequest(string billingAccount return message; } - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + /// + /// Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + /// + /// BillingAccount ID. + /// Billing Profile Name. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -175,9 +291,15 @@ public async Task DownloadByBillingProfileAsync(string billingAccountN } } - /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement.Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv file to a Zip file containing multiple csv files, each with max 200k records. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. + /// + /// Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// You can use the new 2023-09-01 API version for billing periods January 2023 onwards. Azure Reserved Instance (RI) pricing is only available through the new version of the API. + /// + /// Due to Azure product growth, the Azure price sheet download experience in this preview version will be updated from a single csv/json file to a Zip file containing multiple csv/json files, each with max size of 75MB. + /// + /// BillingAccount ID. + /// Billing Profile Name. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs index bdab94c2697f..18a0562baf74 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/QueryRestOperations.cs @@ -32,7 +32,7 @@ public QueryRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -163,7 +163,7 @@ internal HttpMessage CreateUsageByExternalCloudProviderTypeRequest(ExternalCloud /// Query the usage data for external cloud provider type defined. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The request body. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -191,7 +191,7 @@ public async Task> UsageByExternalCloudProviderTypeAsync(E /// Query the usage data for external cloud provider type defined. /// The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. /// This can be '{externalSubscriptionId}' for linked account or '{externalBillingAccountId}' for consolidated account used with dimension/query operations. - /// Parameters supplied to the CreateOrUpdate Query Config operation. + /// The request body. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs deleted file mode 100644 index 875a895aded8..000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationOrderScopeRestOperations.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - internal partial class ReservationOrderScopeRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ReservationOrderScopeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ReservationOrderScopeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGenerateBenefitUtilizationSummariesReportRequestUri(string reservationOrderId, BenefitUtilizationSummariesContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Capacity/reservationorders/", false); - uri.AppendPath(reservationOrderId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(string reservationOrderId, BenefitUtilizationSummariesContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Capacity/reservationorders/", false); - uri.AppendPath(reservationOrderId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task GenerateBenefitUtilizationSummariesReportAsync(string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Triggers generation of a benefit utilization summaries report for the provided reservation order. - /// Reservation Order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response GenerateBenefitUtilizationSummariesReport(string reservationOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs deleted file mode 100644 index 1aba34760547..000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ReservationScopeRestOperations.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - internal partial class ReservationScopeRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ReservationScopeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ReservationScopeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGenerateBenefitUtilizationSummariesReportRequestUri(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Capacity/reservationorders/", false); - uri.AppendPath(reservationOrderId, true); - uri.AppendPath("/reservations/", false); - uri.AppendPath(reservationId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Capacity/reservationorders/", false); - uri.AppendPath(reservationOrderId, true); - uri.AppendPath("/reservations/", false); - uri.AppendPath(reservationId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Triggers generation of a benefit utilization summaries report for the provided reservation. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task GenerateBenefitUtilizationSummariesReportAsync(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Triggers generation of a benefit utilization summaries report for the provided reservation. - /// Reservation Order ID. - /// Reservation ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response GenerateBenefitUtilizationSummariesReport(string reservationOrderId, string reservationId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId)); - Argument.AssertNotNullOrEmpty(reservationId, nameof(reservationId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(reservationOrderId, reservationId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs deleted file mode 100644 index 63175744950d..000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanOrderScopeRestOperations.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - internal partial class SavingsPlanOrderScopeRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of SavingsPlanOrderScopeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SavingsPlanOrderScopeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGenerateBenefitUtilizationSummariesReportRequestUri(string savingsPlanOrderId, BenefitUtilizationSummariesContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); - uri.AppendPath(savingsPlanOrderId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportRequest(string savingsPlanOrderId, BenefitUtilizationSummariesContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); - uri.AppendPath(savingsPlanOrderId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. - /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task GenerateBenefitUtilizationSummariesReportAsync(string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Triggers generation of a benefit utilization summaries report for the provided savings plan order. - /// Savings plan order ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response GenerateBenefitUtilizationSummariesReport(string savingsPlanOrderId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportRequest(savingsPlanOrderId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs deleted file mode 100644 index 45c66606c1c7..000000000000 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SavingsPlanScopeRestOperations.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.CostManagement.Models; - -namespace Azure.ResourceManager.CostManagement -{ - internal partial class SavingsPlanScopeRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of SavingsPlanScopeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SavingsPlanScopeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGenerateBenefitUtilizationSummariesReportAsyncRequestUri(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); - uri.AppendPath(savingsPlanOrderId, true); - uri.AppendPath("/savingsPlans/", false); - uri.AppendPath(savingsPlanId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.BillingBenefits/savingsPlanOrders/", false); - uri.AppendPath(savingsPlanOrderId, true); - uri.AppendPath("/savingsPlans/", false); - uri.AppendPath(savingsPlanId, true); - uri.AppendPath("/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. - /// Savings plan order ID. - /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task GenerateBenefitUtilizationSummariesReportAsyncAsync(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Triggers generation of a benefit utilization summaries report for the provided savings plan. - /// Savings plan order ID. - /// Savings plan ID. - /// Async Benefit Utilization Summary report to be created. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response GenerateBenefitUtilizationSummariesReportAsync(string savingsPlanOrderId, string savingsPlanId, BenefitUtilizationSummariesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(savingsPlanOrderId, nameof(savingsPlanOrderId)); - Argument.AssertNotNullOrEmpty(savingsPlanId, nameof(savingsPlanId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateBenefitUtilizationSummariesReportAsyncRequest(savingsPlanOrderId, savingsPlanId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs index 305fe02547ee..37237f1f5127 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ScheduledActionsRestOperations.cs @@ -32,64 +32,61 @@ public ScheduledActionsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByScopeRequestUri(string scope, string filter) + internal RequestUriBuilder CreateCheckNameAvailabilityByScopeRequestUri(string scope, CostManagementNameAvailabilityContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/", false); uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions", false); + uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } return uri; } - internal HttpMessage CreateListByScopeRequest(string scope, string filter) + internal HttpMessage CreateCheckNameAvailabilityByScopeRequest(string scope, CostManagementNameAvailabilityContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/", false); uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions", false); + uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; _userAgent.Apply(message); return message; } - /// List all shared scheduled actions within the given scope. + /// Checks availability and correctness of the name for a scheduled action within the given scope. /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. - /// May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. + /// Scheduled action to be created or updated. /// The cancellation token to use. - /// is null. - public async Task> ListByScopeAsync(string scope, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> CheckNameAvailabilityByScopeAsync(string scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByScopeRequest(scope, filter); + using var message = CreateCheckNameAvailabilityByScopeRequest(scope, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScheduledActionListResult value = default; + CostManagementNameAvailabilityResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduledActionListResult.DeserializeScheduledActionListResult(document.RootElement); + value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -97,24 +94,25 @@ public async Task> ListByScopeAsync(string s } } - /// List all shared scheduled actions within the given scope. + /// Checks availability and correctness of the name for a scheduled action within the given scope. /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. - /// May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. + /// Scheduled action to be created or updated. /// The cancellation token to use. - /// is null. - public Response ListByScope(string scope, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + public Response CheckNameAvailabilityByScope(string scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListByScopeRequest(scope, filter); + using var message = CreateCheckNameAvailabilityByScopeRequest(scope, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScheduledActionListResult value = default; + CostManagementNameAvailabilityResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduledActionListResult.DeserializeScheduledActionListResult(document.RootElement); + value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -122,62 +120,60 @@ public Response ListByScope(string scope, string filt } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string name, ScheduledActionData data, string ifMatch) + internal RequestUriBuilder CreateListByScopeRequestUri(string scope, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); - uri.AppendPath(name, true); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string name, ScheduledActionData data, string ifMatch) + internal HttpMessage CreateListByScopeRequest(string scope, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); - uri.AppendPath(name, true); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - if (ifMatch != null) + if (filter != null) { - request.Headers.Add("If-Match", ifMatch); + uri.AppendQuery("$filter", filter, true); } + request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Create or update a private scheduled action. - /// Scheduled action name. - /// Scheduled action to be created or updated. - /// ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. + /// List all shared scheduled actions within the given scope. + /// undefined. + /// May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string name, ScheduledActionData data, string ifMatch = null, CancellationToken cancellationToken = default) + /// is null. + public async Task> ListByScopeAsync(string scope, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(scope, nameof(scope)); - using var message = CreateCreateOrUpdateRequest(name, data, ifMatch); + using var message = CreateListByScopeRequest(scope, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - ScheduledActionData value = default; + ScheduledActionListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); + value = ScheduledActionListResult.DeserializeScheduledActionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -185,28 +181,24 @@ public async Task> CreateOrUpdateAsync(string name } } - /// Create or update a private scheduled action. - /// Scheduled action name. - /// Scheduled action to be created or updated. - /// ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. + /// List all shared scheduled actions within the given scope. + /// undefined. + /// May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string name, ScheduledActionData data, string ifMatch = null, CancellationToken cancellationToken = default) + /// is null. + public Response ListByScope(string scope, string filter = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(scope, nameof(scope)); - using var message = CreateCreateOrUpdateRequest(name, data, ifMatch); + using var message = CreateListByScopeRequest(scope, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - ScheduledActionData value = default; + ScheduledActionListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); + value = ScheduledActionListResult.DeserializeScheduledActionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -214,23 +206,27 @@ public Response CreateOrUpdate(string name, ScheduledAction } } - internal RequestUriBuilder CreateGetRequestUri(string name) + internal RequestUriBuilder CreateGetByScopeRequestUri(string scope, string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string name) + internal HttpMessage CreateGetByScopeRequest(string scope, string name) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -240,16 +236,18 @@ internal HttpMessage CreateGetRequest(string name) return message; } - /// Get the private scheduled action by name. + /// Get the shared scheduled action from the given scope by name. + /// undefined. /// Scheduled action name. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string name, CancellationToken cancellationToken = default) + public async Task> GetByScopeAsync(string scope, string name, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateGetRequest(name); + using var message = CreateGetByScopeRequest(scope, name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -267,16 +265,18 @@ public async Task> GetAsync(string name, Cancellat } } - /// Get the private scheduled action by name. + /// Get the shared scheduled action from the given scope by name. + /// undefined. /// Scheduled action name. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response Get(string name, CancellationToken cancellationToken = default) + public Response GetByScope(string scope, string name, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateGetRequest(name); + using var message = CreateGetByScopeRequest(scope, name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -294,74 +294,6 @@ public Response Get(string name, CancellationToken cancella } } - internal RequestUriBuilder CreateDeleteRequestUri(string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a private scheduled action. - /// Scheduled action name. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a private scheduled action. - /// Scheduled action name. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response Delete(string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateCreateOrUpdateByScopeRequestUri(string scope, string name, ScheduledActionData data, string ifMatch) { var uri = new RawRequestUriBuilder(); @@ -401,7 +333,7 @@ internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string nam } /// Create or update a shared scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// undefined. /// Scheduled action name. /// Scheduled action to be created or updated. /// ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. @@ -432,7 +364,7 @@ public async Task> CreateOrUpdateByScopeAsync(stri } /// Create or update a shared scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// undefined. /// Scheduled action name. /// Scheduled action to be created or updated. /// ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. @@ -462,7 +394,7 @@ public Response CreateOrUpdateByScope(string scope, string } } - internal RequestUriBuilder CreateGetByScopeRequestUri(string scope, string name) + internal RequestUriBuilder CreateDeleteByScopeRequestUri(string scope, string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -474,11 +406,11 @@ internal RequestUriBuilder CreateGetByScopeRequestUri(string scope, string name) return uri; } - internal HttpMessage CreateGetByScopeRequest(string scope, string name) + internal HttpMessage CreateDeleteByScopeRequest(string scope, string name) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/", false); @@ -492,65 +424,53 @@ internal HttpMessage CreateGetByScopeRequest(string scope, string name) return message; } - /// Get the shared scheduled action from the given scope by name. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// Delete a scheduled action within the given scope. + /// undefined. /// Scheduled action name. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> GetByScopeAsync(string scope, string name, CancellationToken cancellationToken = default) + public async Task DeleteByScopeAsync(string scope, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateGetByScopeRequest(scope, name); + using var message = CreateDeleteByScopeRequest(scope, name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ScheduledActionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ScheduledActionData)null, message.Response); + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Get the shared scheduled action from the given scope by name. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// Delete a scheduled action within the given scope. + /// undefined. /// Scheduled action name. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public Response GetByScope(string scope, string name, CancellationToken cancellationToken = default) + public Response DeleteByScope(string scope, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateGetByScopeRequest(scope, name); + using var message = CreateDeleteByScopeRequest(scope, name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ScheduledActionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ScheduledActionData)null, message.Response); + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteByScopeRequestUri(string scope, string name) + internal RequestUriBuilder CreateRunByScopeRequestUri(string scope, string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -558,21 +478,23 @@ internal RequestUriBuilder CreateDeleteByScopeRequestUri(string scope, string na uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); + uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteByScopeRequest(string scope, string name) + internal HttpMessage CreateRunByScopeRequest(string scope, string name) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/", false); uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); + uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -580,73 +502,145 @@ internal HttpMessage CreateDeleteByScopeRequest(string scope, string name) return message; } - /// Delete a scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// Runs a shared scheduled action within the given scope. + /// undefined. /// Scheduled action name. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task DeleteByScopeAsync(string scope, string name, CancellationToken cancellationToken = default) + public async Task RunByScopeAsync(string scope, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateDeleteByScopeRequest(scope, name); + using var message = CreateRunByScopeRequest(scope, name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Delete a scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// Runs a shared scheduled action within the given scope. + /// undefined. /// Scheduled action name. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public Response DeleteByScope(string scope, string name, CancellationToken cancellationToken = default) + public Response RunByScope(string scope, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateDeleteByScopeRequest(scope, name); + using var message = CreateRunByScopeRequest(scope, name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateRunRequestUri(string name) + internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(CostManagementNameAvailabilityContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCheckNameAvailabilityRequest(CostManagementNameAvailabilityContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Checks availability and correctness of the name for a scheduled action. + /// The request body. + /// The cancellation token to use. + /// is null. + public async Task> CheckNameAvailabilityAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CostManagementNameAvailabilityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks availability and correctness of the name for a scheduled action. + /// The request body. + /// The cancellation token to use. + /// is null. + public Response CheckNameAvailability(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CostManagementNameAvailabilityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); - uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateRunRequest(string name) + internal HttpMessage CreateGetRequest(string name) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); - uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -654,277 +648,283 @@ internal HttpMessage CreateRunRequest(string name) return message; } - /// Processes a private scheduled action. + /// Get the private scheduled action by name. /// Scheduled action name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - public async Task RunAsync(string name, CancellationToken cancellationToken = default) + public async Task> GetAsync(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateRunRequest(name); + using var message = CreateGetRequest(name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + { + ScheduledActionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ScheduledActionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Processes a private scheduled action. + /// Get the private scheduled action by name. /// Scheduled action name. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - public Response Run(string name, CancellationToken cancellationToken = default) + public Response Get(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateRunRequest(name); + using var message = CreateGetRequest(name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + { + ScheduledActionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ScheduledActionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateRunByScopeRequestUri(string scope, string name) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string name, ScheduledActionData data, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); - uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateRunByScopeRequest(string scope, string name) + internal HttpMessage CreateCreateOrUpdateRequest(string name, ScheduledActionData data, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); uri.AppendPath(name, true); - uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Runs a shared scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// Create or update a private scheduled action. /// Scheduled action name. + /// Scheduled action to be created or updated. + /// ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. /// The cancellation token to use. - /// or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task RunByScopeAsync(string scope, string name, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string name, ScheduledActionData data, string ifMatch = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateRunByScopeRequest(scope, name); + using var message = CreateCreateOrUpdateRequest(name, data, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + case 201: + { + ScheduledActionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Runs a shared scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// Create or update a private scheduled action. /// Scheduled action name. + /// Scheduled action to be created or updated. + /// ETag of the Entity. Not required when creating an entity. Optional when updating an entity and can be specified to achieve optimistic concurrency. /// The cancellation token to use. - /// or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response RunByScope(string scope, string name, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string name, ScheduledActionData data, string ifMatch = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateRunByScopeRequest(scope, name); + using var message = CreateCreateOrUpdateRequest(name, data, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + case 201: + { + ScheduledActionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ScheduledActionData.DeserializeScheduledActionData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(CostManagementNameAvailabilityContent content) + internal RequestUriBuilder CreateDeleteRequestUri(string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); + uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); + uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCheckNameAvailabilityRequest(CostManagementNameAvailabilityContent content) + internal HttpMessage CreateDeleteRequest(string name) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); + uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); + uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; _userAgent.Apply(message); return message; } - /// Checks availability and correctness of the name for a scheduled action. - /// Scheduled action to be created or updated. + /// Delete a private scheduled action. + /// Scheduled action name. /// The cancellation token to use. - /// is null. - public async Task> CheckNameAvailabilityAsync(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string name, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateCheckNameAvailabilityRequest(content); + using var message = CreateDeleteRequest(name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - CostManagementNameAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Checks availability and correctness of the name for a scheduled action. - /// Scheduled action to be created or updated. + /// Delete a private scheduled action. + /// Scheduled action name. /// The cancellation token to use. - /// is null. - public Response CheckNameAvailability(CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response Delete(string name, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateCheckNameAvailabilityRequest(content); + using var message = CreateDeleteRequest(name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - CostManagementNameAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCheckNameAvailabilityByScopeRequestUri(string scope, CostManagementNameAvailabilityContent content) + internal RequestUriBuilder CreateRunRequestUri(string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); + uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); + uri.AppendPath(name, true); + uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCheckNameAvailabilityByScopeRequest(string scope, CostManagementNameAvailabilityContent content) + internal HttpMessage CreateRunRequest(string name) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); - uri.AppendPath("/providers/Microsoft.CostManagement/checkNameAvailability", false); + uri.AppendPath("/providers/Microsoft.CostManagement/scheduledActions/", false); + uri.AppendPath(name, true); + uri.AppendPath("/execute", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; _userAgent.Apply(message); return message; } - /// Checks availability and correctness of the name for a scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. - /// Scheduled action to be created or updated. + /// Processes a private scheduled action. + /// Scheduled action name. /// The cancellation token to use. - /// or is null. - public async Task> CheckNameAvailabilityByScopeAsync(string scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task RunAsync(string name, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateCheckNameAvailabilityByScopeRequest(scope, content); + using var message = CreateRunRequest(name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - CostManagementNameAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Checks availability and correctness of the name for a scheduled action within the given scope. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. - /// Scheduled action to be created or updated. + /// Processes a private scheduled action. + /// Scheduled action name. /// The cancellation token to use. - /// or is null. - public Response CheckNameAvailabilityByScope(string scope, CostManagementNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response Run(string name, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateCheckNameAvailabilityByScopeRequest(scope, content); + using var message = CreateRunRequest(name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - CostManagementNameAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CostManagementNameAvailabilityResult.DeserializeCostManagementNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -954,7 +954,7 @@ internal HttpMessage CreateListByScopeNextPageRequest(string nextLink, string sc /// List all shared scheduled actions within the given scope. /// The URL to the next page of results. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// undefined. /// May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. /// The cancellation token to use. /// or is null. @@ -981,7 +981,7 @@ public async Task> ListByScopeNextPageAsync( /// List all shared scheduled actions within the given scope. /// The URL to the next page of results. - /// The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. Note: Insight Alerts are only available on subscription scope. + /// undefined. /// May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. /// The cancellation token to use. /// or is null. diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SettingsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SettingsRestOperations.cs new file mode 100644 index 000000000000..62818d8692da --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/SettingsRestOperations.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + internal partial class SettingsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SettingsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SettingsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string scope) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string scope) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all cost management settings in the requested scope. + /// undefined. + /// The cancellation token to use. + /// is null. + public async Task> ListAsync(string scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListRequest(scope); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SettingsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SettingsListResult.DeserializeSettingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all cost management settings in the requested scope. + /// undefined. + /// The cancellation token to use. + /// is null. + public Response List(string scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListRequest(scope); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SettingsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SettingsListResult.DeserializeSettingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetByScopeRequestUri(string scope, SettingType type) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings/", false); + uri.AppendPath(type.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetByScopeRequest(string scope, SettingType type) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings/", false); + uri.AppendPath(type.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the setting from the given scope by name. + /// undefined. + /// Setting type. + /// The cancellation token to use. + /// is null. + public async Task> GetByScopeAsync(string scope, SettingType type, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateGetByScopeRequest(scope, type); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SettingData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SettingData.DeserializeSettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SettingData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the setting from the given scope by name. + /// undefined. + /// Setting type. + /// The cancellation token to use. + /// is null. + public Response GetByScope(string scope, SettingType type, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateGetByScopeRequest(scope, type); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SettingData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SettingData.DeserializeSettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SettingData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateByScopeRequestUri(string scope, SettingType type, SettingData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings/", false); + uri.AppendPath(type.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, SettingType type, SettingData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings/", false); + uri.AppendPath(type.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a setting within the given scope. + /// undefined. + /// Setting type. + /// Setting to be created or updated. + /// The cancellation token to use. + /// or is null. + public async Task> CreateOrUpdateByScopeAsync(string scope, SettingType type, SettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateByScopeRequest(scope, type, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SettingData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SettingData.DeserializeSettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a setting within the given scope. + /// undefined. + /// Setting type. + /// Setting to be created or updated. + /// The cancellation token to use. + /// or is null. + public Response CreateOrUpdateByScope(string scope, SettingType type, SettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateByScopeRequest(scope, type, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SettingData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SettingData.DeserializeSettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteByScopeRequestUri(string scope, SettingType type) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings/", false); + uri.AppendPath(type.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteByScopeRequest(string scope, SettingType type) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.CostManagement/settings/", false); + uri.AppendPath(type.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a setting within the given scope. + /// undefined. + /// Setting type. + /// The cancellation token to use. + /// is null. + public async Task DeleteByScopeAsync(string scope, SettingType type, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateDeleteByScopeRequest(scope, type); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a setting within the given scope. + /// undefined. + /// Setting type. + /// The cancellation token to use. + /// is null. + public Response DeleteByScope(string scope, SettingType type, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateDeleteByScopeRequest(scope, type); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs index 4a5b0e740672..2441007f88f7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/RestOperations/ViewsRestOperations.cs @@ -32,7 +32,7 @@ public ViewsRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -65,7 +65,7 @@ internal HttpMessage CreateListByScopeRequest(string scope) } /// Lists all views at the given scope. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + /// undefined. /// The cancellation token to use. /// is null. public async Task> ListByScopeAsync(string scope, CancellationToken cancellationToken = default) @@ -89,7 +89,7 @@ public async Task> ListByScopeAsync(string scope, Cance } /// Lists all views at the given scope. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + /// undefined. /// The cancellation token to use. /// is null. public Response ListByScope(string scope, CancellationToken cancellationToken = default) @@ -112,23 +112,27 @@ public Response ListByScope(string scope, CancellationToken canc } } - internal RequestUriBuilder CreateGetRequestUri(string viewName) + internal RequestUriBuilder CreateGetByScopeRequestUri(string scope, string viewName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string viewName) + internal HttpMessage CreateGetByScopeRequest(string scope, string viewName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -138,16 +142,18 @@ internal HttpMessage CreateGetRequest(string viewName) return message; } - /// Gets the view by view name. + /// Gets the view for the defined scope by view name. + /// undefined. /// View name. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string viewName, CancellationToken cancellationToken = default) + public async Task> GetByScopeAsync(string scope, string viewName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateGetRequest(viewName); + using var message = CreateGetByScopeRequest(scope, viewName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -165,16 +171,18 @@ public async Task> GetAsync(string viewName, Ca } } - /// Gets the view by view name. + /// Gets the view for the defined scope by view name. + /// undefined. /// View name. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response Get(string viewName, CancellationToken cancellationToken = default) + public Response GetByScope(string scope, string viewName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateGetRequest(viewName); + using var message = CreateGetByScopeRequest(scope, viewName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -192,23 +200,27 @@ public Response Get(string viewName, CancellationToken c } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string viewName, CostManagementViewData data) + internal RequestUriBuilder CreateCreateOrUpdateByScopeRequestUri(string scope, string viewName, CostManagementViewData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string viewName, CostManagementViewData data) + internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string viewName, CostManagementViewData data) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -223,17 +235,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string viewName, CostManagement } /// The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + /// undefined. /// View name. /// Parameters supplied to the CreateOrUpdate View operation. /// The cancellation token to use. - /// or is null. + /// , or is null. /// is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateByScopeAsync(string scope, string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(viewName, data); + using var message = CreateCreateOrUpdateByScopeRequest(scope, viewName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -251,17 +265,19 @@ public async Task> CreateOrUpdateAsync(string v } /// The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + /// undefined. /// View name. /// Parameters supplied to the CreateOrUpdate View operation. /// The cancellation token to use. - /// or is null. + /// , or is null. /// is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdateByScope(string scope, string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(viewName, data); + using var message = CreateCreateOrUpdateByScopeRequest(scope, viewName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -278,23 +294,27 @@ public Response CreateOrUpdate(string viewName, CostMana } } - internal RequestUriBuilder CreateDeleteRequestUri(string viewName) + internal RequestUriBuilder CreateDeleteByScopeRequestUri(string scope, string viewName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string viewName) + internal HttpMessage CreateDeleteByScopeRequest(string scope, string viewName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -305,15 +325,17 @@ internal HttpMessage CreateDeleteRequest(string viewName) } /// The operation to delete a view. + /// undefined. /// View name. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string viewName, CancellationToken cancellationToken = default) + public async Task DeleteByScopeAsync(string scope, string viewName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateDeleteRequest(viewName); + using var message = CreateDeleteByScopeRequest(scope, viewName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -326,15 +348,17 @@ public async Task DeleteAsync(string viewName, CancellationToken cance } /// The operation to delete a view. + /// undefined. /// View name. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response Delete(string viewName, CancellationToken cancellationToken = default) + public Response DeleteByScope(string scope, string viewName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateDeleteRequest(viewName); + using var message = CreateDeleteByScopeRequest(scope, viewName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -346,27 +370,23 @@ public Response Delete(string viewName, CancellationToken cancellationToken = de } } - internal RequestUriBuilder CreateGetByScopeRequestUri(string scope, string viewName) + internal RequestUriBuilder CreateGetRequestUri(string viewName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetByScopeRequest(string scope, string viewName) + internal HttpMessage CreateGetRequest(string viewName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -376,18 +396,16 @@ internal HttpMessage CreateGetByScopeRequest(string scope, string viewName) return message; } - /// Gets the view for the defined scope by view name. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + /// Gets the view by view name. /// View name. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public async Task> GetByScopeAsync(string scope, string viewName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string viewName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateGetByScopeRequest(scope, viewName); + using var message = CreateGetRequest(viewName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -405,18 +423,16 @@ public async Task> GetByScopeAsync(string scope } } - /// Gets the view for the defined scope by view name. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + /// Gets the view by view name. /// View name. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public Response GetByScope(string scope, string viewName, CancellationToken cancellationToken = default) + public Response Get(string viewName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateGetByScopeRequest(scope, viewName); + using var message = CreateGetRequest(viewName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -434,27 +450,23 @@ public Response GetByScope(string scope, string viewName } } - internal RequestUriBuilder CreateCreateOrUpdateByScopeRequestUri(string scope, string viewName, CostManagementViewData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string viewName, CostManagementViewData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string viewName, CostManagementViewData data) + internal HttpMessage CreateCreateOrUpdateRequest(string viewName, CostManagementViewData data) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -469,19 +481,17 @@ internal HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string vie } /// The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. /// View name. /// Parameters supplied to the CreateOrUpdate View operation. /// The cancellation token to use. - /// , or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateByScopeAsync(string scope, string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateByScopeRequest(scope, viewName, data); + using var message = CreateCreateOrUpdateRequest(viewName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -499,19 +509,17 @@ public async Task> CreateOrUpdateByScopeAsync(s } /// The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. /// View name. /// Parameters supplied to the CreateOrUpdate View operation. /// The cancellation token to use. - /// , or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response CreateOrUpdateByScope(string scope, string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string viewName, CostManagementViewData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateByScopeRequest(scope, viewName, data); + using var message = CreateCreateOrUpdateRequest(viewName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -528,27 +536,23 @@ public Response CreateOrUpdateByScope(string scope, stri } } - internal RequestUriBuilder CreateDeleteByScopeRequestUri(string scope, string viewName) + internal RequestUriBuilder CreateDeleteRequestUri(string viewName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteByScopeRequest(string scope, string viewName) + internal HttpMessage CreateDeleteRequest(string viewName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/", false); - uri.AppendPath(scope, false); uri.AppendPath("/providers/Microsoft.CostManagement/views/", false); uri.AppendPath(viewName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -559,17 +563,15 @@ internal HttpMessage CreateDeleteByScopeRequest(string scope, string viewName) } /// The operation to delete a view. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. /// View name. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public async Task DeleteByScopeAsync(string scope, string viewName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string viewName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateDeleteByScopeRequest(scope, viewName); + using var message = CreateDeleteRequest(viewName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -582,17 +584,15 @@ public async Task DeleteByScopeAsync(string scope, string viewName, Ca } /// The operation to delete a view. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. /// View name. /// The cancellation token to use. - /// or is null. + /// is null. /// is an empty string, and was expected to be non-empty. - public Response DeleteByScope(string scope, string viewName, CancellationToken cancellationToken = default) + public Response Delete(string viewName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(scope, nameof(scope)); Argument.AssertNotNullOrEmpty(viewName, nameof(viewName)); - using var message = CreateDeleteByScopeRequest(scope, viewName); + using var message = CreateDeleteRequest(viewName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -628,7 +628,7 @@ internal HttpMessage CreateListByScopeNextPageRequest(string nextLink, string sc /// Lists all views at the given scope. /// The URL to the next page of results. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + /// undefined. /// The cancellation token to use. /// or is null. public async Task> ListByScopeNextPageAsync(string nextLink, string scope, CancellationToken cancellationToken = default) @@ -654,7 +654,7 @@ public async Task> ListByScopeNextPageAsync(string next /// Lists all views at the given scope. /// The URL to the next page of results. - /// The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. + /// undefined. /// The cancellation token to use. /// or is null. public Response ListByScopeNextPage(string nextLink, string scope, CancellationToken cancellationToken = default) diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs index 3f05e1315269..e03e23b5e18b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionCollection.cs @@ -54,7 +54,7 @@ internal ScheduledActionCollection(ArmClient client, ResourceIdentifier id) : ba /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -106,7 +106,7 @@ public virtual async Task> CreateOrUpdateA /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -158,7 +158,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -203,7 +203,7 @@ public virtual async Task> GetAsync(string nam /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -248,7 +248,7 @@ public virtual Response Get(string name, CancellationTo /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -279,7 +279,7 @@ public virtual AsyncPageable GetAllAsync(string filter /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -310,7 +310,7 @@ public virtual Pageable GetAll(string filter = null, Ca /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -353,7 +353,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -396,7 +396,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -441,7 +441,7 @@ public virtual async Task> GetIfExists /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.Serialization.cs index fb4a93ba1428..f5c53095e328 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.Serialization.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.Serialization.cs @@ -38,7 +38,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - if (options.Format != "W" && Optional.IsDefined(ETag)) + if (Optional.IsDefined(ETag)) { writer.WritePropertyName("eTag"u8); writer.WriteStringValue(ETag.Value.ToString()); @@ -260,6 +260,8 @@ internal static ScheduledActionData DeserializeScheduledActionData(JsonElement e name, type, systemData, + eTag, + kind, displayName, fileDestination, notification, @@ -268,8 +270,6 @@ internal static ScheduledActionData DeserializeScheduledActionData(JsonElement e scope, status, viewId, - eTag, - kind, serializedAdditionalRawData); } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs index b8ad91782a37..3110da3a36a8 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionData.cs @@ -61,19 +61,21 @@ public ScheduledActionData() /// The name. /// The resourceType. /// The systemData. + /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. + /// Kind of the scheduled action. /// Scheduled action name. /// Destination format of the view data. This is optional. /// Notification properties based on scheduled action kind. /// Email address of the point of contact that should get the unsubscribe requests and notification emails. /// Schedule of the scheduled action. - /// Cost Management scope like 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + /// For private scheduled action(Create or Update), scope will be empty.<br /> For shared scheduled action(Create or Update By Scope), Cost Management scope can be 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. /// Status of the scheduled action. /// Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. - /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. - /// Kind of the scheduled action. /// Keeps track of any properties unknown to the library. - internal ScheduledActionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, FileDestination fileDestination, NotificationProperties notification, string notificationEmail, ScheduleProperties schedule, ResourceIdentifier scope, ScheduledActionStatus? status, ResourceIdentifier viewId, ETag? eTag, ScheduledActionKind? kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ScheduledActionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, ScheduledActionKind? kind, string displayName, FileDestination fileDestination, NotificationProperties notification, string notificationEmail, ScheduleProperties schedule, ResourceIdentifier scope, ScheduledActionStatus? status, ResourceIdentifier viewId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + ETag = eTag; + Kind = kind; DisplayName = displayName; FileDestination = fileDestination; Notification = notification; @@ -82,11 +84,13 @@ internal ScheduledActionData(ResourceIdentifier id, string name, ResourceType re Scope = scope; Status = status; ViewId = viewId; - ETag = eTag; - Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. + public ETag? ETag { get; set; } + /// Kind of the scheduled action. + public ScheduledActionKind? Kind { get; set; } /// Scheduled action name. public string DisplayName { get; set; } /// Destination format of the view data. This is optional. @@ -108,15 +112,11 @@ public IList FileFormats public string NotificationEmail { get; set; } /// Schedule of the scheduled action. public ScheduleProperties Schedule { get; set; } - /// Cost Management scope like 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. + /// For private scheduled action(Create or Update), scope will be empty.<br /> For shared scheduled action(Create or Update By Scope), Cost Management scope can be 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. public ResourceIdentifier Scope { get; set; } /// Status of the scheduled action. public ScheduledActionStatus? Status { get; set; } /// Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. public ResourceIdentifier ViewId { get; set; } - /// Resource Etag. For update calls, eTag is optional and can be specified to achieve optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then including the latest eTag as part of the request body or 'If-Match' header while performing the update. For create calls, eTag is not required. - public ETag? ETag { get; } - /// Kind of the scheduled action. - public ScheduledActionKind? Kind { get; set; } } } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs index eee3a2c45228..c9c0bb8670e7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/ScheduledActionResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Cancellati /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -179,7 +179,7 @@ public virtual Response Get(CancellationToken cancellat /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -316,7 +316,7 @@ public virtual async Task> UpdateAsync(Wai /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -365,7 +365,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -403,7 +403,7 @@ public virtual async Task RunByScopeAsync(CancellationToken cancellati /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingCollection.cs new file mode 100644 index 000000000000..e269d860b588 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingCollection.cs @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSettings method from an instance of . + /// + public partial class SettingCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _settingClientDiagnostics; + private readonly SettingsRestOperations _settingRestClient; + + /// Initializes a new instance of the class for mocking. + protected SettingCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal SettingCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _settingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CostManagement", SettingResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SettingResource.ResourceType, out string settingApiVersion); + _settingRestClient = new SettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, settingApiVersion); + } + + /// + /// Create or update a setting within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_CreateOrUpdateByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Setting type. + /// Setting to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, SettingType type, SettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _settingRestClient.CreateOrUpdateByScopeAsync(Id, type, data, cancellationToken).ConfigureAwait(false); + var uri = _settingRestClient.CreateCreateOrUpdateByScopeRequestUri(Id, type, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new SettingResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a setting within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_CreateOrUpdateByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Setting type. + /// Setting to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, SettingType type, SettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _settingRestClient.CreateOrUpdateByScope(Id, type, data, cancellationToken); + var uri = _settingRestClient.CreateCreateOrUpdateByScopeRequestUri(Id, type, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new SettingResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the setting from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual async Task> GetAsync(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.Get"); + scope.Start(); + try + { + var response = await _settingRestClient.GetByScopeAsync(Id, type, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the setting from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual Response Get(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.Get"); + scope.Start(); + try + { + var response = _settingRestClient.GetByScope(Id, type, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all cost management settings in the requested scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings + /// + /// + /// Operation Id + /// Settings_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _settingRestClient.CreateListRequest(Id); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new SettingResource(Client, SettingData.DeserializeSettingData(e)), _settingClientDiagnostics, Pipeline, "SettingCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// List all cost management settings in the requested scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings + /// + /// + /// Operation Id + /// Settings_List + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _settingRestClient.CreateListRequest(Id); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new SettingResource(Client, SettingData.DeserializeSettingData(e)), _settingClientDiagnostics, Pipeline, "SettingCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.Exists"); + scope.Start(); + try + { + var response = await _settingRestClient.GetByScopeAsync(Id, type, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual Response Exists(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.Exists"); + scope.Start(); + try + { + var response = _settingRestClient.GetByScope(Id, type, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _settingRestClient.GetByScopeAsync(Id, type, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _settingRestClient.GetByScope(Id, type, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingData.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingData.Serialization.cs new file mode 100644 index 000000000000..cfd16282bde3 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingData.Serialization.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + [PersistableModelProxy(typeof(UnknownSetting))] + public partial class SettingData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SettingData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + } + + SettingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SettingData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSettingData(document.RootElement, options); + } + + internal static SettingData DeserializeSettingData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "taginheritance": return TagInheritanceSetting.DeserializeTagInheritanceSetting(element, options); + } + } + return UnknownSetting.DeserializeUnknownSetting(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerCostManagementContext.Default); + default: + throw new FormatException($"The model {nameof(SettingData)} does not support writing '{options.Format}' format."); + } + } + + SettingData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSettingData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SettingData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingData.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingData.cs new file mode 100644 index 000000000000..919bd2898c39 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingData.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A class representing the Setting data model. + /// Setting definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class SettingData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected SettingData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + /// Keeps track of any properties unknown to the library. + internal SettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SettingsKind kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + internal SettingsKind Kind { get; set; } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingResource.Serialization.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingResource.Serialization.cs new file mode 100644 index 000000000000..fff18ed977ac --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingResource.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + public partial class SettingResource : IJsonModel + { + private static UnknownSetting s_dataDeserializationInstance; + private static UnknownSetting DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SettingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerCostManagementContext.Default); + + SettingData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerCostManagementContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingResource.cs new file mode 100644 index 000000000000..cc2950af2773 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/SettingResource.cs @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CostManagement.Models; + +namespace Azure.ResourceManager.CostManagement +{ + /// + /// A Class representing a Setting along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSettingResource method. + /// Otherwise you can get one from its parent resource using the GetSetting method. + /// + public partial class SettingResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The scope. + /// The type. + public static ResourceIdentifier CreateResourceIdentifier(string scope, SettingType type) + { + var resourceId = $"{scope}/providers/Microsoft.CostManagement/settings/{type}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _settingClientDiagnostics; + private readonly SettingsRestOperations _settingRestClient; + private readonly SettingData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CostManagement/settings"; + + /// Initializes a new instance of the class for mocking. + protected SettingResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SettingResource(ArmClient client, SettingData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SettingResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _settingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CostManagement", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string settingApiVersion); + _settingRestClient = new SettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, settingApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SettingData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the setting from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual async Task> GetAsync(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingResource.Get"); + scope.Start(); + try + { + var response = await _settingRestClient.GetByScopeAsync(Id.Parent, type, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the setting from the given scope by name. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_GetByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Setting type. + /// The cancellation token to use. + public virtual Response Get(SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingResource.Get"); + scope.Start(); + try + { + var response = _settingRestClient.GetByScope(Id.Parent, type, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a setting within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_DeleteByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Setting type. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingResource.Delete"); + scope.Start(); + try + { + var response = await _settingRestClient.DeleteByScopeAsync(Id.Parent, type, cancellationToken).ConfigureAwait(false); + var uri = _settingRestClient.CreateDeleteByScopeRequestUri(Id.Parent, type); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a setting within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_DeleteByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Setting type. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, SettingType type, CancellationToken cancellationToken = default) + { + using var scope = _settingClientDiagnostics.CreateScope("SettingResource.Delete"); + scope.Start(); + try + { + var response = _settingRestClient.DeleteByScope(Id.Parent, type, cancellationToken); + var uri = _settingRestClient.CreateDeleteByScopeRequestUri(Id.Parent, type); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a setting within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_CreateOrUpdateByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Setting type. + /// Setting to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SettingType type, SettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _settingClientDiagnostics.CreateScope("SettingResource.Update"); + scope.Start(); + try + { + var response = await _settingRestClient.CreateOrUpdateByScopeAsync(Id.Parent, type, data, cancellationToken).ConfigureAwait(false); + var uri = _settingRestClient.CreateCreateOrUpdateByScopeRequestUri(Id.Parent, type, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new SettingResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a setting within the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.CostManagement/settings/{type} + /// + /// + /// Operation Id + /// Settings_CreateOrUpdateByScope + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Setting type. + /// Setting to be created or updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SettingType type, SettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _settingClientDiagnostics.CreateScope("SettingResource.Update"); + scope.Start(); + try + { + var response = _settingRestClient.CreateOrUpdateByScope(Id.Parent, type, data, cancellationToken); + var uri = _settingRestClient.CreateCreateOrUpdateByScopeRequestUri(Id.Parent, type, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CostManagementArmOperation(Response.FromValue(new SettingResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs index 7928b1d15aed..1dd0149f7cc7 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionCollection.cs @@ -62,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrU /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(stri /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string name, Cancella /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -299,7 +299,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -342,7 +342,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -387,7 +387,7 @@ public virtual async Task> GetIf /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs index 07a72b74c8c6..e7ff35c4d9fa 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantScheduledActionResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Canc /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -179,7 +179,7 @@ public virtual Response Get(CancellationToken can /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -316,7 +316,7 @@ public virtual async Task> UpdateAsy /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -365,7 +365,7 @@ public virtual ArmOperation Update(WaitUntil wait /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -403,7 +403,7 @@ public virtual async Task RunAsync(CancellationToken cancellationToken /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs index 8b39a90f023d..8eb66ea1fe3e 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsCollection.cs @@ -62,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Crea /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -164,7 +164,7 @@ public virtual ArmOperation CreateOrUpdate(W /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -209,7 +209,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -254,7 +254,7 @@ public virtual Response Get(string viewName, /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -297,7 +297,7 @@ public virtual async Task> ExistsAsync(string viewName, Cancellat /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -340,7 +340,7 @@ public virtual Response Exists(string viewName, CancellationToken cancella /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -385,7 +385,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs index 147385450671..8e4ec7d42d85 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/TenantsCostManagementViewsResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -179,7 +179,7 @@ public virtual Response Get(CancellationToke /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -267,7 +267,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource @@ -315,7 +315,7 @@ public virtual async Task> Upda /// /// /// Default Api Version - /// 2023-03-01 + /// 2025-03-01 /// /// /// Resource diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/autorest.md b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/autorest.md index 63ecceaf1b56..a143cbb68643 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/autorest.md +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: CostManagement namespace: Azure.ResourceManager.CostManagement -require: https://github.com/Azure/azure-rest-api-specs/blob/20e9229b38b94c8975386b75c652b75e6d691995/specification/cost-management/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/f61e11971b66e35d893c182e01cef00243e37e01/specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -22,6 +22,7 @@ sample-gen: skip-csproj: true modelerfour: flatten-payloads: false +# lenient-model-deduplication: true use-model-reader-writer: true # mgmt-debug: @@ -74,6 +75,14 @@ request-path-to-resource-name: override-operation-name: ScheduledActions_CheckNameAvailabilityByScope: CheckCostManagementNameAvailabilityByScopeScheduledAction ScheduledActions_CheckNameAvailability: CheckCostManagementNameAvailabilityByScheduledAction + PriceSheet_DownloadByInvoice: DownloadPriceSheet + GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanOrderId: GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope + GenerateBenefitUtilizationSummariesReport_GenerateByReservationId: GenerateBenefitUtilizationSummariesReportReservationScope + GenerateBenefitUtilizationSummariesReport_GenerateByReservationOrderId: GenerateBenefitUtilizationSummariesReportReservationOrderScope + GenerateBenefitUtilizationSummariesReport_GenerateByBillingProfile: GenerateBenefitUtilizationSummariesReportBillingProfileScope + GenerateBenefitUtilizationSummariesReport_GenerateByBillingAccount: GenerateBenefitUtilizationSummariesReportBillingAccountScope + GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanId: GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope + PriceSheet_DownloadByBillingProfile: DownloadPriceSheetByBillingProfile prepend-rp-prefix: - Alert @@ -144,16 +153,70 @@ directive: - remove-operation: GenerateDetailedCostReportOperationResults_Get - remove-operation: GenerateDetailedCostReportOperationStatus_Get - remove-operation: Operations_List +# - remove-operation: CostAllocationRules_CheckNameAvailability # Could not set ResourceTypeSegment for request path /{scope} - - from: scheduledActions.json - where: $.parameters.scopeParameter - transform: $['x-ms-skip-url-encoding'] = true; - - from: costmanagement.json - where: $.parameters.scopeViewParameter - transform: $['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/scheduledActions'].get + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}'].get + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}'].put + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}'].delete + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute'].post + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/checkNameAvailability'].post + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/views'].get + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/views/{viewName}'].get + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/views/{viewName}'].put + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/views/{viewName}'].delete + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/settings'].get + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/settings/{type}'].get + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/settings/{type}'].put + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; + - from: openapi.json + where: $.paths['/{scope}/providers/Microsoft.CostManagement/settings/{type}'].delete + transform: > + $['parameters'][1]['x-ms-skip-url-encoding'] = true; # Dup schema - - from: common-types.json + - from: openapi.json where: $.definitions.ErrorResponse transform: $['x-ms-client-name'] = 'OperationErrorResponse'; + - from: openapi.json + where: $.definitions + transform: delete $.SettingType; ``` diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_BudgetCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_BudgetCollection.cs new file mode 100644 index 000000000000..5b0faee3f60d --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_BudgetCollection.cs @@ -0,0 +1,1102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CostManagement.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.CostManagement.Samples +{ + public partial class Sample_BudgetCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateCostSubscriptionBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestBudget"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.Cost, + Amount = (float)100.65, + TimeGrain = TimeGrainType.Monthly, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2024-10-31T00:00:00Z"), + }, + Filter = new BudgetFilter + { + And = {new BudgetFilterProperties +{ +Dimensions = new BudgetComparisonExpression("ResourceId", BudgetOperatorType.In, new string[]{"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2", "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1"}), +}, new BudgetFilterProperties +{ +Tags = new BudgetComparisonExpression("category", BudgetOperatorType.In, new string[]{"Dev", "Prod"}), +}, new BudgetFilterProperties +{ +Tags = new BudgetComparisonExpression("department", BudgetOperatorType.In, new string[]{"engineering", "sales"}), +}}, + }, + Notifications = +{ +["Actual_GreaterThan_80_Percent"] = new Notification(true, BudgetNotificationOperatorType.GreaterThan, 80, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +ContactRoles = {"Contributor", "Reader"}, +ContactGroups = {"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup"}, +ThresholdType = ThresholdType.Actual, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationBillingAccountEAAlertRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last7Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter(), + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Weekly, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservationIdFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last7Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservationId", BudgetOperatorType.In, new string[] { "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Weekly, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservedResourceTypeFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last7Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservedResourceType", BudgetOperatorType.In, new string[] { "VirtualMachines", "SqlDatabases", "CosmosDb" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Weekly, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservationIdFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservationId", BudgetOperatorType.In, new string[] { "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservedResourceTypeFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservedResourceType", BudgetOperatorType.In, new string[] { "VirtualMachines", "SqlDatabases", "CosmosDb" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter(), + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservationIdFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservationId", BudgetOperatorType.In, new string[] { "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservedResourceTypeFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservedResourceType", BudgetOperatorType.In, new string[] { "VirtualMachines", "SqlDatabases", "CosmosDb" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateReservationUtilizationCustomerCSPAlertRuleJson() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter(), + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, budgetName, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetCostBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/Cost/Get-Cost-Budget.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestBudget"; + BudgetResource result = await collection.GetAsync(budgetName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetReservationUtilizationAlertRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + BudgetResource result = await collection.GetAsync(budgetName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_BillingAccountBudgetsListEA() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/EA/BillingAccountBudgetsList-EA.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_BillingAccountBudgetsListEACategoryTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/EA/BillingAccountBudgetsList-EA-CategoryTypeFilter.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + string filter = "properties/category eq 'ReservationUtilization'"; + await foreach (BudgetResource item in collection.GetAllAsync(filter: filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_BillingAccountBudgetsListMCA() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/BillingAccountBudgetsList-MCA.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_BillingAccountBudgetsListMCACategoryTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/BillingAccountBudgetsList-MCA-CategoryTypeFilter.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + string filter = "properties/category eq 'ReservationUtilization'"; + await foreach (BudgetResource item in collection.GetAllAsync(filter: filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_BillingProfileBudgetsListMCA() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/BillingProfileBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_BillingProfileBudgetsListMCACategoryTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/BillingProfileBudgetsList-CategoryTypeFilter.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + string filter = "properties/category eq 'ReservationUtilization'"; + await foreach (BudgetResource item in collection.GetAllAsync(filter: filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_CustomerBudgetsListMCACSP() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/CustomerBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_CustomerBudgetsListMCACSPCategoryTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/CustomerBudgetsList-CategoryTypeFilter.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + string filter = "properties/category eq 'ReservationUtilization'"; + await foreach (BudgetResource item in collection.GetAllAsync(filter: filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_DepartmentBudgetsListEA() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/EA/DepartmentBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456/departments/789101"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_EnrollmentAccountBudgetsListEA() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/EA/EnrollmentAccountBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456/enrollmentAccounts/473845"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_InvoiceSectionBudgetsListMCA() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/MCA/InvoiceSectionBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/MYDEVTESTBP/invoiceSections/AAAA-BBBB-CCC-DDD"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ManagementGroupBudgetsList() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/RBAC/ManagementGroupBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "Microsoft.Management/managementGroups/MYDEVTESTMG"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ResourceGroupBudgetsList() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/RBAC/ResourceGroupBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_SubscriptionBudgetsList() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/List/RBAC/SubscriptionBudgetsList.json + // this example is just showing the usage of "Budgets_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (BudgetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetCostBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/Cost/Get-Cost-Budget.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestBudget"; + bool result = await collection.ExistsAsync(budgetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetReservationUtilizationAlertRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + bool result = await collection.ExistsAsync(budgetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetCostBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/Cost/Get-Cost-Budget.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestBudget"; + NullableResponse response = await collection.GetIfExistsAsync(budgetName); + BudgetResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetReservationUtilizationAlertRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + BudgetCollection collection = client.GetBudgets(new ResourceIdentifier(scope)); + + // invoke the operation + string budgetName = "TestAlertRule"; + NullableResponse response = await collection.GetIfExistsAsync(budgetName); + BudgetResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_BudgetResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_BudgetResource.cs new file mode 100644 index 000000000000..0916bdb65d7a --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_BudgetResource.cs @@ -0,0 +1,625 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CostManagement.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.CostManagement.Samples +{ + public partial class Sample_BudgetResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetCostBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/Cost/Get-Cost-Budget.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string budgetName = "TestBudget"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetResource result = await budget.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetReservationUtilizationAlertRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Get/ReservationUtilization/Get-ReservationUtilization-AlertRule.json + // this example is just showing the usage of "Budgets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetResource result = await budget.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/Delete/DeleteBudget.json + // this example is just showing the usage of "Budgets_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string budgetName = "TestBudget"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + await budget.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateCostSubscriptionBudget() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/Cost/CreateOrUpdate-Cost-Subscription-Budget.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + string budgetName = "TestBudget"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.Cost, + Amount = (float)100.65, + TimeGrain = TimeGrainType.Monthly, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2024-10-31T00:00:00Z"), + }, + Filter = new BudgetFilter + { + And = {new BudgetFilterProperties +{ +Dimensions = new BudgetComparisonExpression("ResourceId", BudgetOperatorType.In, new string[]{"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/MSVM2", "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Compute/virtualMachines/platformcloudplatformGeneric1"}), +}, new BudgetFilterProperties +{ +Tags = new BudgetComparisonExpression("category", BudgetOperatorType.In, new string[]{"Dev", "Prod"}), +}, new BudgetFilterProperties +{ +Tags = new BudgetComparisonExpression("department", BudgetOperatorType.In, new string[]{"engineering", "sales"}), +}}, + }, + Notifications = +{ +["Actual_GreaterThan_80_Percent"] = new Notification(true, BudgetNotificationOperatorType.GreaterThan, 80, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +ContactRoles = {"Contributor", "Reader"}, +ContactGroups = {"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/microsoft.insights/actionGroups/SampleActionGroup"}, +ThresholdType = ThresholdType.Actual, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationBillingAccountEAAlertRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last7Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter(), + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Weekly, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservationIdFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservationIdFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last7Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservationId", BudgetOperatorType.In, new string[] { "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Weekly, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationBillingAccountEAAlertRuleReservedResourceTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/EA/BillingAccountEA-AlertRule-ReservedResourceTypeFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last7Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservedResourceType", BudgetOperatorType.In, new string[] { "VirtualMachines", "SqlDatabases", "CosmosDb" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Weekly, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservationIdFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservationIdFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservationId", BudgetOperatorType.In, new string[] { "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationBillingProfileMCAAlertRuleReservedResourceTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule-ReservedResourceTypeFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservedResourceType", BudgetOperatorType.In, new string[] { "VirtualMachines", "SqlDatabases", "CosmosDb" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationBillingProfileMCAAlertRuleJson() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/BillingProfile-AlertRule.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/billingProfiles/KKKK-LLLL-MMM-NNN"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter(), + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationCustomerCSPAlertRuleReservationIdFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservationIdFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservationId", BudgetOperatorType.In, new string[] { "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationCustomerCSPAlertRuleReservedResourceTypeFilter() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule-ReservedResourceTypeFilter.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter + { + Dimensions = new BudgetComparisonExpression("ReservedResourceType", BudgetOperatorType.In, new string[] { "VirtualMachines", "SqlDatabases", "CosmosDb" }), + }, + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateReservationUtilizationCustomerCSPAlertRuleJson() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/Budgets/CreateOrUpdate/ReservationUtilization/MCA/Customer-AlertRule.json + // this example is just showing the usage of "Budgets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BudgetResource created on azure + // for more information of creating BudgetResource, please refer to the document of BudgetResource + string scope = "providers/Microsoft.Billing/billingAccounts/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:ffffffff-gggg-hhhh-iiii-jjjjjjjjjjjj_2023-04-01/customers/000000-1111-2222-3333-444444444444"; + string budgetName = "TestAlertRule"; + ResourceIdentifier budgetResourceId = BudgetResource.CreateResourceIdentifier(scope, budgetName); + BudgetResource budget = client.GetBudgetResource(budgetResourceId); + + // invoke the operation + BudgetData data = new BudgetData + { + ETag = new ETag("\"1d34d016a593709\""), + Category = CategoryType.ReservationUtilization, + TimeGrain = TimeGrainType.Last30Days, + TimePeriod = new BudgetTimePeriod(DateTimeOffset.Parse("2023-04-01T00:00:00Z")) + { + EndOn = DateTimeOffset.Parse("2025-04-01T00:00:00Z"), + }, + Filter = new BudgetFilter(), + Notifications = +{ +["Actual_LessThan_99_Percent"] = new Notification(true, BudgetNotificationOperatorType.LessThan, 99, new string[]{"johndoe@contoso.com", "janesmith@contoso.com"}) +{ +Frequency = Frequency.Daily, +Locale = CultureCode.EnUs, +} +}, + }; + ArmOperation lro = await budget.UpdateAsync(WaitUntil.Completed, data); + BudgetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + BudgetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostAllocationRuleDefinitionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostAllocationRuleDefinitionCollection.cs new file mode 100644 index 000000000000..c1b20f00d98b --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostAllocationRuleDefinitionCollection.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.CostManagement.Samples +{ + public partial class Sample_CostAllocationRuleDefinitionCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CostAllocationRulesCreateResourceGroup() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleCreate.json + // this example is just showing the usage of "CostAllocationRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + CostAllocationRuleDefinitionCollection collection = tenantResource.GetCostAllocationRuleDefinitions(billingAccountId); + + // invoke the operation + string ruleName = "testRule"; + CostAllocationRuleDefinitionData data = new CostAllocationRuleDefinitionData + { + Properties = new CostAllocationRuleProperties(new CostAllocationRuleDetails + { + SourceResources = { new SourceCostAllocationResource(CostAllocationResourceType.Dimension, "ResourceGroupName", new string[] { "sampleRG", "secondRG" }) }, + TargetResources = {new TargetCostAllocationResource(CostAllocationResourceType.Dimension, "ResourceGroupName", new CostAllocationProportion[] +{ +new CostAllocationProportion("destinationRG", 45), +new CostAllocationProportion("destinationRG2", 54) +}, CostAllocationPolicyType.FixedProportion)}, + }, RuleStatus.Active) + { + Description = "This is a testRule", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, ruleName, data); + CostAllocationRuleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CostAllocationRulesCreateTag() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleCreateTag.json + // this example is just showing the usage of "CostAllocationRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + CostAllocationRuleDefinitionCollection collection = tenantResource.GetCostAllocationRuleDefinitions(billingAccountId); + + // invoke the operation + string ruleName = "testRule"; + CostAllocationRuleDefinitionData data = new CostAllocationRuleDefinitionData + { + Properties = new CostAllocationRuleProperties(new CostAllocationRuleDetails + { + SourceResources = { new SourceCostAllocationResource(CostAllocationResourceType.Tag, "category", new string[] { "devops" }) }, + TargetResources = {new TargetCostAllocationResource(CostAllocationResourceType.Dimension, "ResourceGroupName", new CostAllocationProportion[] +{ +new CostAllocationProportion("destinationRG", (float)33.33), +new CostAllocationProportion("destinationRG2", (float)33.33), +new CostAllocationProportion("destinationRG3", (float)33.34) +}, CostAllocationPolicyType.FixedProportion)}, + }, RuleStatus.Active) + { + Description = "This is a testRule", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, ruleName, data); + CostAllocationRuleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_CostAllocationRules() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleGet.json + // this example is just showing the usage of "CostAllocationRules_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + CostAllocationRuleDefinitionCollection collection = tenantResource.GetCostAllocationRuleDefinitions(billingAccountId); + + // invoke the operation + string ruleName = "testRule"; + CostAllocationRuleDefinitionResource result = await collection.GetAsync(ruleName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_CostAllocationRulesList() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRulesList.json + // this example is just showing the usage of "CostAllocationRules_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + CostAllocationRuleDefinitionCollection collection = tenantResource.GetCostAllocationRuleDefinitions(billingAccountId); + + // invoke the operation and iterate over the result + await foreach (CostAllocationRuleDefinitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_CostAllocationRules() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleGet.json + // this example is just showing the usage of "CostAllocationRules_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + CostAllocationRuleDefinitionCollection collection = tenantResource.GetCostAllocationRuleDefinitions(billingAccountId); + + // invoke the operation + string ruleName = "testRule"; + bool result = await collection.ExistsAsync(ruleName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_CostAllocationRules() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleGet.json + // this example is just showing the usage of "CostAllocationRules_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + CostAllocationRuleDefinitionCollection collection = tenantResource.GetCostAllocationRuleDefinitions(billingAccountId); + + // invoke the operation + string ruleName = "testRule"; + NullableResponse response = await collection.GetIfExistsAsync(ruleName); + CostAllocationRuleDefinitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostAllocationRuleDefinitionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostAllocationRuleDefinitionResource.cs new file mode 100644 index 000000000000..9746b304843b --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostAllocationRuleDefinitionResource.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CostManagement.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.CostManagement.Samples +{ + public partial class Sample_CostAllocationRuleDefinitionResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_CostAllocationRules() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleGet.json + // this example is just showing the usage of "CostAllocationRules_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostAllocationRuleDefinitionResource created on azure + // for more information of creating CostAllocationRuleDefinitionResource, please refer to the document of CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + string ruleName = "testRule"; + ResourceIdentifier costAllocationRuleDefinitionResourceId = CostAllocationRuleDefinitionResource.CreateResourceIdentifier(billingAccountId, ruleName); + CostAllocationRuleDefinitionResource costAllocationRuleDefinition = client.GetCostAllocationRuleDefinitionResource(costAllocationRuleDefinitionResourceId); + + // invoke the operation + CostAllocationRuleDefinitionResource result = await costAllocationRuleDefinition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteCostAllocationRule() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleDelete.json + // this example is just showing the usage of "CostAllocationRules_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostAllocationRuleDefinitionResource created on azure + // for more information of creating CostAllocationRuleDefinitionResource, please refer to the document of CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + string ruleName = "testRule"; + ResourceIdentifier costAllocationRuleDefinitionResourceId = CostAllocationRuleDefinitionResource.CreateResourceIdentifier(billingAccountId, ruleName); + CostAllocationRuleDefinitionResource costAllocationRuleDefinition = client.GetCostAllocationRuleDefinitionResource(costAllocationRuleDefinitionResourceId); + + // invoke the operation + await costAllocationRuleDefinition.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CostAllocationRulesCreateResourceGroup() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleCreate.json + // this example is just showing the usage of "CostAllocationRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostAllocationRuleDefinitionResource created on azure + // for more information of creating CostAllocationRuleDefinitionResource, please refer to the document of CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + string ruleName = "testRule"; + ResourceIdentifier costAllocationRuleDefinitionResourceId = CostAllocationRuleDefinitionResource.CreateResourceIdentifier(billingAccountId, ruleName); + CostAllocationRuleDefinitionResource costAllocationRuleDefinition = client.GetCostAllocationRuleDefinitionResource(costAllocationRuleDefinitionResourceId); + + // invoke the operation + CostAllocationRuleDefinitionData data = new CostAllocationRuleDefinitionData + { + Properties = new CostAllocationRuleProperties(new CostAllocationRuleDetails + { + SourceResources = { new SourceCostAllocationResource(CostAllocationResourceType.Dimension, "ResourceGroupName", new string[] { "sampleRG", "secondRG" }) }, + TargetResources = {new TargetCostAllocationResource(CostAllocationResourceType.Dimension, "ResourceGroupName", new CostAllocationProportion[] +{ +new CostAllocationProportion("destinationRG", 45), +new CostAllocationProportion("destinationRG2", 54) +}, CostAllocationPolicyType.FixedProportion)}, + }, RuleStatus.Active) + { + Description = "This is a testRule", + }, + }; + ArmOperation lro = await costAllocationRuleDefinition.UpdateAsync(WaitUntil.Completed, data); + CostAllocationRuleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CostAllocationRulesCreateTag() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleCreateTag.json + // this example is just showing the usage of "CostAllocationRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostAllocationRuleDefinitionResource created on azure + // for more information of creating CostAllocationRuleDefinitionResource, please refer to the document of CostAllocationRuleDefinitionResource + string billingAccountId = "100"; + string ruleName = "testRule"; + ResourceIdentifier costAllocationRuleDefinitionResourceId = CostAllocationRuleDefinitionResource.CreateResourceIdentifier(billingAccountId, ruleName); + CostAllocationRuleDefinitionResource costAllocationRuleDefinition = client.GetCostAllocationRuleDefinitionResource(costAllocationRuleDefinitionResourceId); + + // invoke the operation + CostAllocationRuleDefinitionData data = new CostAllocationRuleDefinitionData + { + Properties = new CostAllocationRuleProperties(new CostAllocationRuleDetails + { + SourceResources = { new SourceCostAllocationResource(CostAllocationResourceType.Tag, "category", new string[] { "devops" }) }, + TargetResources = {new TargetCostAllocationResource(CostAllocationResourceType.Dimension, "ResourceGroupName", new CostAllocationProportion[] +{ +new CostAllocationProportion("destinationRG", (float)33.33), +new CostAllocationProportion("destinationRG2", (float)33.33), +new CostAllocationProportion("destinationRG3", (float)33.34) +}, CostAllocationPolicyType.FixedProportion)}, + }, RuleStatus.Active) + { + Description = "This is a testRule", + }, + }; + ArmOperation lro = await costAllocationRuleDefinition.UpdateAsync(WaitUntil.Completed, data); + CostAllocationRuleDefinitionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostAllocationRuleDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertCollection.cs index 9c94e7ca736f..156da8361e26 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_CostManagementAlertCollection [Ignore("Only validating compilation of examples")] public async Task Get_SingleResourceGroupAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleResourceGroupAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleResourceGroupAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -46,7 +46,7 @@ public async Task Get_SingleResourceGroupAlerts() [Ignore("Only validating compilation of examples")] public async Task Get_SingleSubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleSubscriptionAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleSubscriptionAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -73,7 +73,7 @@ public async Task Get_SingleSubscriptionAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_BillingAccountAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BillingAccountAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task GetAll_BillingAccountAlerts() ArmClient client = new ArmClient(cred); // get the collection of this CostManagementAlertResource - string scope = "providers/Microsoft.Billing/billingAccounts/12345:6789"; + string scope = "providers/Microsoft.Billing/billingAccounts/12345-6789"; CostManagementAlertCollection collection = client.GetCostManagementAlerts(new ResourceIdentifier(scope)); // invoke the operation and iterate over the result @@ -102,7 +102,7 @@ public async Task GetAll_BillingAccountAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_BillingProfileAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingProfileAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BillingProfileAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -111,7 +111,7 @@ public async Task GetAll_BillingProfileAlerts() ArmClient client = new ArmClient(cred); // get the collection of this CostManagementAlertResource - string scope = "providers/Microsoft.Billing/billingAccounts/12345:6789/billingProfiles/13579"; + string scope = "providers/Microsoft.Billing/billingAccounts/12345-6789/billingProfiles/13579"; CostManagementAlertCollection collection = client.GetCostManagementAlerts(new ResourceIdentifier(scope)); // invoke the operation and iterate over the result @@ -131,7 +131,7 @@ public async Task GetAll_BillingProfileAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_DepartmentAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/DepartmentAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -160,7 +160,7 @@ public async Task GetAll_DepartmentAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_EnrollmentAccountAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/EnrollmentAccountAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -189,7 +189,7 @@ public async Task GetAll_EnrollmentAccountAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_InvoiceSectionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/InvoiceSectionAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/InvoiceSectionAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -218,7 +218,7 @@ public async Task GetAll_InvoiceSectionAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_ResourceGroupAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ResourceGroupAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ResourceGroupAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -247,7 +247,7 @@ public async Task GetAll_ResourceGroupAlerts() [Ignore("Only validating compilation of examples")] public async Task GetAll_SubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SubscriptionAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SubscriptionAlerts.json // this example is just showing the usage of "Alerts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -276,7 +276,7 @@ public async Task GetAll_SubscriptionAlerts() [Ignore("Only validating compilation of examples")] public async Task Exists_SingleResourceGroupAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleResourceGroupAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleResourceGroupAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -299,7 +299,7 @@ public async Task Exists_SingleResourceGroupAlerts() [Ignore("Only validating compilation of examples")] public async Task Exists_SingleSubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleSubscriptionAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleSubscriptionAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -322,7 +322,7 @@ public async Task Exists_SingleSubscriptionAlerts() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_SingleResourceGroupAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleResourceGroupAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleResourceGroupAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -357,7 +357,7 @@ public async Task GetIfExists_SingleResourceGroupAlerts() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_SingleSubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleSubscriptionAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleSubscriptionAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertResource.cs index 4a7317e069fa..dcb73518a278 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementAlertResource.cs @@ -20,7 +20,7 @@ public partial class Sample_CostManagementAlertResource [Ignore("Only validating compilation of examples")] public async Task Get_SingleResourceGroupAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleResourceGroupAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleResourceGroupAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -49,7 +49,7 @@ public async Task Get_SingleResourceGroupAlerts() [Ignore("Only validating compilation of examples")] public async Task Get_SingleSubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleSubscriptionAlert.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/SingleSubscriptionAlert.json // this example is just showing the usage of "Alerts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Get_SingleSubscriptionAlerts() [Ignore("Only validating compilation of examples")] public async Task Update_PatchResourceGroupAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DismissResourceGroupAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/DismissResourceGroupAlerts.json // this example is just showing the usage of "Alerts_Dismiss" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -111,7 +111,7 @@ public async Task Update_PatchResourceGroupAlerts() [Ignore("Only validating compilation of examples")] public async Task Update_PatchSubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DismissSubscriptionAlerts.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/DismissSubscriptionAlerts.json // this example is just showing the usage of "Alerts_Dismiss" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportCollection.cs index 40f8b3d48d15..819a12904e32 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportCollection.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; using NUnit.Framework; namespace Azure.ResourceManager.CostManagement.Samples @@ -20,7 +21,7 @@ public partial class Sample_CostManagementExportCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccount.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -36,9 +37,12 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccount() string exportName = "TestExport"; CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -47,16 +51,351 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccount() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, exportName, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccountCustom() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountCustom.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + CostManagementExportCollection collection = client.GetCostManagementExports(new ResourceIdentifier(scope)); + + // invoke the operation + string exportName = "TestExport"; + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ActualCost, TimeframeType.Custom) + { + TimePeriod = new ExportTimePeriod(DateTimeOffset.Parse("2025-04-03T00:00:00.000Z"), DateTimeOffset.Parse("2025-04-03T00:00:00.000Z")), + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Inactive, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, exportName, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccountMonthly() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountMonthly.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + CostManagementExportCollection collection = client.GetCostManagementExports(new ResourceIdentifier(scope)); + + // invoke the operation + string exportName = "TestExport"; + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ActualCost, TimeframeType.TheLastMonth) + { + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Monthly, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-05T00:00:00Z")) + { + To = DateTimeOffset.Parse("2030-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, exportName, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccountPricesheet() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountPricesheet.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + CostManagementExportCollection collection = client.GetCostManagementExports(new ResourceIdentifier(scope)); + + // invoke the operation + string exportName = "TestExport"; + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.PriceSheet, TimeframeType.TheCurrentMonth) + { + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, exportName, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccountReservationDetails() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountReservationDetails.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + CostManagementExportCollection collection = client.GetCostManagementExports(new ResourceIdentifier(scope)); + + // invoke the operation + string exportName = "TestExport"; + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ReservationDetails, TimeframeType.MonthToDate) + { + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-03-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, exportName, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccountReservationRecommendation() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountReservationRecommendation.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + CostManagementExportCollection collection = client.GetCostManagementExports(new ResourceIdentifier(scope)); + + // invoke the operation + string exportName = "TestExport"; + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ReservationRecommendations, TimeframeType.MonthToDate) + { + DataSet = new ExportDataset + { + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + Filters = {new FilterItems +{ +Name = FilterItemName.ReservationScope, +Value = "Single", +}, new FilterItems +{ +Name = FilterItemName.ResourceType, +Value = "VirtualMachines", +}, new FilterItems +{ +Name = FilterItemName.LookBackPeriod, +Value = "Last7Days", +}}, + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), }, }, }; @@ -74,7 +413,7 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ExportCreateOrUpdateByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByDepartment.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,9 +429,12 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByDepartment() string exportName = "TestExport"; CostManagementExportData data = new CostManagementExportData { - Format = ExportFormatType.Csv, + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Parquet, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -101,16 +443,23 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByDepartment() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Snappy, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -128,7 +477,7 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByDepartment() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ExportCreateOrUpdateByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -144,9 +493,12 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByEnrollmentAccount() string exportName = "TestExport"; CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -155,16 +507,23 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByEnrollmentAccount() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -182,7 +541,7 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ExportCreateOrUpdateByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByManagementGroup.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -198,9 +557,12 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByManagementGroup() string exportName = "TestExport"; CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -209,16 +571,23 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByManagementGroup() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -236,7 +605,7 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ExportCreateOrUpdateByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByResourceGroup.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -252,9 +621,12 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByResourceGroup() string exportName = "TestExport"; CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -263,16 +635,23 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByResourceGroup() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -290,7 +669,7 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ExportCreateOrUpdateBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateBySubscription.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -306,9 +685,12 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateBySubscription() string exportName = "TestExport"; CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -317,16 +699,86 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateBySubscription() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, exportName, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ExportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountReservationTransactions.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + CostManagementExportCollection collection = client.GetCostManagementExports(new ResourceIdentifier(scope)); + + // invoke the operation + string exportName = "TestExport"; + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ReservationTransactions, TimeframeType.MonthToDate) + { + DataSet = new ExportDataset + { + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), }, }, }; @@ -344,7 +796,7 @@ public async Task CreateOrUpdate_ExportCreateOrUpdateBySubscription() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByBillingAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -371,7 +823,7 @@ public async Task Get_ExportGetByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByDepartment.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -398,7 +850,7 @@ public async Task Get_ExportGetByDepartment() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByEnrollmentAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -425,7 +877,7 @@ public async Task Get_ExportGetByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByManagementGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -452,7 +904,7 @@ public async Task Get_ExportGetByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByResourceGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -479,7 +931,7 @@ public async Task Get_ExportGetByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetBySubscription.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -506,7 +958,7 @@ public async Task Get_ExportGetBySubscription() [Ignore("Only validating compilation of examples")] public async Task GetAll_ExportsGetByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportsGetByBillingAccount.json // this example is just showing the usage of "Exports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -535,7 +987,7 @@ public async Task GetAll_ExportsGetByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task GetAll_ExportsGetByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportsGetByDepartment.json // this example is just showing the usage of "Exports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -564,7 +1016,7 @@ public async Task GetAll_ExportsGetByDepartment() [Ignore("Only validating compilation of examples")] public async Task GetAll_ExportsGetByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportsGetByEnrollmentAccount.json // this example is just showing the usage of "Exports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -593,7 +1045,7 @@ public async Task GetAll_ExportsGetByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task GetAll_ExportsGetByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportsGetByManagementGroup.json // this example is just showing the usage of "Exports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -622,7 +1074,7 @@ public async Task GetAll_ExportsGetByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task GetAll_ExportsGetByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportsGetByResourceGroup.json // this example is just showing the usage of "Exports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -651,7 +1103,7 @@ public async Task GetAll_ExportsGetByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task GetAll_ExportsGetBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportsGetBySubscription.json // this example is just showing the usage of "Exports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -680,7 +1132,7 @@ public async Task GetAll_ExportsGetBySubscription() [Ignore("Only validating compilation of examples")] public async Task Exists_ExportGetByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByBillingAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -703,7 +1155,7 @@ public async Task Exists_ExportGetByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task Exists_ExportGetByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByDepartment.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -726,7 +1178,7 @@ public async Task Exists_ExportGetByDepartment() [Ignore("Only validating compilation of examples")] public async Task Exists_ExportGetByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByEnrollmentAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -749,7 +1201,7 @@ public async Task Exists_ExportGetByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task Exists_ExportGetByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByManagementGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -772,7 +1224,7 @@ public async Task Exists_ExportGetByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_ExportGetByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByResourceGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -795,7 +1247,7 @@ public async Task Exists_ExportGetByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_ExportGetBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetBySubscription.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -818,7 +1270,7 @@ public async Task Exists_ExportGetBySubscription() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ExportGetByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByBillingAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -853,7 +1305,7 @@ public async Task GetIfExists_ExportGetByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ExportGetByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByDepartment.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -888,7 +1340,7 @@ public async Task GetIfExists_ExportGetByDepartment() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ExportGetByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByEnrollmentAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -923,7 +1375,7 @@ public async Task GetIfExists_ExportGetByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ExportGetByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByManagementGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -958,7 +1410,7 @@ public async Task GetIfExists_ExportGetByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ExportGetByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByResourceGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -993,7 +1445,7 @@ public async Task GetIfExists_ExportGetByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ExportGetBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetBySubscription.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportResource.cs index e397ddca67c3..52990766ee05 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementExportResource.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager.CostManagement.Models; +using Azure.ResourceManager.Models; using NUnit.Framework; namespace Azure.ResourceManager.CostManagement.Samples @@ -20,7 +21,7 @@ public partial class Sample_CostManagementExportResource [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByBillingAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -49,7 +50,7 @@ public async Task Get_ExportGetByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByDepartment.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +79,7 @@ public async Task Get_ExportGetByDepartment() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByEnrollmentAccount.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -107,7 +108,7 @@ public async Task Get_ExportGetByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByManagementGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +137,7 @@ public async Task Get_ExportGetByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetByResourceGroup.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -165,7 +166,7 @@ public async Task Get_ExportGetByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Get_ExportGetBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportGetBySubscription.json // this example is just showing the usage of "Exports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -194,7 +195,7 @@ public async Task Get_ExportGetBySubscription() [Ignore("Only validating compilation of examples")] public async Task Delete_ExportDeleteByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportDeleteByBillingAccount.json // this example is just showing the usage of "Exports_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -219,7 +220,7 @@ public async Task Delete_ExportDeleteByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task Delete_ExportDeleteByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportDeleteByDepartment.json // this example is just showing the usage of "Exports_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -244,7 +245,7 @@ public async Task Delete_ExportDeleteByDepartment() [Ignore("Only validating compilation of examples")] public async Task Delete_ExportDeleteByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportDeleteByEnrollmentAccount.json // this example is just showing the usage of "Exports_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -269,7 +270,7 @@ public async Task Delete_ExportDeleteByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task Delete_ExportDeleteByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportDeleteByManagementGroup.json // this example is just showing the usage of "Exports_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -294,7 +295,7 @@ public async Task Delete_ExportDeleteByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task Delete_ExportDeleteByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportDeleteByResourceGroup.json // this example is just showing the usage of "Exports_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -319,7 +320,7 @@ public async Task Delete_ExportDeleteByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Delete_ExportDeleteBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportDeleteBySubscription.json // this example is just showing the usage of "Exports_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -344,7 +345,7 @@ public async Task Delete_ExportDeleteBySubscription() [Ignore("Only validating compilation of examples")] public async Task Update_ExportCreateOrUpdateByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccount.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -362,9 +363,12 @@ public async Task Update_ExportCreateOrUpdateByBillingAccount() // invoke the operation CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -373,16 +377,361 @@ public async Task Update_ExportCreateOrUpdateByBillingAccount() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await costManagementExport.UpdateAsync(WaitUntil.Completed, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ExportCreateOrUpdateByBillingAccountCustom() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountCustom.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ActualCost, TimeframeType.Custom) + { + TimePeriod = new ExportTimePeriod(DateTimeOffset.Parse("2025-04-03T00:00:00.000Z"), DateTimeOffset.Parse("2025-04-03T00:00:00.000Z")), + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Inactive, + }, + }; + ArmOperation lro = await costManagementExport.UpdateAsync(WaitUntil.Completed, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ExportCreateOrUpdateByBillingAccountMonthly() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountMonthly.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ActualCost, TimeframeType.TheLastMonth) + { + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Monthly, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-05T00:00:00Z")) + { + To = DateTimeOffset.Parse("2030-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await costManagementExport.UpdateAsync(WaitUntil.Completed, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ExportCreateOrUpdateByBillingAccountPricesheet() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountPricesheet.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.PriceSheet, TimeframeType.TheCurrentMonth) + { + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await costManagementExport.UpdateAsync(WaitUntil.Completed, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ExportCreateOrUpdateByBillingAccountReservationDetails() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountReservationDetails.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ReservationDetails, TimeframeType.MonthToDate) + { + DataSet = new ExportDataset + { + Granularity = GranularityType.Daily, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-03-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await costManagementExport.UpdateAsync(WaitUntil.Completed, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ExportCreateOrUpdateByBillingAccountReservationRecommendation() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountReservationRecommendation.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ReservationRecommendations, TimeframeType.MonthToDate) + { + DataSet = new ExportDataset + { + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + Filters = {new FilterItems +{ +Name = FilterItemName.ReservationScope, +Value = "Single", +}, new FilterItems +{ +Name = FilterItemName.ResourceType, +Value = "VirtualMachines", +}, new FilterItems +{ +Name = FilterItemName.LookBackPeriod, +Value = "Last7Days", +}}, + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), }, }, }; @@ -400,7 +749,7 @@ public async Task Update_ExportCreateOrUpdateByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task Update_ExportCreateOrUpdateByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByDepartment.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -418,9 +767,12 @@ public async Task Update_ExportCreateOrUpdateByDepartment() // invoke the operation CostManagementExportData data = new CostManagementExportData { - Format = ExportFormatType.Csv, + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Parquet, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -429,16 +781,23 @@ public async Task Update_ExportCreateOrUpdateByDepartment() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Snappy, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -456,7 +815,7 @@ public async Task Update_ExportCreateOrUpdateByDepartment() [Ignore("Only validating compilation of examples")] public async Task Update_ExportCreateOrUpdateByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -474,9 +833,12 @@ public async Task Update_ExportCreateOrUpdateByEnrollmentAccount() // invoke the operation CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -485,16 +847,23 @@ public async Task Update_ExportCreateOrUpdateByEnrollmentAccount() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -512,7 +881,7 @@ public async Task Update_ExportCreateOrUpdateByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task Update_ExportCreateOrUpdateByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByManagementGroup.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -530,9 +899,12 @@ public async Task Update_ExportCreateOrUpdateByManagementGroup() // invoke the operation CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -541,16 +913,23 @@ public async Task Update_ExportCreateOrUpdateByManagementGroup() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -568,7 +947,7 @@ public async Task Update_ExportCreateOrUpdateByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task Update_ExportCreateOrUpdateByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByResourceGroup.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -586,9 +965,12 @@ public async Task Update_ExportCreateOrUpdateByResourceGroup() // invoke the operation CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -597,16 +979,23 @@ public async Task Update_ExportCreateOrUpdateByResourceGroup() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), }, }, }; @@ -624,7 +1013,7 @@ public async Task Update_ExportCreateOrUpdateByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Update_ExportCreateOrUpdateBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateBySubscription.json // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -642,9 +1031,12 @@ public async Task Update_ExportCreateOrUpdateBySubscription() // invoke the operation CostManagementExportData data = new CostManagementExportData { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), Format = ExportFormatType.Csv, DeliveryInfoDestination = new ExportDeliveryDestination("exports") { + DestinationType = DestinationType.AzureBlob, ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), RootFolderPath = "ad-hoc", }, @@ -653,16 +1045,88 @@ public async Task Update_ExportCreateOrUpdateBySubscription() DataSet = new ExportDataset { Granularity = GranularityType.Daily, - Columns = { "Date", "MeterId", "ResourceId", "ResourceLocation", "Quantity" }, + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, }, }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", Schedule = new ExportSchedule { Status = ExportScheduleStatusType.Active, - Recurrence = ExportScheduleRecurrenceType.Weekly, + Recurrence = ExportScheduleRecurrenceType.Daily, RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2020-06-01T00:00:00Z")) { - To = DateTimeOffset.Parse("2020-10-31T00:00:00Z"), + To = DateTimeOffset.Parse("2020-06-30T00:00:00Z"), + }, + }, + }; + ArmOperation lro = await costManagementExport.UpdateAsync(WaitUntil.Completed, data); + CostManagementExportResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementExportData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ExportCreateOrUpdateExportCreateOrUpdateByBillingAccountReservationTransactionsByBillingAccount() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportCreateOrUpdateByBillingAccountReservationTransactions.json + // this example is just showing the usage of "Exports_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + CostManagementExportData data = new CostManagementExportData + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + Location = new AzureLocation("centralus"), + Format = ExportFormatType.Csv, + DeliveryInfoDestination = new ExportDeliveryDestination("exports") + { + DestinationType = DestinationType.AzureBlob, + ResourceId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Storage/storageAccounts/ccmeastusdiag182"), + RootFolderPath = "ad-hoc", + }, + Definition = new ExportDefinition(ExportType.ReservationTransactions, TimeframeType.MonthToDate) + { + DataSet = new ExportDataset + { + Configuration = new ExportDatasetConfiguration + { + DataVersion = "2023-05-01", + }, + }, + }, + PartitionData = true, + DataOverwriteBehavior = DataOverwriteBehaviorType.OverwritePreviousReport, + CompressionMode = CompressionModeType.Gzip, + ExportDescription = "This is a test export.", + Schedule = new ExportSchedule + { + Status = ExportScheduleStatusType.Active, + Recurrence = ExportScheduleRecurrenceType.Daily, + RecurrencePeriod = new ExportRecurrencePeriod(DateTimeOffset.Parse("2023-06-01T00:00:00Z")) + { + To = DateTimeOffset.Parse("2023-06-30T00:00:00Z"), }, }, }; @@ -680,7 +1144,32 @@ public async Task Update_ExportCreateOrUpdateBySubscription() [Ignore("Only validating compilation of examples")] public async Task Execute_ExportRunByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunByBillingAccount.json + // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CostManagementExportResource created on azure + // for more information of creating CostManagementExportResource, please refer to the document of CostManagementExportResource + string scope = "providers/Microsoft.Billing/billingAccounts/123456"; + string exportName = "TestExport"; + ResourceIdentifier costManagementExportResourceId = CostManagementExportResource.CreateResourceIdentifier(scope, exportName); + CostManagementExportResource costManagementExport = client.GetCostManagementExportResource(costManagementExportResourceId); + + // invoke the operation + await costManagementExport.ExecuteAsync(); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Execute_ExportRunByBillingAccountWithOptionalRequestBody() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunByBillingAccountWithOptionalRequestBody.json // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -705,7 +1194,7 @@ public async Task Execute_ExportRunByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task Execute_ExportRunByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunByDepartment.json // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -730,7 +1219,7 @@ public async Task Execute_ExportRunByDepartment() [Ignore("Only validating compilation of examples")] public async Task Execute_ExportRunByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunByEnrollmentAccount.json // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -755,7 +1244,7 @@ public async Task Execute_ExportRunByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task Execute_ExportRunByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunByManagementGroup.json // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -780,7 +1269,7 @@ public async Task Execute_ExportRunByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task Execute_ExportRunByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunByResourceGroup.json // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -805,7 +1294,7 @@ public async Task Execute_ExportRunByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Execute_ExportRunBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunBySubscription.json // this example is just showing the usage of "Exports_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -830,7 +1319,7 @@ public async Task Execute_ExportRunBySubscription() [Ignore("Only validating compilation of examples")] public async Task GetExecutionHistory_ExportRunHistoryGetByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByBillingAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunHistoryGetByBillingAccount.json // this example is just showing the usage of "Exports_GetExecutionHistory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -858,7 +1347,7 @@ public async Task GetExecutionHistory_ExportRunHistoryGetByBillingAccount() [Ignore("Only validating compilation of examples")] public async Task GetExecutionHistory_ExportRunHistoryGetByDepartment() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByDepartment.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunHistoryGetByDepartment.json // this example is just showing the usage of "Exports_GetExecutionHistory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -886,7 +1375,7 @@ public async Task GetExecutionHistory_ExportRunHistoryGetByDepartment() [Ignore("Only validating compilation of examples")] public async Task GetExecutionHistory_ExportRunHistoryGetByEnrollmentAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByEnrollmentAccount.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunHistoryGetByEnrollmentAccount.json // this example is just showing the usage of "Exports_GetExecutionHistory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -914,7 +1403,7 @@ public async Task GetExecutionHistory_ExportRunHistoryGetByEnrollmentAccount() [Ignore("Only validating compilation of examples")] public async Task GetExecutionHistory_ExportRunHistoryGetByManagementGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByManagementGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunHistoryGetByManagementGroup.json // this example is just showing the usage of "Exports_GetExecutionHistory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -942,7 +1431,7 @@ public async Task GetExecutionHistory_ExportRunHistoryGetByManagementGroup() [Ignore("Only validating compilation of examples")] public async Task GetExecutionHistory_ExportRunHistoryGetByResourceGroup() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunHistoryGetByResourceGroup.json // this example is just showing the usage of "Exports_GetExecutionHistory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -970,7 +1459,7 @@ public async Task GetExecutionHistory_ExportRunHistoryGetByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task GetExecutionHistory_ExportRunHistoryGetBySubscription() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetBySubscription.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExportRunHistoryGetBySubscription.json // this example is just showing the usage of "Exports_GetExecutionHistory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsCollection.cs index 3c9bd29a22d3..69fd2685beef 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_CostManagementViewsCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ResourceGroupCreateOrUpdateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewCreateOrUpdateByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewCreateOrUpdateByResourceGroup.json // this example is just showing the usage of "Views_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -36,6 +36,7 @@ public async Task CreateOrUpdate_ResourceGroupCreateOrUpdateView() string viewName = "swaggerExample"; CostManagementViewData data = new CostManagementViewData { + ETag = new ETag("\"1d4ff9fe66f1d10\""), DisplayName = "swagger Example", Chart = ViewChartType.Table, Accumulated = AccumulatedType.True, @@ -79,7 +80,6 @@ public async Task CreateOrUpdate_ResourceGroupCreateOrUpdateView() Direction = ReportConfigSortingType.Ascending, }}, }, - ETag = new ETag("\"1d4ff9fe66f1d10\""), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, viewName, data); CostManagementViewsResource result = lro.Value; @@ -95,7 +95,7 @@ public async Task CreateOrUpdate_ResourceGroupCreateOrUpdateView() [Ignore("Only validating compilation of examples")] public async Task Get_ResourceGroupView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewByResourceGroup.json // this example is just showing the usage of "Views_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Get_ResourceGroupView() [Ignore("Only validating compilation of examples")] public async Task GetAll_ResourceGroupViewList() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewListByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewListByResourceGroup.json // this example is just showing the usage of "Views_ListByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +151,7 @@ public async Task GetAll_ResourceGroupViewList() [Ignore("Only validating compilation of examples")] public async Task Exists_ResourceGroupView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewByResourceGroup.json // this example is just showing the usage of "Views_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -174,7 +174,7 @@ public async Task Exists_ResourceGroupView() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ResourceGroupView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewByResourceGroup.json // this example is just showing the usage of "Views_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsResource.cs index 4a6663b88710..be0bf956d13a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_CostManagementViewsResource.cs @@ -20,7 +20,7 @@ public partial class Sample_CostManagementViewsResource [Ignore("Only validating compilation of examples")] public async Task Get_ResourceGroupView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewByResourceGroup.json // this example is just showing the usage of "Views_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -49,7 +49,7 @@ public async Task Get_ResourceGroupView() [Ignore("Only validating compilation of examples")] public async Task Delete_ResourceGroupDeleteView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewDeleteByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewDeleteByResourceGroup.json // this example is just showing the usage of "Views_DeleteByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -74,7 +74,7 @@ public async Task Delete_ResourceGroupDeleteView() [Ignore("Only validating compilation of examples")] public async Task Update_ResourceGroupCreateOrUpdateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewCreateOrUpdateByResourceGroup.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ViewCreateOrUpdateByResourceGroup.json // this example is just showing the usage of "Views_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,6 +92,7 @@ public async Task Update_ResourceGroupCreateOrUpdateView() // invoke the operation CostManagementViewData data = new CostManagementViewData { + ETag = new ETag("\"1d4ff9fe66f1d10\""), DisplayName = "swagger Example", Chart = ViewChartType.Table, Accumulated = AccumulatedType.True, @@ -135,7 +136,6 @@ public async Task Update_ResourceGroupCreateOrUpdateView() Direction = ReportConfigSortingType.Ascending, }}, }, - ETag = new ETag("\"1d4ff9fe66f1d10\""), }; ArmOperation lro = await costManagementViews.UpdateAsync(WaitUntil.Completed, data); CostManagementViewsResource result = lro.Value; diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionCollection.cs index a843f4ef48cb..0c9672313b7c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ScheduledActionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdateInsightAlertScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json // this example is just showing the usage of "ScheduledActions_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -36,12 +36,12 @@ public async Task CreateOrUpdate_CreateOrUpdateInsightAlertScheduledActionByScop string name = "dailyAnomalyByResource"; ScheduledActionData data = new ScheduledActionData { + Kind = ScheduledActionKind.InsightAlert, DisplayName = "Daily anomaly by resource", Notification = new NotificationProperties(new string[] { "user@gmail.com", "team@gmail.com" }, "Cost anomaly detected in the resource"), Schedule = new ScheduleProperties(ScheduleFrequency.Daily, DateTimeOffset.Parse("2020-06-19T22:21:51.1287144Z"), DateTimeOffset.Parse("2021-06-19T22:21:51.1287144Z")), Status = ScheduledActionStatus.Enabled, ViewId = new ResourceIdentifier("/providers/Microsoft.CostManagement/views/swaggerExample"), - Kind = ScheduledActionKind.InsightAlert, }; string ifMatch = ""; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data, ifMatch: ifMatch); @@ -58,7 +58,7 @@ public async Task CreateOrUpdate_CreateOrUpdateInsightAlertScheduledActionByScop [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdateScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json // this example is just showing the usage of "ScheduledActions_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -74,6 +74,7 @@ public async Task CreateOrUpdate_CreateOrUpdateScheduledActionByScope() string name = "monthlyCostByResource"; ScheduledActionData data = new ScheduledActionData { + Kind = ScheduledActionKind.Email, DisplayName = "Monthly Cost By Resource", FileFormats = { ScheduledActionFileFormat.Csv }, Notification = new NotificationProperties(new string[] { "user@gmail.com", "team@gmail.com" }, "Cost by resource this month"), @@ -85,7 +86,6 @@ public async Task CreateOrUpdate_CreateOrUpdateScheduledActionByScope() }, Status = ScheduledActionStatus.Enabled, ViewId = new ResourceIdentifier("/providers/Microsoft.CostManagement/views/swaggerExample"), - Kind = ScheduledActionKind.Email, }; string ifMatch = ""; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data, ifMatch: ifMatch); @@ -102,7 +102,7 @@ public async Task CreateOrUpdate_CreateOrUpdateScheduledActionByScope() [Ignore("Only validating compilation of examples")] public async Task Get_ScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-shared.json // this example is just showing the usage of "ScheduledActions_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task Get_ScheduledActionByScope() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScheduledActionsListByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledActions-list-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledActions-list-shared.json // this example is just showing the usage of "ScheduledActions_ListByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -158,7 +158,7 @@ public async Task GetAll_ScheduledActionsListByScope() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScheduledActionsListByScopeFilterByViewId() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json // this example is just showing the usage of "ScheduledActions_ListByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -188,7 +188,7 @@ public async Task GetAll_ScheduledActionsListByScopeFilterByViewId() [Ignore("Only validating compilation of examples")] public async Task Exists_ScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-shared.json // this example is just showing the usage of "ScheduledActions_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -211,7 +211,7 @@ public async Task Exists_ScheduledActionByScope() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-shared.json // this example is just showing the usage of "ScheduledActions_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionResource.cs index 45a26560d63a..900328aee95a 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_ScheduledActionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ScheduledActionResource [Ignore("Only validating compilation of examples")] public async Task Get_ScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-shared.json // this example is just showing the usage of "ScheduledActions_GetByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -49,7 +49,7 @@ public async Task Get_ScheduledActionByScope() [Ignore("Only validating compilation of examples")] public async Task Delete_ScheduledActionDeleteByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-delete-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-delete-shared.json // this example is just showing the usage of "ScheduledActions_DeleteByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -74,7 +74,7 @@ public async Task Delete_ScheduledActionDeleteByScope() [Ignore("Only validating compilation of examples")] public async Task Update_CreateOrUpdateInsightAlertScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json // this example is just showing the usage of "ScheduledActions_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,12 +92,12 @@ public async Task Update_CreateOrUpdateInsightAlertScheduledActionByScope() // invoke the operation ScheduledActionData data = new ScheduledActionData { + Kind = ScheduledActionKind.InsightAlert, DisplayName = "Daily anomaly by resource", Notification = new NotificationProperties(new string[] { "user@gmail.com", "team@gmail.com" }, "Cost anomaly detected in the resource"), Schedule = new ScheduleProperties(ScheduleFrequency.Daily, DateTimeOffset.Parse("2020-06-19T22:21:51.1287144Z"), DateTimeOffset.Parse("2021-06-19T22:21:51.1287144Z")), Status = ScheduledActionStatus.Enabled, ViewId = new ResourceIdentifier("/providers/Microsoft.CostManagement/views/swaggerExample"), - Kind = ScheduledActionKind.InsightAlert, }; string ifMatch = ""; ArmOperation lro = await scheduledAction.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); @@ -114,7 +114,7 @@ public async Task Update_CreateOrUpdateInsightAlertScheduledActionByScope() [Ignore("Only validating compilation of examples")] public async Task Update_CreateOrUpdateScheduledActionByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json // this example is just showing the usage of "ScheduledActions_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,6 +132,7 @@ public async Task Update_CreateOrUpdateScheduledActionByScope() // invoke the operation ScheduledActionData data = new ScheduledActionData { + Kind = ScheduledActionKind.Email, DisplayName = "Monthly Cost By Resource", FileFormats = { ScheduledActionFileFormat.Csv }, Notification = new NotificationProperties(new string[] { "user@gmail.com", "team@gmail.com" }, "Cost by resource this month"), @@ -143,7 +144,6 @@ public async Task Update_CreateOrUpdateScheduledActionByScope() }, Status = ScheduledActionStatus.Enabled, ViewId = new ResourceIdentifier("/providers/Microsoft.CostManagement/views/swaggerExample"), - Kind = ScheduledActionKind.Email, }; string ifMatch = ""; ArmOperation lro = await scheduledAction.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); @@ -160,7 +160,7 @@ public async Task Update_CreateOrUpdateScheduledActionByScope() [Ignore("Only validating compilation of examples")] public async Task RunByScope_ScheduledActionRunByScope() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-sendNow-shared.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-sendNow-shared.json // this example is just showing the usage of "ScheduledActions_RunByScope" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_SettingCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_SettingCollection.cs new file mode 100644 index 000000000000..1705fee315ff --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_SettingCollection.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CostManagement.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.CostManagement.Samples +{ + public partial class Sample_SettingCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateSettingByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/settings-createOrUpdate.json + // this example is just showing the usage of "Settings_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingCollection collection = client.GetSettings(new ResourceIdentifier(scope)); + + // invoke the operation + SettingType type = SettingType.Taginheritance; + SettingData data = new TagInheritanceSetting + { + PreferContainerTags = false, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, type, data); + SettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SettingByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/setting-get.json + // this example is just showing the usage of "Settings_GetByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingCollection collection = client.GetSettings(new ResourceIdentifier(scope)); + + // invoke the operation + SettingType type = SettingType.Taginheritance; + SettingResource result = await collection.GetAsync(type); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_SettingsList() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/settingsList.json + // this example is just showing the usage of "Settings_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingCollection collection = client.GetSettings(new ResourceIdentifier(scope)); + + // invoke the operation and iterate over the result + await foreach (SettingResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SettingData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_SettingByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/setting-get.json + // this example is just showing the usage of "Settings_GetByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingCollection collection = client.GetSettings(new ResourceIdentifier(scope)); + + // invoke the operation + SettingType type = SettingType.Taginheritance; + bool result = await collection.ExistsAsync(type); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SettingByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/setting-get.json + // this example is just showing the usage of "Settings_GetByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // get the collection of this SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingCollection collection = client.GetSettings(new ResourceIdentifier(scope)); + + // invoke the operation + SettingType type = SettingType.Taginheritance; + NullableResponse response = await collection.GetIfExistsAsync(type); + SettingResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_SettingResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_SettingResource.cs new file mode 100644 index 000000000000..cc4a621228c3 --- /dev/null +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_SettingResource.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CostManagement.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.CostManagement.Samples +{ + public partial class Sample_SettingResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SettingByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/setting-get.json + // this example is just showing the usage of "Settings_GetByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SettingResource created on azure + // for more information of creating SettingResource, please refer to the document of SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingType type = SettingType.Taginheritance; + ResourceIdentifier settingResourceId = SettingResource.CreateResourceIdentifier(scope, type); + SettingResource setting = client.GetSettingResource(settingResourceId); + + // invoke the operation + SettingType type0 = SettingType.Taginheritance; + SettingResource result = await setting.GetAsync(type0); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_SettingDeleteByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/setting-delete.json + // this example is just showing the usage of "Settings_DeleteByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SettingResource created on azure + // for more information of creating SettingResource, please refer to the document of SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingType type = SettingType.Taginheritance; + ResourceIdentifier settingResourceId = SettingResource.CreateResourceIdentifier(scope, type); + SettingResource setting = client.GetSettingResource(settingResourceId); + + // invoke the operation + SettingType type0 = SettingType.Taginheritance; + await setting.DeleteAsync(WaitUntil.Completed, type0); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateOrUpdateSettingByScope() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/settings-createOrUpdate.json + // this example is just showing the usage of "Settings_CreateOrUpdateByScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SettingResource created on azure + // for more information of creating SettingResource, please refer to the document of SettingResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000000"; + SettingType type = SettingType.Taginheritance; + ResourceIdentifier settingResourceId = SettingResource.CreateResourceIdentifier(scope, type); + SettingResource setting = client.GetSettingResource(settingResourceId); + + // invoke the operation + SettingType type0 = SettingType.Taginheritance; + SettingData data = new TagInheritanceSetting + { + PreferContainerTags = false, + }; + ArmOperation lro = await setting.UpdateAsync(WaitUntil.Completed, type0, data); + SettingResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantResourceExtensions.cs index 9966fd01dedc..cc5196c4c08c 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantResourceExtensions.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -20,61 +20,10 @@ public partial class Sample_TenantResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetBenefitUtilizationSummariesByBillingAccountId_SavingsPlanUtilizationSummariesBillingAccount() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json - // this example is just showing the usage of "BenefitUtilizationSummaries_ListByBillingAccountId" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation and iterate over the result - string billingAccountId = "12345"; - string filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesByBillingAccountIdAsync(billingAccountId, filter: filter)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetBenefitUtilizationSummariesByBillingProfileId_SavingsPlanUtilizationSummariesBillingProfile() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json - // this example is just showing the usage of "BenefitUtilizationSummaries_ListByBillingProfileId" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation and iterate over the result - string billingAccountId = "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec"; - string billingProfileId = "200e5e90-000e-4960-8dcd-8d00a02db000"; - string filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; - await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesByBillingProfileIdAsync(billingAccountId, billingProfileId, filter: filter)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetBenefitUtilizationSummariesBySavingsPlanOrder_SavingsPlanUtilizationSummariesDaily() + public async Task GetCostManagementAlerts_ExternalBillingAccountAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json - // this example is just showing the usage of "BenefitUtilizationSummaries_ListBySavingsPlanOrder" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalBillingAccountAlerts.json + // this example is just showing the usage of "Alerts_ListExternal" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -84,10 +33,15 @@ public async Task GetBenefitUtilizationSummariesBySavingsPlanOrder_SavingsPlanUt TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation and iterate over the result - string savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; - await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(savingsPlanOrderId)) + ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalBillingAccounts; + string externalCloudProviderId = "100"; + await foreach (CostManagementAlertResource item in tenantResource.GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId)) { - Console.WriteLine($"Succeeded: {item}"); + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementAlertData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); @@ -95,10 +49,10 @@ public async Task GetBenefitUtilizationSummariesBySavingsPlanOrder_SavingsPlanUt [Test] [Ignore("Only validating compilation of examples")] - public async Task GetBenefitUtilizationSummariesBySavingsPlanId_SavingsPlanUtilizationSummariesMonthlyWithSavingsPlanId() + public async Task GetCostManagementAlerts_ExternalSubscriptionAlerts() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json - // this example is just showing the usage of "BenefitUtilizationSummaries_ListBySavingsPlanId" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalSubscriptionAlerts.json + // this example is just showing the usage of "Alerts_ListExternal" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -108,11 +62,15 @@ public async Task GetBenefitUtilizationSummariesBySavingsPlanId_SavingsPlanUtili TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation and iterate over the result - string savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; - string savingsPlanId = "222d22dd-d2d2-2dd2-222d-2dd2222ddddd"; - await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId)) + ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalSubscriptions; + string externalCloudProviderId = "100"; + await foreach (CostManagementAlertResource item in tenantResource.GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId)) { - Console.WriteLine($"Succeeded: {item}"); + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CostManagementAlertData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); @@ -120,36 +78,10 @@ public async Task GetBenefitUtilizationSummariesBySavingsPlanId_SavingsPlanUtili [Test] [Ignore("Only validating compilation of examples")] - public async Task GenerateBenefitUtilizationSummariesReportBillingAccountScope_GenerateUtilizationSummariesReportByBillingAccount() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json - // this example is just showing the usage of "BillingAccountScope_GenerateBenefitUtilizationSummariesReport" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation - string billingAccountId = "8099099"; - BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")) - { - Kind = BillingAccountBenefitKind.Reservation, - }; - ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(WaitUntil.Completed, billingAccountId, content); - BenefitUtilizationSummariesOperationStatus result = lro.Value; - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GenerateBenefitUtilizationSummariesReportBillingProfileScope_GenerateUtilizationSummariesReportByBillingProfile() + public async Task CheckCostManagementNameAvailabilityByScheduledAction_ScheduledActionCheckNameAvailability() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json - // this example is just showing the usage of "BillingProfileScope_GenerateBenefitUtilizationSummariesReport" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json + // this example is just showing the usage of "ScheduledActions_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -159,118 +91,22 @@ public async Task GenerateBenefitUtilizationSummariesReportBillingProfileScope_G TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation - string billingAccountId = "00000000-0000-0000-0000-000000000000"; - string billingProfileId = "CZSFR-SDFXC-DSDF"; - BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")) + CostManagementNameAvailabilityContent content = new CostManagementNameAvailabilityContent { - Kind = BillingAccountBenefitKind.Reservation, + Name = "testName", + ResourceType = "Microsoft.CostManagement/ScheduledActions", }; - ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(WaitUntil.Completed, billingAccountId, billingProfileId, content); - BenefitUtilizationSummariesOperationStatus result = lro.Value; - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GenerateBenefitUtilizationSummariesReportReservationOrderScope_GenerateUtilizationSummariesReportByReservationOrder() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json - // this example is just showing the usage of "ReservationOrderScope_GenerateBenefitUtilizationSummariesReport" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation - string reservationOrderId = "00000000-0000-0000-0000-000000000000"; - BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); - ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(WaitUntil.Completed, reservationOrderId, content); - BenefitUtilizationSummariesOperationStatus result = lro.Value; - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GenerateBenefitUtilizationSummariesReportReservationScope_GenerateUtilizationSummariesReportByReservation() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json - // this example is just showing the usage of "ReservationScope_GenerateBenefitUtilizationSummariesReport" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation - string reservationOrderId = "00000000-0000-0000-0000-000000000000"; - string reservationId = "00000000-0000-0000-0000-000000000000"; - BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); - ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportReservationScopeAsync(WaitUntil.Completed, reservationOrderId, reservationId, content); - BenefitUtilizationSummariesOperationStatus result = lro.Value; - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope_GenerateUtilizationSummariesReportBySavingsPlanOrder() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json - // this example is just showing the usage of "SavingsPlanOrderScope_GenerateBenefitUtilizationSummariesReport" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation - string savingsPlanOrderId = "00000000-0000-0000-0000-000000000000"; - BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); - ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(WaitUntil.Completed, savingsPlanOrderId, content); - BenefitUtilizationSummariesOperationStatus result = lro.Value; - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope_GenerateUtilizationSummariesReportBySavingsPlan() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json - // this example is just showing the usage of "SavingsPlanScope_GenerateBenefitUtilizationSummariesReportAsync" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation - string savingsPlanOrderId = "00000000-0000-0000-0000-000000000000"; - string savingsPlanId = "00000000-0000-0000-0000-000000000000"; - BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); - ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(WaitUntil.Completed, savingsPlanOrderId, savingsPlanId, content); - BenefitUtilizationSummariesOperationStatus result = lro.Value; + CostManagementNameAvailabilityResult result = await tenantResource.CheckCostManagementNameAvailabilityByScheduledActionAsync(content); Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetCostManagementAlerts_ExternalBillingAccountAlerts() + public async Task ByExternalCloudProviderTypeDimensions_ExternalBillingAccountDimensionList() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountAlerts.json - // this example is just showing the usage of "Alerts_ListExternal" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalBillingAccountsDimensions.json + // this example is just showing the usage of "Dimensions_ByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -282,13 +118,10 @@ public async Task GetCostManagementAlerts_ExternalBillingAccountAlerts() // invoke the operation and iterate over the result ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalBillingAccounts; string externalCloudProviderId = "100"; - await foreach (CostManagementAlertResource item in tenantResource.GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId)) + TenantResourceByExternalCloudProviderTypeDimensionsOptions options = new TenantResourceByExternalCloudProviderTypeDimensionsOptions(externalCloudProviderType, externalCloudProviderId); + await foreach (CostManagementDimension item in tenantResource.ByExternalCloudProviderTypeDimensionsAsync(options)) { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - CostManagementAlertData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); @@ -296,10 +129,10 @@ public async Task GetCostManagementAlerts_ExternalBillingAccountAlerts() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetCostManagementAlerts_ExternalSubscriptionAlerts() + public async Task ByExternalCloudProviderTypeDimensions_ExternalSubscriptionDimensionList() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionAlerts.json - // this example is just showing the usage of "Alerts_ListExternal" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalSubscriptionsDimensions.json + // this example is just showing the usage of "Dimensions_ByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -311,13 +144,10 @@ public async Task GetCostManagementAlerts_ExternalSubscriptionAlerts() // invoke the operation and iterate over the result ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalSubscriptions; string externalCloudProviderId = "100"; - await foreach (CostManagementAlertResource item in tenantResource.GetCostManagementAlertsAsync(externalCloudProviderType, externalCloudProviderId)) + TenantResourceByExternalCloudProviderTypeDimensionsOptions options = new TenantResourceByExternalCloudProviderTypeDimensionsOptions(externalCloudProviderType, externalCloudProviderId); + await foreach (CostManagementDimension item in tenantResource.ByExternalCloudProviderTypeDimensionsAsync(options)) { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - CostManagementAlertData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); @@ -327,7 +157,7 @@ public async Task GetCostManagementAlerts_ExternalSubscriptionAlerts() [Ignore("Only validating compilation of examples")] public async Task ExternalCloudProviderUsageForecast_ExternalBillingAccountForecast() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountForecast.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalBillingAccountForecast.json // this example is just showing the usage of "Forecast_ExternalCloudProviderUsage" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -375,7 +205,7 @@ public async Task ExternalCloudProviderUsageForecast_ExternalBillingAccountForec [Ignore("Only validating compilation of examples")] public async Task ExternalCloudProviderUsageForecast_ExternalSubscriptionForecast() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionForecast.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalSubscriptionForecast.json // this example is just showing the usage of "Forecast_ExternalCloudProviderUsage" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -421,10 +251,10 @@ public async Task ExternalCloudProviderUsageForecast_ExternalSubscriptionForecas [Test] [Ignore("Only validating compilation of examples")] - public async Task ByExternalCloudProviderTypeDimensions_ExternalBillingAccountDimensionList() + public async Task UsageByExternalCloudProviderTypeQuery_ExternalBillingAccountQueryList() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountsDimensions.json - // this example is just showing the usage of "Dimensions_ByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalBillingAccountsQuery.json + // this example is just showing the usage of "Query_UsageByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -433,62 +263,10 @@ public async Task ByExternalCloudProviderTypeDimensions_ExternalBillingAccountDi TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - // invoke the operation and iterate over the result + // invoke the operation ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalBillingAccounts; string externalCloudProviderId = "100"; - TenantResourceByExternalCloudProviderTypeDimensionsOptions options = new TenantResourceByExternalCloudProviderTypeDimensionsOptions(externalCloudProviderType, externalCloudProviderId); - await foreach (CostManagementDimension item in tenantResource.ByExternalCloudProviderTypeDimensionsAsync(options)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task ByExternalCloudProviderTypeDimensions_ExternalSubscriptionDimensionList() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionsDimensions.json - // this example is just showing the usage of "Dimensions_ByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation and iterate over the result - ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalSubscriptions; - string externalCloudProviderId = "100"; - TenantResourceByExternalCloudProviderTypeDimensionsOptions options = new TenantResourceByExternalCloudProviderTypeDimensionsOptions(externalCloudProviderType, externalCloudProviderId); - await foreach (CostManagementDimension item in tenantResource.ByExternalCloudProviderTypeDimensionsAsync(options)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task UsageByExternalCloudProviderTypeQuery_ExternalBillingAccountQueryList() - { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountsQuery.json - // this example is just showing the usage of "Query_UsageByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation - ExternalCloudProviderType externalCloudProviderType = ExternalCloudProviderType.ExternalBillingAccounts; - string externalCloudProviderId = "100"; - QueryDefinition queryDefinition = new QueryDefinition(ExportType.Usage, TimeframeType.MonthToDate, new QueryDataset + QueryDefinition queryDefinition = new QueryDefinition(ExportType.Usage, TimeframeType.MonthToDate, new QueryDataset { Granularity = GranularityType.Daily, Filter = new QueryFilter @@ -517,7 +295,7 @@ public async Task UsageByExternalCloudProviderTypeQuery_ExternalBillingAccountQu [Ignore("Only validating compilation of examples")] public async Task UsageByExternalCloudProviderTypeQuery_ExternalSubscriptionsQuery() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionsQuery.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/ExternalSubscriptionsQuery.json // this example is just showing the usage of "Query_UsageByExternalCloudProviderType" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -557,10 +335,10 @@ public async Task UsageByExternalCloudProviderTypeQuery_ExternalSubscriptionsQue [Test] [Ignore("Only validating compilation of examples")] - public async Task ByBillingAccountIdGenerateReservationDetailsReport_ReservationDetails() + public async Task DownloadByBillingAccountPriceSheet_EAPriceSheetForBillingPeriod() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateReservationDetailsReportByBillingAccount.json - // this example is just showing the usage of "GenerateReservationDetailsReport_ByBillingAccountId" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/EAPriceSheetForBillingPeriod.json + // this example is just showing the usage of "PriceSheet_DownloadByBillingAccount" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -570,10 +348,9 @@ public async Task ByBillingAccountIdGenerateReservationDetailsReport_Reservation TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation - string billingAccountId = "9845612"; - string startDate = "2020-01-01"; - string endDate = "2020-01-30"; - ArmOperation lro = await tenantResource.ByBillingAccountIdGenerateReservationDetailsReportAsync(WaitUntil.Completed, billingAccountId, startDate, endDate); + string billingAccountId = "0000000"; + string billingPeriodName = "202311"; + ArmOperation lro = await tenantResource.DownloadByBillingAccountPriceSheetAsync(WaitUntil.Completed, billingAccountId, billingPeriodName); OperationStatus result = lro.Value; Console.WriteLine($"Succeeded: {result}"); @@ -581,10 +358,10 @@ public async Task ByBillingAccountIdGenerateReservationDetailsReport_Reservation [Test] [Ignore("Only validating compilation of examples")] - public async Task ByBillingProfileIdGenerateReservationDetailsReport_ReservationDetails() + public async Task DownloadPriceSheet_PricesheetDownload() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateReservationDetailsReportByBillingProfile.json - // this example is just showing the usage of "GenerateReservationDetailsReport_ByBillingProfileId" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PricesheetDownload.json + // this example is just showing the usage of "PriceSheet_DownloadByInvoice" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -594,22 +371,21 @@ public async Task ByBillingProfileIdGenerateReservationDetailsReport_Reservation TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation - string billingAccountId = "00000000-0000-0000-0000-000000000000"; - string billingProfileId = "CZSFR-SDFXC-DSDF"; - string startDate = "2020-01-01"; - string endDate = "2020-01-30"; - ArmOperation lro = await tenantResource.ByBillingProfileIdGenerateReservationDetailsReportAsync(WaitUntil.Completed, billingAccountId, billingProfileId, startDate, endDate); - OperationStatus result = lro.Value; + string billingAccountName = "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; + string billingProfileName = "2USN-TPCD-BG7-TGB"; + string invoiceName = "T000940677"; + ArmOperation lro = await tenantResource.DownloadPriceSheetAsync(WaitUntil.Completed, billingAccountName, billingProfileName, invoiceName); + DownloadURL result = lro.Value; Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task DownloadPriceSheet_PricesheetDownload() + public async Task DownloadPriceSheetByBillingProfile_PricesheetDownloadByBillingProfile() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PricesheetDownload.json - // this example is just showing the usage of "PriceSheet_Download" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PricesheetDownloadByBillingProfile.json + // this example is just showing the usage of "PriceSheet_DownloadByBillingProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -621,19 +397,118 @@ public async Task DownloadPriceSheet_PricesheetDownload() // invoke the operation string billingAccountName = "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; string billingProfileName = "2USN-TPCD-BG7-TGB"; - string invoiceName = "T000940677"; - ArmOperation lro = await tenantResource.DownloadPriceSheetAsync(WaitUntil.Completed, billingAccountName, billingProfileName, invoiceName); - DownloadURL result = lro.Value; + ArmOperation lro = await tenantResource.DownloadPriceSheetByBillingProfileAsync(WaitUntil.Completed, billingAccountName, billingProfileName); + PricesheetDownloadProperties result = lro.Value; Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task DownloadByBillingProfilePriceSheet_PricesheetDownloadByBillingProfile() + public async Task GetBenefitUtilizationSummariesByBillingProfileId_SavingsPlanUtilizationSummariesBillingProfile() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PricesheetDownloadByBillingProfile.json - // this example is just showing the usage of "PriceSheet_DownloadByBillingProfile" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json + // this example is just showing the usage of "BenefitUtilizationSummaries_ListByBillingProfileId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + string billingAccountId = "c0a00000-0e04-5ee3-000e-f0c6e00000ec:c0a00000-0e04-5ee3-000e-f0c6e00000ec"; + string billingProfileId = "200e5e90-000e-4960-8dcd-8d00a02db000"; + string filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; + await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesByBillingProfileIdAsync(billingAccountId, billingProfileId, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetBenefitUtilizationSummariesByBillingAccountId_SavingsPlanUtilizationSummariesBillingAccount() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json + // this example is just showing the usage of "BenefitUtilizationSummaries_ListByBillingAccountId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + string billingAccountId = "12345"; + string filter = "properties/usageDate ge 2022-10-15 and properties/usageDate le 2022-10-18"; + await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesByBillingAccountIdAsync(billingAccountId, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetBenefitUtilizationSummariesBySavingsPlanOrder_SavingsPlanUtilizationSummariesDaily() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json + // this example is just showing the usage of "BenefitUtilizationSummaries_ListBySavingsPlanOrder" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + string savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; + await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesBySavingsPlanOrderAsync(savingsPlanOrderId)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetBenefitUtilizationSummariesBySavingsPlanId_SavingsPlanUtilizationSummariesMonthlyWithSavingsPlanId() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json + // this example is just showing the usage of "BenefitUtilizationSummaries_ListBySavingsPlanId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + string savingsPlanOrderId = "66cccc66-6ccc-6c66-666c-66cc6c6c66c6"; + string savingsPlanId = "222d22dd-d2d2-2dd2-222d-2dd2222ddddd"; + await foreach (BenefitUtilizationSummary item in tenantResource.GetBenefitUtilizationSummariesBySavingsPlanIdAsync(savingsPlanOrderId, savingsPlanId)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GenerateBenefitUtilizationSummariesReportBillingProfileScope_GenerateUtilizationSummariesReportByBillingProfile() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json + // this example is just showing the usage of "GenerateBenefitUtilizationSummariesReport_GenerateByBillingProfile" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -643,20 +518,24 @@ public async Task DownloadByBillingProfilePriceSheet_PricesheetDownloadByBilling TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation - string billingAccountName = "7c05a543-80ff-571e-9f98-1063b3b53cf2:99ad03ad-2d1b-4889-a452-090ad407d25f_2019-05-31"; - string billingProfileName = "2USN-TPCD-BG7-TGB"; - ArmOperation lro = await tenantResource.DownloadByBillingProfilePriceSheetAsync(WaitUntil.Completed, billingAccountName, billingProfileName); - DownloadURL result = lro.Value; + string billingAccountId = "00000000-0000-0000-0000-000000000000"; + string billingProfileId = "CZSFR-SDFXC-DSDF"; + BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")) + { + Kind = BillingAccountBenefitKind.Reservation, + }; + ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportBillingProfileScopeAsync(WaitUntil.Completed, billingAccountId, billingProfileId, content); + BenefitUtilizationSummariesOperationStatus result = lro.Value; Console.WriteLine($"Succeeded: {result}"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task CheckCostManagementNameAvailabilityByScheduledAction_ScheduledActionCheckNameAvailability() + public async Task GenerateBenefitUtilizationSummariesReportBillingAccountScope_GenerateUtilizationSummariesReportByBillingAccount() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json - // this example is just showing the usage of "ScheduledActions_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json + // this example is just showing the usage of "GenerateBenefitUtilizationSummariesReport_GenerateByBillingAccount" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -666,12 +545,181 @@ public async Task CheckCostManagementNameAvailabilityByScheduledAction_Scheduled TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; // invoke the operation - CostManagementNameAvailabilityContent content = new CostManagementNameAvailabilityContent + string billingAccountId = "8099099"; + BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")) { - Name = "testName", - ResourceType = "Microsoft.CostManagement/ScheduledActions", + Kind = BillingAccountBenefitKind.Reservation, }; - CostManagementNameAvailabilityResult result = await tenantResource.CheckCostManagementNameAvailabilityByScheduledActionAsync(content); + ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportBillingAccountScopeAsync(WaitUntil.Completed, billingAccountId, content); + BenefitUtilizationSummariesOperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScope_GenerateUtilizationSummariesReportBySavingsPlanOrder() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json + // this example is just showing the usage of "GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanOrderId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string savingsPlanOrderId = "00000000-0000-0000-0000-000000000000"; + BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); + ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportSavingsPlanOrderScopeAsync(WaitUntil.Completed, savingsPlanOrderId, content); + BenefitUtilizationSummariesOperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScope_GenerateUtilizationSummariesReportBySavingsPlan() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json + // this example is just showing the usage of "GenerateBenefitUtilizationSummariesReport_GenerateBySavingsPlanId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string savingsPlanOrderId = "00000000-0000-0000-0000-000000000000"; + string savingsPlanId = "00000000-0000-0000-0000-000000000000"; + BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); + ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportAsyncSavingsPlanScopeAsync(WaitUntil.Completed, savingsPlanOrderId, savingsPlanId, content); + BenefitUtilizationSummariesOperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GenerateBenefitUtilizationSummariesReportReservationOrderScope_GenerateUtilizationSummariesReportByReservationOrder() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json + // this example is just showing the usage of "GenerateBenefitUtilizationSummariesReport_GenerateByReservationOrderId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string reservationOrderId = "00000000-0000-0000-0000-000000000000"; + BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); + ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportReservationOrderScopeAsync(WaitUntil.Completed, reservationOrderId, content); + BenefitUtilizationSummariesOperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GenerateBenefitUtilizationSummariesReportReservationScope_GenerateUtilizationSummariesReportByReservation() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json + // this example is just showing the usage of "GenerateBenefitUtilizationSummariesReport_GenerateByReservationId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string reservationOrderId = "00000000-0000-0000-0000-000000000000"; + string reservationId = "00000000-0000-0000-0000-000000000000"; + BenefitUtilizationSummariesContent content = new BenefitUtilizationSummariesContent(BenefitRecommendationUsageGrain.Daily, DateTimeOffset.Parse("2022-06-01T00:00:00Z"), DateTimeOffset.Parse("2022-08-31T00:00:00Z")); + ArmOperation lro = await tenantResource.GenerateBenefitUtilizationSummariesReportReservationScopeAsync(WaitUntil.Completed, reservationOrderId, reservationId, content); + BenefitUtilizationSummariesOperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ByBillingProfileIdGenerateReservationDetailsReport_ReservationDetails() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/GenerateReservationDetailsReportByBillingProfile.json + // this example is just showing the usage of "GenerateReservationDetailsReport_ByBillingProfileId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string billingAccountId = "00000000-0000-0000-0000-000000000000"; + string billingProfileId = "CZSFR-SDFXC-DSDF"; + string startDate = "2020-01-01"; + string endDate = "2020-01-30"; + ArmOperation lro = await tenantResource.ByBillingProfileIdGenerateReservationDetailsReportAsync(WaitUntil.Completed, billingAccountId, billingProfileId, startDate, endDate); + OperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ByBillingAccountIdGenerateReservationDetailsReport_ReservationDetails() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/GenerateReservationDetailsReportByBillingAccount.json + // this example is just showing the usage of "GenerateReservationDetailsReport_ByBillingAccountId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + string billingAccountId = "9845612"; + string startDate = "2020-01-01"; + string endDate = "2020-01-30"; + ArmOperation lro = await tenantResource.ByBillingAccountIdGenerateReservationDetailsReportAsync(WaitUntil.Completed, billingAccountId, startDate, endDate); + OperationStatus result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CheckNameAvailabilityCostAllocationRule_CostAllocationRuleCheckNameAvailability() + { + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/CostAllocationRuleCheckNameAvailability.json + // this example is just showing the usage of "CostAllocationRules_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + CostAllocationRuleCheckNameAvailabilityContent content = new CostAllocationRuleCheckNameAvailabilityContent + { + Name = "testRule", + ResourceType = "Microsoft.CostManagement/costAllocationRules", + }; + CostAllocationRuleCheckNameAvailabilityResponse result = await tenantResource.CheckNameAvailabilityCostAllocationRuleAsync(content); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionCollection.cs index bf9e98e32552..d15a0f603e39 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_TenantScheduledActionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdatePrivateScheduledAction() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json // this example is just showing the usage of "ScheduledActions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -38,6 +38,7 @@ public async Task CreateOrUpdate_CreateOrUpdatePrivateScheduledAction() string name = "monthlyCostByResource"; ScheduledActionData data = new ScheduledActionData { + Kind = ScheduledActionKind.Email, DisplayName = "Monthly Cost By Resource", Notification = new NotificationProperties(new string[] { "user@gmail.com", "team@gmail.com" }, "Cost by resource this month"), Schedule = new ScheduleProperties(ScheduleFrequency.Monthly, DateTimeOffset.Parse("2020-06-19T22:21:51.1287144Z"), DateTimeOffset.Parse("2021-06-19T22:21:51.1287144Z")) @@ -48,7 +49,6 @@ public async Task CreateOrUpdate_CreateOrUpdatePrivateScheduledAction() }, Status = ScheduledActionStatus.Enabled, ViewId = new ResourceIdentifier("/providers/Microsoft.CostManagement/views/swaggerExample"), - Kind = ScheduledActionKind.Email, }; string ifMatch = ""; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data, ifMatch: ifMatch); @@ -65,7 +65,7 @@ public async Task CreateOrUpdate_CreateOrUpdatePrivateScheduledAction() [Ignore("Only validating compilation of examples")] public async Task Get_PrivateScheduledAction() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-private.json // this example is just showing the usage of "ScheduledActions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_PrivateScheduledAction() [Ignore("Only validating compilation of examples")] public async Task Exists_PrivateScheduledAction() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-private.json // this example is just showing the usage of "ScheduledActions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Exists_PrivateScheduledAction() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PrivateScheduledAction() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-private.json // this example is just showing the usage of "ScheduledActions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionResource.cs index 7eff8429876c..c23c49da2767 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantScheduledActionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_TenantScheduledActionResource [Ignore("Only validating compilation of examples")] public async Task Get_PrivateScheduledAction() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-get-private.json // this example is just showing the usage of "ScheduledActions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -48,7 +48,7 @@ public async Task Get_PrivateScheduledAction() [Ignore("Only validating compilation of examples")] public async Task Delete_PrivateScheduledActionDelete() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-delete-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-delete-private.json // this example is just showing the usage of "ScheduledActions_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -72,7 +72,7 @@ public async Task Delete_PrivateScheduledActionDelete() [Ignore("Only validating compilation of examples")] public async Task Update_CreateOrUpdatePrivateScheduledAction() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json // this example is just showing the usage of "ScheduledActions_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,6 +89,7 @@ public async Task Update_CreateOrUpdatePrivateScheduledAction() // invoke the operation ScheduledActionData data = new ScheduledActionData { + Kind = ScheduledActionKind.Email, DisplayName = "Monthly Cost By Resource", Notification = new NotificationProperties(new string[] { "user@gmail.com", "team@gmail.com" }, "Cost by resource this month"), Schedule = new ScheduleProperties(ScheduleFrequency.Monthly, DateTimeOffset.Parse("2020-06-19T22:21:51.1287144Z"), DateTimeOffset.Parse("2021-06-19T22:21:51.1287144Z")) @@ -99,7 +100,6 @@ public async Task Update_CreateOrUpdatePrivateScheduledAction() }, Status = ScheduledActionStatus.Enabled, ViewId = new ResourceIdentifier("/providers/Microsoft.CostManagement/views/swaggerExample"), - Kind = ScheduledActionKind.Email, }; string ifMatch = ""; ArmOperation lro = await tenantScheduledAction.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch); @@ -116,7 +116,7 @@ public async Task Update_CreateOrUpdatePrivateScheduledAction() [Ignore("Only validating compilation of examples")] public async Task Run_ScheduledActionSendNow() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-sendNow-private.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/scheduledActions/scheduledAction-sendNow-private.json // this example is just showing the usage of "ScheduledActions_Run" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs index 4bd4842b73df..acdcf3e003f5 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_TenantsCostManagementViewsCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdatePrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateViewCreateOrUpdate.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateViewCreateOrUpdate.json // this example is just showing the usage of "Views_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -38,6 +38,7 @@ public async Task CreateOrUpdate_CreateOrUpdatePrivateView() string viewName = "swaggerExample"; CostManagementViewData data = new CostManagementViewData { + ETag = new ETag("\"1d4ff9fe66f1d10\""), DisplayName = "swagger Example", Chart = ViewChartType.Table, Accumulated = AccumulatedType.True, @@ -81,7 +82,6 @@ public async Task CreateOrUpdate_CreateOrUpdatePrivateView() Direction = ReportConfigSortingType.Ascending, }}, }, - ETag = new ETag("\"1d4ff9fe66f1d10\""), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, viewName, data); TenantsCostManagementViewsResource result = lro.Value; @@ -97,7 +97,7 @@ public async Task CreateOrUpdate_CreateOrUpdatePrivateView() [Ignore("Only validating compilation of examples")] public async Task Get_PrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateView.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateView.json // this example is just showing the usage of "Views_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Get_PrivateView() [Ignore("Only validating compilation of examples")] public async Task Exists_PrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateView.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateView.json // this example is just showing the usage of "Views_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -149,7 +149,7 @@ public async Task Exists_PrivateView() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateView.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateView.json // this example is just showing the usage of "Views_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsResource.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsResource.cs index b40bd33a949d..ced7c146c71b 100644 --- a/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsResource.cs +++ b/sdk/costmanagement/Azure.ResourceManager.CostManagement/tests/Generated/Samples/Sample_TenantsCostManagementViewsResource.cs @@ -20,7 +20,7 @@ public partial class Sample_TenantsCostManagementViewsResource [Ignore("Only validating compilation of examples")] public async Task Get_PrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateView.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateView.json // this example is just showing the usage of "Views_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -48,7 +48,7 @@ public async Task Get_PrivateView() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletePrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateViewDelete.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateViewDelete.json // this example is just showing the usage of "Views_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -72,7 +72,7 @@ public async Task Delete_DeletePrivateView() [Ignore("Only validating compilation of examples")] public async Task Update_CreateOrUpdatePrivateView() { - // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateViewCreateOrUpdate.json + // Generated from example definition: specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement/stable/2025-03-01/examples/PrivateViewCreateOrUpdate.json // this example is just showing the usage of "Views_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,6 +89,7 @@ public async Task Update_CreateOrUpdatePrivateView() // invoke the operation CostManagementViewData data = new CostManagementViewData { + ETag = new ETag("\"1d4ff9fe66f1d10\""), DisplayName = "swagger Example", Chart = ViewChartType.Table, Accumulated = AccumulatedType.True, @@ -132,7 +133,6 @@ public async Task Update_CreateOrUpdatePrivateView() Direction = ReportConfigSortingType.Ascending, }}, }, - ETag = new ETag("\"1d4ff9fe66f1d10\""), }; ArmOperation lro = await tenantsCostManagementViews.UpdateAsync(WaitUntil.Completed, data); TenantsCostManagementViewsResource result = lro.Value;