Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Merged
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace Microsoft.Azure.Management.CostManagement
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// Extension methods for BudgetOperations.
/// </summary>
public static partial class BudgetOperationsExtensions
{
/// <summary>
/// Gets the budget for the scope by budget name.
/// <see href="https://docs.microsoft.com/en-us/rest/api/cost-management/" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with budget operations. This includes
/// '/subscriptions/{subscriptionId}/' for subscription scope,
/// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
/// resourceGroup scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// Billing Account scope,
/// '/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}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope.
/// </param>
/// <param name='budgetName'>
/// Budget Name.
/// </param>
public static BudgetModel Get(this IBudgetOperations operations, string scope, string budgetName)
{
return operations.GetAsync(scope, budgetName).GetAwaiter().GetResult();
}

/// <summary>
/// Gets the budget for the scope by budget name.
/// <see href="https://docs.microsoft.com/en-us/rest/api/cost-management/" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with budget operations. This includes
/// '/subscriptions/{subscriptionId}/' for subscription scope,
/// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
/// resourceGroup scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// Billing Account scope,
/// '/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}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope.
/// </param>
/// <param name='budgetName'>
/// Budget Name.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<BudgetModel> GetAsync(this IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// The operation to create or update a budget. Update operation requires
/// latest eTag to be set in the request mandatorily. You may obtain the latest
/// eTag by performing a get operation. Create operation does not require eTag.
/// <see href="https://docs.microsoft.com/en-us/rest/api/cost-management/" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with budget operations. This includes
/// '/subscriptions/{subscriptionId}/' for subscription scope,
/// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
/// resourceGroup scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// Billing Account scope,
/// '/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}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope.
/// </param>
/// <param name='budgetName'>
/// Budget Name.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Budget operation.
/// </param>
public static BudgetModel CreateOrUpdate(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel))
{
return operations.CreateOrUpdateAsync(scope, budgetName, parameters).GetAwaiter().GetResult();
}

/// <summary>
/// The operation to create or update a budget. Update operation requires
/// latest eTag to be set in the request mandatorily. You may obtain the latest
/// eTag by performing a get operation. Create operation does not require eTag.
/// <see href="https://docs.microsoft.com/en-us/rest/api/cost-management/" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with budget operations. This includes
/// '/subscriptions/{subscriptionId}/' for subscription scope,
/// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
/// resourceGroup scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// Billing Account scope,
/// '/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}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope.
/// </param>
/// <param name='budgetName'>
/// Budget Name.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Budget operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<BudgetModel> CreateOrUpdateAsync(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, budgetName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// The operation to delete a budget.
/// <see href="https://docs.microsoft.com/en-us/rest/api/cost-management/" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with budget operations. This includes
/// '/subscriptions/{subscriptionId}/' for subscription scope,
/// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
/// resourceGroup scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// Billing Account scope,
/// '/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}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope.
/// </param>
/// <param name='budgetName'>
/// Budget Name.
/// </param>
public static void Delete(this IBudgetOperations operations, string scope, string budgetName)
{
operations.DeleteAsync(scope, budgetName).GetAwaiter().GetResult();
}

/// <summary>
/// The operation to delete a budget.
/// <see href="https://docs.microsoft.com/en-us/rest/api/cost-management/" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with budget operations. This includes
/// '/subscriptions/{subscriptionId}/' for subscription scope,
/// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
/// resourceGroup scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// Billing Account scope,
/// '/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}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope.
/// </param>
/// <param name='budgetName'>
/// Budget Name.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteAsync(this IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}

}
}
Loading