appcenter-cli
Version:
Command line tool for Visual Studio App Center
182 lines (181 loc) • 6.71 kB
JavaScript
;
/*
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AzureSubscriptionImpl = void 0;
const coreClient = require("@azure/core-client");
const Mappers = require("../models/mappers");
const Parameters = require("../models/parameters");
/** Class containing AzureSubscription operations. */
class AzureSubscriptionImpl {
/**
* Initialize a new instance of the class AzureSubscription class.
* @param client Reference to the service client
*/
constructor(client) {
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, options) {
return this.client.sendOperationRequest({ orgName, options }, listForOrgOperationSpec);
}
/**
* Returns a list of azure subscriptions for the user
* @param options The options parameters.
*/
listForUser(options) {
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, ownerName, appName, options) {
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, appName, options) {
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, appName, subscriptionId, options) {
return this.client.sendOperationRequest({ ownerName, appName, subscriptionId, options }, linkForAppOperationSpec);
}
}
exports.AzureSubscriptionImpl = AzureSubscriptionImpl;
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listForOrgOperationSpec = {
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 = {
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 = {
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 = {
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 = {
path: "/v0.1/apps/{owner_name}/{app_name}/azure_subscriptions",
httpMethod: "POST",
responses: {
204: {},
default: {
bodyMapper: Mappers.PathsIlp5CpV01AppsOwnerNameAppNameAzureSubscriptionsPostResponsesDefaultContentApplicationJsonSchema
}
},
requestBody: {
parameterPath: { subscriptionId: ["subscriptionId"] },
mapper: Object.assign(Object.assign({}, Mappers.Paths11GzlnuV01AppsOwnerNameAppNameAzureSubscriptionsPostRequestbodyContentApplicationJsonSchema), { required: true })
},
urlParameters: [Parameters.$host, Parameters.ownerName, Parameters.appName],
headerParameters: [Parameters.contentType, Parameters.accept],
mediaType: "json",
serializer
};