UNPKG

appcenter-cli

Version:

Command line tool for Visual Studio App Center

246 lines (236 loc) 7.33 kB
/* * 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 { AzureSubscription } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { AppCenterClient } from "../appCenterClient"; import { AzureSubscriptionListForOrgOptionalParams, AzureSubscriptionListForOrgResponse, AzureSubscriptionListForUserOptionalParams, AzureSubscriptionListForUserResponse, AzureSubscriptionDeleteForAppOptionalParams, AzureSubscriptionListForAppOptionalParams, AzureSubscriptionListForAppResponse, AzureSubscriptionLinkForAppOptionalParams } from "../models"; /** Class containing AzureSubscription operations. */ export class AzureSubscriptionImpl implements AzureSubscription { private readonly client: AppCenterClient; /** * Initialize a new instance of the class AzureSubscription class. * @param client Reference to the service client */ constructor(client: AppCenterClient) { this.client = client; } /** * Returns a list of azure subscriptions for the organization * @param orgName The organization's name * @param options The options parameters. */ listForOrg( orgName: string, options?: AzureSubscriptionListForOrgOptionalParams ): Promise<AzureSubscriptionListForOrgResponse> { return this.client.sendOperationRequest( { orgName, options }, listForOrgOperationSpec ); } /** * Returns a list of azure subscriptions for the user * @param options The options parameters. */ listForUser( options?: AzureSubscriptionListForUserOptionalParams ): Promise<AzureSubscriptionListForUserResponse> { return this.client.sendOperationRequest( { options }, listForUserOperationSpec ); } /** * Delete the azure subscriptions for the app * @param azureSubscriptionId The unique ID (UUID) of the azure subscription * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ deleteForApp( azureSubscriptionId: string, ownerName: string, appName: string, options?: AzureSubscriptionDeleteForAppOptionalParams ): Promise<void> { return this.client.sendOperationRequest( { azureSubscriptionId, ownerName, appName, options }, deleteForAppOperationSpec ); } /** * Returns a list of azure subscriptions for the app * @param ownerName The name of the owner * @param appName The name of the application * @param options The options parameters. */ listForApp( ownerName: string, appName: string, options?: AzureSubscriptionListForAppOptionalParams ): Promise<AzureSubscriptionListForAppResponse> { return this.client.sendOperationRequest( { ownerName, appName, options }, listForAppOperationSpec ); } /** * Link azure subscription to an app * @param ownerName The name of the owner * @param appName The name of the application * @param subscriptionId The azure subscription id * @param options The options parameters. */ linkForApp( ownerName: string, appName: string, subscriptionId: string, options?: AzureSubscriptionLinkForAppOptionalParams ): Promise<void> { return this.client.sendOperationRequest( { ownerName, appName, subscriptionId, options }, linkForAppOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listForOrgOperationSpec: coreClient.OperationSpec = { path: "/v0.1/orgs/{org_name}/azure_subscriptions", httpMethod: "GET", responses: { 200: { bodyMapper: { type: { name: "Sequence", element: { type: { name: "Composite", className: "Paths1R8N8WnV01OrgsOrgNameAzureSubscriptionsGetResponses200ContentApplicationJsonSchemaItems" } } } } }, default: { bodyMapper: Mappers.Paths1Ocwvn4V01OrgsOrgNameAzureSubscriptionsGetResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [Parameters.$host, Parameters.orgName], headerParameters: [Parameters.accept], serializer }; const listForUserOperationSpec: coreClient.OperationSpec = { path: "/v0.1/azure_subscriptions", httpMethod: "GET", responses: { 200: { bodyMapper: { type: { name: "Sequence", element: { type: { name: "Composite", className: "Paths1Wv9DecV01AzureSubscriptionsGetResponses200ContentApplicationJsonSchemaItems" } } } } }, default: { bodyMapper: Mappers.PathsSing2IV01AzureSubscriptionsGetResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [Parameters.$host], headerParameters: [Parameters.accept], serializer }; const deleteForAppOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/azure_subscriptions/{azure_subscription_id}", httpMethod: "DELETE", responses: { 204: {}, default: { bodyMapper: Mappers.PathsG46OulV01AppsOwnerNameAppNameAzureSubscriptionsAzureSubscriptionIdDeleteResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [ Parameters.$host, Parameters.ownerName, Parameters.appName, Parameters.azureSubscriptionId ], headerParameters: [Parameters.accept], serializer }; const listForAppOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/azure_subscriptions", httpMethod: "GET", responses: { 200: { bodyMapper: { type: { name: "Sequence", element: { type: { name: "Composite", className: "PathsZl5LyeV01AppsOwnerNameAppNameAzureSubscriptionsGetResponses200ContentApplicationJsonSchemaItems" } } } } }, default: { bodyMapper: Mappers.PathsYyfq7IV01AppsOwnerNameAppNameAzureSubscriptionsGetResponsesDefaultContentApplicationJsonSchema } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.accept], serializer }; const linkForAppOperationSpec: coreClient.OperationSpec = { path: "/v0.1/apps/{owner_name}/{app_name}/azure_subscriptions", httpMethod: "POST", responses: { 204: {}, default: { bodyMapper: Mappers.PathsIlp5CpV01AppsOwnerNameAppNameAzureSubscriptionsPostResponsesDefaultContentApplicationJsonSchema } }, requestBody: { parameterPath: { subscriptionId: ["subscriptionId"] }, mapper: { ...Mappers.Paths11GzlnuV01AppsOwnerNameAppNameAzureSubscriptionsPostRequestbodyContentApplicationJsonSchema, required: true } }, urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer };