Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary> Initializes a new instance of <see cref="CostManagement.ScheduledActionData"/>. </summary>
/// <param name="id"> The id. </param>
/// <param name="name"> The name. </param>
/// <param name="resourceType"> The resourceType. </param>
/// <param name="systemData"> The systemData. </param>
/// <param name="displayName"> Scheduled action name. </param>
/// <param name="fileFormats"> Destination format of the view data. This is optional. </param>
/// <param name="notification"> Notification properties based on scheduled action kind. </param>
/// <param name="notificationEmail"> Email address of the point of contact that should get the unsubscribe requests and notification emails. </param>
/// <param name="schedule"> Schedule of the scheduled action. </param>
/// <param name="scope"> 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. </param>
/// <param name="status"> Status of the scheduled action. </param>
/// <param name="viewId"> Cost analysis viewId used for scheduled action. For example, '/providers/Microsoft.CostManagement/views/swaggerExample'. </param>
/// <param name="eTag"> 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. </param>
/// <param name="kind"> Kind of the scheduled action. </param>
/// <returns> A new <see cref="CostManagement.ScheduledActionData"/> instance for mocking. </returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public static ScheduledActionData ScheduledActionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IEnumerable<ScheduledActionFileFormat> 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);
}
}
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// The operation to run an export.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Exports_Execute</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2023-03-01</description>
/// </item>
/// <item>
/// <term>Resource</term>
/// <description><see cref="CostManagementExportResource"/></description>
/// </item>
/// </list>
/// </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task<Response> ExecuteAsync(CancellationToken cancellationToken = default)
=> await ExecuteAsync(null, cancellationToken).ConfigureAwait(false);

/// <summary>
/// The operation to run an export.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>Exports_Execute</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2023-03-01</description>
/// </item>
/// <item>
/// <term>Resource</term>
/// <description><see cref="CostManagementExportResource"/></description>
/// </item>
/// </list>
/// </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual Response Execute(CancellationToken cancellationToken = default)
=> Execute(null, cancellationToken);
}
}
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// 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.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PriceSheet_DownloadByBillingProfile</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2023-03-01</description>
/// </item>
/// </list>
/// </summary>
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
/// <param name="billingAccountName"> The ID that uniquely identifies a billing account. </param>
/// <param name="billingProfileName"> The ID that uniquely identifies a billing profile. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="billingAccountName"/> or <paramref name="billingProfileName"/> is an empty string, and was expected to be non-empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="billingAccountName"/> or <paramref name="billingProfileName"/> is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task<ArmOperation<DownloadURL>> 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<DownloadURL>(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;
}
}

/// <summary>
/// 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.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PriceSheet_DownloadByBillingProfile</description>
/// </item>
/// <item>
/// <term>Default Api Version</term>
/// <description>2023-03-01</description>
/// </item>
/// </list>
/// </summary>
/// <param name="waitUntil"> <see cref="WaitUntil.Completed"/> if the method should wait to return until the long-running operation has completed on the service; <see cref="WaitUntil.Started"/> if it should return after starting the operation. For more information on long-running operations, please see <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/LongRunningOperations.md"> Azure.Core Long-Running Operation samples</see>. </param>
/// <param name="billingAccountName"> The ID that uniquely identifies a billing account. </param>
/// <param name="billingProfileName"> The ID that uniquely identifies a billing profile. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="billingAccountName"/> or <paramref name="billingProfileName"/> is an empty string, and was expected to be non-empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="billingAccountName"/> or <paramref name="billingProfileName"/> is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual ArmOperation<DownloadURL> 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<DownloadURL>(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;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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
{
}
}
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary> 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). </summary>
public IList<string> Columns
{
get
{
if (Configuration is null)
Configuration = new ExportDatasetConfiguration();
return Configuration.Columns;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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
{
}
}
Original file line number Diff line number Diff line change
@@ -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
{
}
}
Loading
Loading