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 reservations/resource-manager] [Hub Generated] Review request for Microsoft.Capacity to add version preview/2019-04-01 #2439

Merged
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
167 changes: 167 additions & 0 deletions sdk/reservations/arm-reservations/lib/azureReservationAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/*
* 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.
*/

import * as msRest from "@azure/ms-rest-js";
import * as Models from "./models";
import * as Mappers from "./models/mappers";
import * as Parameters from "./models/parameters";
import * as operations from "./operations";
import { AzureReservationAPIContext } from "./azureReservationAPIContext";


class AzureReservationAPI extends AzureReservationAPIContext {
// Operation groups
reservationOrder: operations.ReservationOrder;
reservation: operations.Reservation;
operation: operations.Operation;

/**
* Initializes a new instance of the AzureReservationAPI class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) {
super(credentials, options);
this.reservationOrder = new operations.ReservationOrder(this);
this.reservation = new operations.Reservation(this);
this.operation = new operations.Operation(this);
}

/**
* @summary Get the regions and skus that are available for RI purchase for the specified Azure
* subscription.
* @param subscriptionId Id of the subscription
* @param reservedResourceType The type of the resource for which the skus should be provided.
* @param [options] The optional parameters
* @returns Promise<Models.GetCatalogResponse>
*/
getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams): Promise<Models.GetCatalogResponse>;
/**
* @param subscriptionId Id of the subscription
* @param reservedResourceType The type of the resource for which the skus should be provided.
* @param callback The callback
*/
getCatalog(subscriptionId: string, reservedResourceType: string, callback: msRest.ServiceCallback<Models.Catalog[]>): void;
/**
* @param subscriptionId Id of the subscription
* @param reservedResourceType The type of the resource for which the skus should be provided.
* @param options The optional parameters
* @param callback The callback
*/
getCatalog(subscriptionId: string, reservedResourceType: string, options: Models.AzureReservationAPIGetCatalogOptionalParams, callback: msRest.ServiceCallback<Models.Catalog[]>): void;
getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams | msRest.ServiceCallback<Models.Catalog[]>, callback?: msRest.ServiceCallback<Models.Catalog[]>): Promise<Models.GetCatalogResponse> {
return this.sendOperationRequest(
{
subscriptionId,
reservedResourceType,
options
},
getCatalogOperationSpec,
callback) as Promise<Models.GetCatalogResponse>;
}

/**
* Get applicable `Reservation`s that are applied to this subscription.
* @summary Get list of applicable `Reservation`s.
* @param subscriptionId Id of the subscription
* @param [options] The optional parameters
* @returns Promise<Models.GetAppliedReservationListResponse>
*/
getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise<Models.GetAppliedReservationListResponse>;
/**
* @param subscriptionId Id of the subscription
* @param callback The callback
*/
getAppliedReservationList(subscriptionId: string, callback: msRest.ServiceCallback<Models.AppliedReservations>): void;
/**
* @param subscriptionId Id of the subscription
* @param options The optional parameters
* @param callback The callback
*/
getAppliedReservationList(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.AppliedReservations>): void;
getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.AppliedReservations>, callback?: msRest.ServiceCallback<Models.AppliedReservations>): Promise<Models.GetAppliedReservationListResponse> {
return this.sendOperationRequest(
{
subscriptionId,
options
},
getAppliedReservationListOperationSpec,
callback) as Promise<Models.GetAppliedReservationListResponse>;
}
}

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const getCatalogOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs",
urlParameters: [
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion,
Parameters.reservedResourceType,
Parameters.location
],
headerParameters: [
Parameters.acceptLanguage
],
responses: {
200: {
bodyMapper: {
serializedName: "parsedResponse",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "Catalog"
}
}
}
}
},
default: {
bodyMapper: Mappers.ErrorModel
}
},
serializer
};

const getAppliedReservationListOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations",
urlParameters: [
Parameters.subscriptionId
],
queryParameters: [
Parameters.apiVersion
],
headerParameters: [
Parameters.acceptLanguage
],
responses: {
200: {
bodyMapper: Mappers.AppliedReservations
},
default: {
bodyMapper: Mappers.ErrorModel
}
},
serializer
};

export {
AzureReservationAPI,
AzureReservationAPIContext,
Models as AzureReservationAPIModels,
Mappers as AzureReservationAPIMappers
};
export * from "./operations";
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.
*/

import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";

const packageName = "@azure/arm-reservations";
const packageVersion = "2.3.0";

export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials;
apiVersion?: string;

/**
* Initializes a new instance of the AzureReservationAPI class.
* @param credentials Credentials needed for the client to connect to Azure.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) {
if (credentials == undefined) {
throw new Error('\'credentials\' cannot be null.');
}

if (!options) {
options = {};
}
if(!options.userAgent) {
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}

super(credentials, options);

this.apiVersion = '2019-04-01';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
this.requestContentType = "application/json; charset=utf-8";
this.credentials = credentials;

if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
}
}
Loading