Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR Microsoft.Azure.Management.Consumption] Fix json format by prettier #429

Closed
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
Expand Up @@ -55,15 +55,30 @@ internal ChargesOperations(ConsumptionManagementClient client)
/// <see href="https://docs.microsoft.com/en-us/rest/api/consumption/" />
/// </summary>
/// <param name='scope'>
/// The scope associated with usage details operations. This includes
/// The scope associated with charges operations. This includes
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
/// for Department scope and
/// for Department scope, and
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
/// for EnrollmentAccount scope. For department and enrollment accounts, you
/// can also add billing period to the scope using
/// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g.
/// to specify billing period at department scope use
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'.
/// Also, Modern Commerce Account scopes are
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// billingAccount scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
/// for billingProfile scope,
/// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope, and
/// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
/// specific for partners.
/// </param>
/// <param name='startDate'>
/// Start date
/// </param>
/// <param name='endDate'>
/// End date
/// </param>
/// <param name='filter'>
/// May be used to filter charges by properties/usageEnd (Utc time),
Expand All @@ -72,6 +87,12 @@ internal ChargesOperations(ConsumptionManagementClient client)
/// Tag filter is a key value pair string where key and value is separated by a
/// colon (:).
/// </param>
/// <param name='apply'>
/// May be used to group charges for billingAccount scope by
/// properties/billingProfileId, properties/invoiceSectionId,
/// properties/customerId (specific for Partner Led), or for billingProfile
/// scope by properties/invoiceSectionId.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -93,7 +114,7 @@ internal ChargesOperations(ConsumptionManagementClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<ChargeSummary>> ListByScopeWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<ChargesListResult>> ListWithHttpMessagesAsync(string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (scope == null)
{
Expand All @@ -111,9 +132,12 @@ internal ChargesOperations(ConsumptionManagementClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("scope", scope);
tracingParameters.Add("startDate", startDate);
tracingParameters.Add("endDate", endDate);
tracingParameters.Add("filter", filter);
tracingParameters.Add("apply", apply);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByScope", tracingParameters);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
Expand All @@ -124,10 +148,22 @@ internal ChargesOperations(ConsumptionManagementClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (startDate != null)
{
_queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate)));
}
if (endDate != null)
{
_queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate)));
}
if (filter != null)
{
_queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
}
if (apply != null)
{
_queryParameters.Add(string.Format("$apply={0}", System.Uri.EscapeDataString(apply)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
Expand Down Expand Up @@ -216,7 +252,7 @@ internal ChargesOperations(ConsumptionManagementClient client)
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<ChargeSummary>();
var _result = new AzureOperationResponse<ChargesListResult>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
Expand All @@ -229,7 +265,7 @@ internal ChargesOperations(ConsumptionManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<ChargeSummary>(_responseContent, Client.DeserializationSettings);
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<ChargesListResult>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,30 @@ public static partial class ChargesOperationsExtensions
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with usage details operations. This includes
/// The scope associated with charges operations. This includes
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
/// for Department scope and
/// for Department scope, and
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
/// for EnrollmentAccount scope. For department and enrollment accounts, you
/// can also add billing period to the scope using
/// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g.
/// to specify billing period at department scope use
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'.
/// Also, Modern Commerce Account scopes are
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// billingAccount scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
/// for billingProfile scope,
/// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope, and
/// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
/// specific for partners.
/// </param>
/// <param name='startDate'>
/// Start date
/// </param>
/// <param name='endDate'>
/// End date
/// </param>
/// <param name='filter'>
/// May be used to filter charges by properties/usageEnd (Utc time),
Expand All @@ -46,9 +61,15 @@ public static partial class ChargesOperationsExtensions
/// Tag filter is a key value pair string where key and value is separated by a
/// colon (:).
/// </param>
public static ChargeSummary ListByScope(this IChargesOperations operations, string scope, string filter = default(string))
/// <param name='apply'>
/// May be used to group charges for billingAccount scope by
/// properties/billingProfileId, properties/invoiceSectionId,
/// properties/customerId (specific for Partner Led), or for billingProfile
/// scope by properties/invoiceSectionId.
/// </param>
public static ChargesListResult List(this IChargesOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string))
{
return operations.ListByScopeAsync(scope, filter).GetAwaiter().GetResult();
return operations.ListAsync(scope, startDate, endDate, filter, apply).GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -59,15 +80,30 @@ public static partial class ChargesOperationsExtensions
/// The operations group for this extension method.
/// </param>
/// <param name='scope'>
/// The scope associated with usage details operations. This includes
/// The scope associated with charges operations. This includes
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
/// for Department scope and
/// for Department scope, and
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
/// for EnrollmentAccount scope. For department and enrollment accounts, you
/// can also add billing period to the scope using
/// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g.
/// to specify billing period at department scope use
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'.
/// Also, Modern Commerce Account scopes are
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
/// billingAccount scope,
/// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
/// for billingProfile scope,
/// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
/// for invoiceSection scope, and
/// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
/// specific for partners.
/// </param>
/// <param name='startDate'>
/// Start date
/// </param>
/// <param name='endDate'>
/// End date
/// </param>
/// <param name='filter'>
/// May be used to filter charges by properties/usageEnd (Utc time),
Expand All @@ -76,12 +112,18 @@ public static partial class ChargesOperationsExtensions
/// Tag filter is a key value pair string where key and value is separated by a
/// colon (:).
/// </param>
/// <param name='apply'>
/// May be used to group charges for billingAccount scope by
/// properties/billingProfileId, properties/invoiceSectionId,
/// properties/customerId (specific for Partner Led), or for billingProfile
/// scope by properties/invoiceSectionId.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ChargeSummary> ListByScopeAsync(this IChargesOperations operations, string scope, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<ChargesListResult> ListAsync(this IChargesOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListByScopeWithHttpMessagesAsync(scope, filter, null, cancellationToken).ConfigureAwait(false))
using (var _result = await operations.ListWithHttpMessagesAsync(scope, startDate, endDate, filter, apply, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public partial class ConsumptionManagementClient : ServiceClient<ConsumptionMana

/// <summary>
/// Version of the API to be used with the client request. The current version
/// is 2019-04-01-preview.
/// is 2019-10-01.
/// </summary>
public string ApiVersion { get; private set; }

Expand Down Expand Up @@ -121,6 +121,11 @@ public partial class ConsumptionManagementClient : ServiceClient<ConsumptionMana
/// </summary>
public virtual IReservationRecommendationsOperations ReservationRecommendations { get; private set; }

/// <summary>
/// Gets the IReservationTransactionsOperations.
/// </summary>
public virtual IReservationTransactionsOperations ReservationTransactions { get; private set; }

/// <summary>
/// Gets the IPriceSheetOperations.
/// </summary>
Expand All @@ -141,6 +146,21 @@ public partial class ConsumptionManagementClient : ServiceClient<ConsumptionMana
/// </summary>
public virtual IAggregatedCostOperations AggregatedCost { get; private set; }

/// <summary>
/// Gets the IEventsOperations.
/// </summary>
public virtual IEventsOperations Events { get; private set; }

/// <summary>
/// Gets the ILotsOperations.
/// </summary>
public virtual ILotsOperations Lots { get; private set; }

/// <summary>
/// Gets the ICreditsOperations.
/// </summary>
public virtual ICreditsOperations Credits { get; private set; }

/// <summary>
/// Initializes a new instance of the ConsumptionManagementClient class.
/// </summary>
Expand Down Expand Up @@ -391,12 +411,16 @@ private void Initialize()
ReservationsSummaries = new ReservationsSummariesOperations(this);
ReservationsDetails = new ReservationsDetailsOperations(this);
ReservationRecommendations = new ReservationRecommendationsOperations(this);
ReservationTransactions = new ReservationTransactionsOperations(this);
PriceSheet = new PriceSheetOperations(this);
Forecasts = new ForecastsOperations(this);
Operations = new Operations(this);
AggregatedCost = new AggregatedCostOperations(this);
Events = new EventsOperations(this);
Lots = new LotsOperations(this);
Credits = new CreditsOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
ApiVersion = "2019-04-01-preview";
ApiVersion = "2019-10-01";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
Expand Down Expand Up @@ -426,6 +450,12 @@ private void Initialize()
new Iso8601TimeSpanConverter()
}
};
SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<UsageDetail>("kind"));
DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<UsageDetail>("kind"));
SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ReservationRecommendation>("kind"));
DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<ReservationRecommendation>("kind"));
SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter<ChargeSummary>("kind"));
DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter<ChargeSummary>("kind"));
CustomInitialize();
DeserializationSettings.Converters.Add(new TransformationJsonConverter());
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
Expand Down
Loading