/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { Balances } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { ConsumptionManagementClient } from "../consumptionManagementClient"; import { BalancesGetByBillingAccountOptionalParams, BalancesGetByBillingAccountResponse, BalancesGetForBillingPeriodByBillingAccountOptionalParams, BalancesGetForBillingPeriodByBillingAccountResponse } from "../models"; /** Class containing Balances operations. */ export class BalancesImpl implements Balances { private readonly client: ConsumptionManagementClient; /** * Initialize a new instance of the class Balances class. * @param client Reference to the service client */ constructor(client: ConsumptionManagementClient) { this.client = client; } /** * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May * 1, 2014 or later. * @param billingAccountId BillingAccount ID * @param options The options parameters. */ getByBillingAccount( billingAccountId: string, options?: BalancesGetByBillingAccountOptionalParams ): Promise { return this.client.sendOperationRequest( { billingAccountId, options }, getByBillingAccountOperationSpec ); } /** * Gets the balances for a scope by billing period and billingAccountId. Balances are available via * this API only for May 1, 2014 or later. * @param billingAccountId BillingAccount ID * @param billingPeriodName Billing Period Name. * @param options The options parameters. */ getForBillingPeriodByBillingAccount( billingAccountId: string, billingPeriodName: string, options?: BalancesGetForBillingPeriodByBillingAccountOptionalParams ): Promise { return this.client.sendOperationRequest( { billingAccountId, billingPeriodName, options }, getForBillingPeriodByBillingAccountOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const getByBillingAccountOperationSpec: coreClient.OperationSpec = { path: "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Balance }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.billingAccountId], headerParameters: [Parameters.accept], serializer }; const getForBillingPeriodByBillingAccountOperationSpec: coreClient.OperationSpec = { path: "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Balance }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.billingAccountId, Parameters.billingPeriodName ], headerParameters: [Parameters.accept], serializer };