Skip to content
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
Expand Up @@ -14,16 +14,17 @@ namespace Microsoft.Azure.Management.DevTestLabs
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Azure.OData;
using Microsoft.Rest.Azure;
using Models;

/// <summary>
/// Extension methods for CostSettingOperations.
/// Extension methods for CostInsightOperations.
/// </summary>
public static partial class CostSettingOperationsExtensions
public static partial class CostInsightOperationsExtensions
{
/// <summary>
/// Get cost setting.
/// List cost insights.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -34,16 +35,16 @@ public static partial class CostSettingOperationsExtensions
/// <param name='labName'>
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// <param name='odataQuery'>
/// OData parameters to apply to the operation.
/// </param>
public static CostSetting GetResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name)
public static IPage<CostInsight> List(this ICostInsightOperations operations, string resourceGroupName, string labName, ODataQuery<CostInsight> odataQuery = default(ODataQuery<CostInsight>))
{
return Task.Factory.StartNew(s => ((ICostSettingOperations)s).GetResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return Task.Factory.StartNew(s => ((ICostInsightOperations)s).ListAsync(resourceGroupName, labName, odataQuery), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}

/// <summary>
/// Get cost setting.
/// List cost insights.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -54,22 +55,22 @@ public static CostSetting GetResource(this ICostSettingOperations operations, st
/// <param name='labName'>
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// <param name='odataQuery'>
/// OData parameters to apply to the operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<CostSetting> GetResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<IPage<CostInsight>> ListAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, ODataQuery<CostInsight> odataQuery = default(ODataQuery<CostInsight>), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, labName, odataQuery, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Create or replace an existing cost setting.
/// Get cost insight.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -81,17 +82,15 @@ public static CostSetting GetResource(this ICostSettingOperations operations, st
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// </param>
/// <param name='costSetting'>
/// The name of the cost insight.
/// </param>
public static CostSetting CreateOrUpdateResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting)
public static CostInsight GetResource(this ICostInsightOperations operations, string resourceGroupName, string labName, string name)
{
return Task.Factory.StartNew(s => ((ICostSettingOperations)s).CreateOrUpdateResourceAsync(resourceGroupName, labName, name, costSetting), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
return Task.Factory.StartNew(s => ((ICostInsightOperations)s).GetResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}

/// <summary>
/// Create or replace an existing cost setting.
/// Get cost insight.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -103,23 +102,22 @@ public static CostSetting CreateOrUpdateResource(this ICostSettingOperations ope
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// </param>
/// <param name='costSetting'>
/// The name of the cost insight.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<CostSetting> CreateOrUpdateResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<CostInsight> GetResourceAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateOrUpdateResourceWithHttpMessagesAsync(resourceGroupName, labName, name, costSetting, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.GetResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Delete cost setting.
/// Refresh Lab's Cost Insight Data. This operation can take a while to
/// complete.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -131,15 +129,16 @@ public static CostSetting CreateOrUpdateResource(this ICostSettingOperations ope
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// The name of the cost insight.
/// </param>
public static void DeleteResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name)
public static void RefreshData(this ICostInsightOperations operations, string resourceGroupName, string labName, string name)
{
Task.Factory.StartNew(s => ((ICostSettingOperations)s).DeleteResourceAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
Task.Factory.StartNew(s => ((ICostInsightOperations)s).RefreshDataAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}

/// <summary>
/// Delete cost setting.
/// Refresh Lab's Cost Insight Data. This operation can take a while to
/// complete.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -151,18 +150,19 @@ public static void DeleteResource(this ICostSettingOperations operations, string
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// The name of the cost insight.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken))
public static async Task RefreshDataAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken))
{
await operations.DeleteResourceWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false);
await operations.RefreshDataWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Modify properties of cost settings.
/// Refresh Lab's Cost Insight Data. This operation can take a while to
/// complete.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -174,17 +174,16 @@ public static void DeleteResource(this ICostSettingOperations operations, string
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// </param>
/// <param name='costSetting'>
/// The name of the cost insight.
/// </param>
public static CostSetting PatchResource(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting)
public static void BeginRefreshData(this ICostInsightOperations operations, string resourceGroupName, string labName, string name)
{
return Task.Factory.StartNew(s => ((ICostSettingOperations)s).PatchResourceAsync(resourceGroupName, labName, name, costSetting), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
Task.Factory.StartNew(s => ((ICostInsightOperations)s).BeginRefreshDataAsync(resourceGroupName, labName, name), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}

/// <summary>
/// Modify properties of cost settings.
/// Refresh Lab's Cost Insight Data. This operation can take a while to
/// complete.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -196,16 +195,45 @@ public static CostSetting PatchResource(this ICostSettingOperations operations,
/// The name of the lab.
/// </param>
/// <param name='name'>
/// The name of the cost setting.
/// The name of the cost insight.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task BeginRefreshDataAsync(this ICostInsightOperations operations, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default(CancellationToken))
{
await operations.BeginRefreshDataWithHttpMessagesAsync(resourceGroupName, labName, name, null, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// List cost insights.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
public static IPage<CostInsight> ListNext(this ICostInsightOperations operations, string nextPageLink)
{
return Task.Factory.StartNew(s => ((ICostInsightOperations)s).ListNextAsync(nextPageLink), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
}

/// <summary>
/// List cost insights.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='costSetting'>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<CostSetting> PatchResourceAsync(this ICostSettingOperations operations, string resourceGroupName, string labName, string name, CostSetting costSetting, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<IPage<CostInsight>> ListNextAsync(this ICostInsightOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.PatchResourceWithHttpMessagesAsync(resourceGroupName, labName, name, costSetting, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Loading