diff --git a/sdk/managedapplications/arm-managedapplications/README.md b/sdk/managedapplications/arm-managedapplications/README.md index 061485d89b70..2938145b0626 100644 --- a/sdk/managedapplications/arm-managedapplications/README.md +++ b/sdk/managedapplications/arm-managedapplications/README.md @@ -1,6 +1,6 @@ -## Azure ManagedApplicationClient SDK for JavaScript +## Azure SubscriptionClient SDK for JavaScript -This package contains an isomorphic SDK for ManagedApplicationClient. +This package contains an isomorphic SDK for SubscriptionClient. ### Currently supported environments @@ -15,7 +15,7 @@ npm install @azure/arm-managedapplications ### How to use -#### nodejs - Authentication, client creation and listOperations as an example written in TypeScript. +#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth @@ -29,12 +29,12 @@ npm install @azure/ms-rest-nodeauth import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { ManagedApplicationClient, ManagedApplicationModels, ManagedApplicationMappers } from "@azure/arm-managedapplications"; +import { SubscriptionClient, SubscriptionModels, SubscriptionMappers } from "@azure/arm-managedapplications"; const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new ManagedApplicationClient(creds, subscriptionId); - client.listOperations().then((result) => { + const client = new SubscriptionClient(creds, subscriptionId); + client.operations.list().then((result) => { console.log("The result is:"); console.log(result); }); @@ -43,7 +43,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### browser - Authentication, client creation and listOperations as an example written in JavaScript. +#### browser - Authentication, client creation and list operations as an example written in JavaScript. ##### Install @azure/ms-rest-browserauth @@ -76,8 +76,8 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to // may cause redirects authManager.login(); } - const client = new Azure.ArmManagedapplications.ManagedApplicationClient(res.creds, subscriptionId); - client.listOperations().then((result) => { + const client = new Azure.ArmManagedapplications.SubscriptionClient(res.creds, subscriptionId); + client.operations.list().then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { diff --git a/sdk/managedapplications/arm-managedapplications/package.json b/sdk/managedapplications/arm-managedapplications/package.json index 6c4deac44c4b..4f1ca5b1faf6 100644 --- a/sdk/managedapplications/arm-managedapplications/package.json +++ b/sdk/managedapplications/arm-managedapplications/package.json @@ -1,12 +1,12 @@ { "name": "@azure/arm-managedapplications", "author": "Microsoft Corporation", - "description": "ManagedApplicationClient Library with typescript type definitions for node.js and browser.", + "description": "SubscriptionClient Library with typescript type definitions for node.js and browser.", "version": "1.0.2", "dependencies": { - "@azure/ms-rest-azure-js": "^1.3.2", - "@azure/ms-rest-js": "^1.8.1", - "tslib": "^1.9.3" + "@azure/ms-rest-azure-js": "^2.0.0", + "@azure/ms-rest-js": "^2.0.3", + "tslib": "^1.10.0" }, "keywords": [ "node", @@ -17,8 +17,8 @@ ], "license": "MIT", "main": "./dist/arm-managedapplications.js", - "module": "./esm/managedApplicationClient.js", - "types": "./esm/managedApplicationClient.d.ts", + "module": "./esm/subscriptionClient.js", + "types": "./esm/subscriptionClient.d.ts", "devDependencies": { "typescript": "^3.1.1", "rollup": "^0.66.2", diff --git a/sdk/managedapplications/arm-managedapplications/rollup.config.js b/sdk/managedapplications/arm-managedapplications/rollup.config.js index 24a2779acf2e..7b9b3b82ca67 100644 --- a/sdk/managedapplications/arm-managedapplications/rollup.config.js +++ b/sdk/managedapplications/arm-managedapplications/rollup.config.js @@ -6,7 +6,7 @@ import sourcemaps from "rollup-plugin-sourcemaps"; * @type {rollup.RollupFileOptions} */ const config = { - input: "./esm/managedApplicationClient.js", + input: "./esm/subscriptionClient.js", external: [ "@azure/ms-rest-js", "@azure/ms-rest-azure-js" diff --git a/sdk/managedapplications/arm-managedapplications/src/models/index.ts b/sdk/managedapplications/arm-managedapplications/src/models/index.ts index 28e979a00944..632f861d0877 100644 --- a/sdk/managedapplications/arm-managedapplications/src/models/index.ts +++ b/sdk/managedapplications/arm-managedapplications/src/models/index.ts @@ -12,321 +12,137 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; /** - * Plan for the appliance. + * Location information. */ -export interface Plan { +export interface Location { /** - * The plan name. - */ - name: string; - /** - * The publisher ID. - */ - publisher: string; - /** - * The product code. - */ - product: string; - /** - * The promotion code. - */ - promotionCode?: string; - /** - * The plan's version. - */ - version: string; -} - -/** - * Resource information. - */ -export interface Resource extends BaseResource { - /** - * Resource ID + * The fully qualified ID of the location. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * Resource name + * The subscription ID. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly name?: string; + readonly subscriptionId?: string; /** - * Resource type + * The location name. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly type?: string; - /** - * Resource location - */ - location?: string; - /** - * Resource tags - */ - tags?: { [propertyName: string]: string }; -} - -/** - * Resource information. - */ -export interface GenericResource extends Resource { - /** - * ID of the resource that manages this resource. - */ - managedBy?: string; - /** - * The SKU of the resource. - */ - sku?: Sku; - /** - * The identity of the resource. - */ - identity?: Identity; -} - -/** - * Information about appliance. - */ -export interface Appliance extends GenericResource { - /** - * The managed resource group Id. - */ - managedResourceGroupId: string; - /** - * The fully qualified path of appliance definition Id. - */ - applianceDefinitionId?: string; - /** - * Name and value pairs that define the appliance parameters. It can be a JObject or a well - * formed JSON string. - */ - parameters?: any; + readonly name?: string; /** - * Name and value pairs that define the appliance outputs. + * The display name of the location. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly outputs?: any; + readonly displayName?: string; /** - * The appliance provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', - * 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' + * The latitude of the location. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly provisioningState?: ProvisioningState; - /** - * The blob URI where the UI definition file is located. - */ - uiDefinitionUri?: string; - /** - * The plan information. - */ - plan?: Plan; - /** - * The kind of the appliance. Allowed values are MarketPlace and ServiceCatalog. - */ - kind?: string; -} - -/** - * Plan for the appliance. - */ -export interface PlanPatchable { - /** - * The plan name. - */ - name?: string; + readonly latitude?: string; /** - * The publisher ID. - */ - publisher?: string; - /** - * The product code. - */ - product?: string; - /** - * The promotion code. - */ - promotionCode?: string; - /** - * The plan's version. + * The longitude of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - version?: string; + readonly longitude?: string; } /** - * Information about appliance. + * Subscription policies. */ -export interface AppliancePatchable extends GenericResource { - /** - * The managed resource group Id. - */ - managedResourceGroupId?: string; +export interface SubscriptionPolicies { /** - * The fully qualified path of appliance definition Id. - */ - applianceDefinitionId?: string; - /** - * Name and value pairs that define the appliance parameters. It can be a JObject or a well - * formed JSON string. - */ - parameters?: any; - /** - * Name and value pairs that define the appliance outputs. + * The subscription location placement ID. The ID indicates which regions are visible for a + * subscription. For example, a subscription with a location placement Id of Public_2014-09-01 + * has access to Azure public regions. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly outputs?: any; + readonly locationPlacementId?: string; /** - * The appliance provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', - * 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' + * The subscription quota ID. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly provisioningState?: ProvisioningState; - /** - * The blob URI where the UI definition file is located. - */ - uiDefinitionUri?: string; + readonly quotaId?: string; /** - * The plan information. - */ - plan?: PlanPatchable; - /** - * The kind of the appliance. Allowed values are MarketPlace and ServiceCatalog. - */ - kind?: string; -} - -/** - * The appliance provider authorization. - */ -export interface ApplianceProviderAuthorization { - /** - * The provider's principal identifier. This is the identity that the provider will use to call - * ARM to manage the appliance resources. - */ - principalId: string; - /** - * The provider's role definition identifier. This role will define all the permissions that the - * provider must have on the appliance's container resource group. This role definition cannot - * have permission to delete the resource group. + * The subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff' + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - roleDefinitionId: string; + readonly spendingLimit?: SpendingLimit; } /** - * Appliance artifact. + * Information about a tenant managing the subscription. */ -export interface ApplianceArtifact { - /** - * The appliance artifact name. - */ - name?: string; - /** - * The appliance artifact blob uri. - */ - uri?: string; +export interface ManagedByTenant { /** - * The the appliance artifact type. Possible values include: 'Template', 'Custom' + * The tenant ID of the managing tenant. This is a GUID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - type?: ApplianceArtifactType; + readonly tenantId?: string; } /** - * Information about appliance definition. + * Subscription information. */ -export interface ApplianceDefinition extends GenericResource { +export interface Subscription { /** - * The appliance lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None' - */ - lockLevel: ApplianceLockLevel; - /** - * The appliance definition display name. - */ - displayName?: string; - /** - * The appliance provider authorizations. - */ - authorizations: ApplianceProviderAuthorization[]; - /** - * The collection of appliance artifacts. The portal will use the files specified as artifacts to - * construct the user experience of creating an appliance from an appliance definition. - */ - artifacts?: ApplianceArtifact[]; - /** - * The appliance definition description. + * The fully qualified ID for the subscription. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - description?: string; + readonly id?: string; /** - * The appliance definition package file Uri. + * The subscription ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - packageFileUri: string; -} - -/** - * SKU for the resource. - */ -export interface Sku { + readonly subscriptionId?: string; /** - * The SKU name. + * The subscription display name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - name: string; + readonly displayName?: string; /** - * The SKU tier. + * The subscription tenant ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - tier?: string; + readonly tenantId?: string; /** - * The SKU size. + * The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + * Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - size?: string; + readonly state?: SubscriptionState; /** - * The SKU family. + * The subscription policies. */ - family?: string; + subscriptionPolicies?: SubscriptionPolicies; /** - * The SKU model. + * The authorization source of the request. Valid values are one or more combinations of Legacy, + * RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. */ - model?: string; + authorizationSource?: string; /** - * The SKU capacity. + * An array containing the tenants managing the subscription. */ - capacity?: number; + managedByTenants?: ManagedByTenant[]; } /** - * Identity for the resource. + * Tenant Id information. */ -export interface Identity { +export interface TenantIdDescription { /** - * The principal ID of resource identity. + * The fully qualified ID of the tenant. For example, + * /tenants/00000000-0000-0000-0000-000000000000. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly principalId?: string; + readonly id?: string; /** - * The tenant ID of resource. + * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly tenantId?: string; - /** - * The identity type. Possible values include: 'SystemAssigned' - */ - type?: ResourceIdentityType; -} - -/** - * Error response indicates ARM appliance is not able to process the incoming request. The reason - * is provided in the error message. - */ -export interface ErrorResponse { - /** - * Http status code. - */ - httpStatus?: string; - /** - * Error code. - */ - errorCode?: string; - /** - * Error message indicating why the operation failed. - */ - errorMessage?: string; } /** @@ -334,7 +150,7 @@ export interface ErrorResponse { */ export interface OperationDisplay { /** - * Service provider: Microsoft.Solutions + * Service provider: Microsoft.Resources */ provider?: string; /** @@ -345,10 +161,14 @@ export interface OperationDisplay { * Operation type: Read, write, delete, etc. */ operation?: string; + /** + * Description of the operation. + */ + description?: string; } /** - * Microsoft.Solutions operation + * Microsoft.Resources operation */ export interface Operation { /** @@ -362,35 +182,15 @@ export interface Operation { } /** - * Optional Parameters. + * An interface representing SubscriptionClientOptions. */ -export interface AppliancesUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Parameters supplied to update an existing appliance. - */ - parameters?: Appliance; -} - -/** - * Optional Parameters. - */ -export interface AppliancesUpdateByIdOptionalParams extends msRest.RequestOptionsBase { - /** - * Parameters supplied to update an existing appliance. - */ - parameters?: Appliance; -} - -/** - * An interface representing ManagedApplicationClientOptions. - */ -export interface ManagedApplicationClientOptions extends AzureServiceClientOptions { +export interface SubscriptionClientOptions extends AzureServiceClientOptions { baseUri?: string; } /** * @interface - * Result of the request to list Microsoft.Solutions operations. It contains a list of operations + * Result of the request to list Microsoft.Resources operations. It contains a list of operations * and a URL link to get the next set of results. * @extends Array */ @@ -403,65 +203,56 @@ export interface OperationListResult extends Array { /** * @interface - * List of appliances. - * @extends Array + * Location list operation response. + * @extends Array */ -export interface ApplianceListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +export interface LocationListResult extends Array { } /** * @interface - * List of appliance definitions. - * @extends Array + * Subscription list operation response. + * @extends Array */ -export interface ApplianceDefinitionListResult extends Array { +export interface SubscriptionListResult extends Array { /** - * The URL to use for getting the next set of results. + * The URL to get the next set of results. */ - nextLink?: string; + nextLink: string; } /** - * Defines values for ProvisioningState. - * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', - * 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - * @readonly - * @enum {string} - */ -export type ProvisioningState = 'Accepted' | 'Running' | 'Ready' | 'Creating' | 'Created' | 'Deleting' | 'Deleted' | 'Canceled' | 'Failed' | 'Succeeded' | 'Updating'; - -/** - * Defines values for ApplianceLockLevel. - * Possible values include: 'CanNotDelete', 'ReadOnly', 'None' - * @readonly - * @enum {string} + * @interface + * Tenant Ids information. + * @extends Array */ -export type ApplianceLockLevel = 'CanNotDelete' | 'ReadOnly' | 'None'; +export interface TenantListResult extends Array { + /** + * The URL to use for getting the next set of results. + */ + nextLink: string; +} /** - * Defines values for ApplianceArtifactType. - * Possible values include: 'Template', 'Custom' + * Defines values for SubscriptionState. + * Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' * @readonly * @enum {string} */ -export type ApplianceArtifactType = 'Template' | 'Custom'; +export type SubscriptionState = 'Enabled' | 'Warned' | 'PastDue' | 'Disabled' | 'Deleted'; /** - * Defines values for ResourceIdentityType. - * Possible values include: 'SystemAssigned' + * Defines values for SpendingLimit. + * Possible values include: 'On', 'Off', 'CurrentPeriodOff' * @readonly * @enum {string} */ -export type ResourceIdentityType = 'SystemAssigned'; +export type SpendingLimit = 'On' | 'Off' | 'CurrentPeriodOff'; /** - * Contains response data for the listOperations operation. + * Contains response data for the list operation. */ -export type ListOperationsResponse = OperationListResult & { +export type OperationsListResponse = OperationListResult & { /** * The underlying HTTP response. */ @@ -479,9 +270,9 @@ export type ListOperationsResponse = OperationListResult & { }; /** - * Contains response data for the listOperationsNext operation. + * Contains response data for the listNext operation. */ -export type ListOperationsNextResponse = OperationListResult & { +export type OperationsListNextResponse = OperationListResult & { /** * The underlying HTTP response. */ @@ -499,9 +290,9 @@ export type ListOperationsNextResponse = OperationListResult & { }; /** - * Contains response data for the get operation. + * Contains response data for the listLocations operation. */ -export type AppliancesGetResponse = Appliance & { +export type SubscriptionsListLocationsResponse = LocationListResult & { /** * The underlying HTTP response. */ @@ -514,294 +305,14 @@ export type AppliancesGetResponse = Appliance & { /** * The response body as parsed JSON or XML */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type AppliancesCreateOrUpdateResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type AppliancesUpdateResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the listByResourceGroup operation. - */ -export type AppliancesListByResourceGroupResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; - -/** - * Contains response data for the listBySubscription operation. - */ -export type AppliancesListBySubscriptionResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; - -/** - * Contains response data for the getById operation. - */ -export type AppliancesGetByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the createOrUpdateById operation. - */ -export type AppliancesCreateOrUpdateByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the updateById operation. - */ -export type AppliancesUpdateByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type AppliancesBeginCreateOrUpdateResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdateById operation. - */ -export type AppliancesBeginCreateOrUpdateByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; - -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type AppliancesListByResourceGroupNextResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; - -/** - * Contains response data for the listBySubscriptionNext operation. - */ -export type AppliancesListBySubscriptionNextResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; + parsedBody: LocationListResult; }; }; /** * Contains response data for the get operation. */ -export type ApplianceDefinitionsGetResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type ApplianceDefinitionsCreateOrUpdateResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; - -/** - * Contains response data for the listByResourceGroup operation. - */ -export type ApplianceDefinitionsListByResourceGroupResponse = ApplianceDefinitionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinitionListResult; - }; -}; - -/** - * Contains response data for the getById operation. - */ -export type ApplianceDefinitionsGetByIdResponse = ApplianceDefinition & { +export type SubscriptionsGetResponse = Subscription & { /** * The underlying HTTP response. */ @@ -814,14 +325,14 @@ export type ApplianceDefinitionsGetByIdResponse = ApplianceDefinition & { /** * The response body as parsed JSON or XML */ - parsedBody: ApplianceDefinition; + parsedBody: Subscription; }; }; /** - * Contains response data for the createOrUpdateById operation. + * Contains response data for the list operation. */ -export type ApplianceDefinitionsCreateOrUpdateByIdResponse = ApplianceDefinition & { +export type SubscriptionsListResponse = SubscriptionListResult & { /** * The underlying HTTP response. */ @@ -834,14 +345,14 @@ export type ApplianceDefinitionsCreateOrUpdateByIdResponse = ApplianceDefinition /** * The response body as parsed JSON or XML */ - parsedBody: ApplianceDefinition; + parsedBody: SubscriptionListResult; }; }; /** - * Contains response data for the beginCreateOrUpdate operation. + * Contains response data for the listNext operation. */ -export type ApplianceDefinitionsBeginCreateOrUpdateResponse = ApplianceDefinition & { +export type SubscriptionsListNextResponse = SubscriptionListResult & { /** * The underlying HTTP response. */ @@ -854,14 +365,14 @@ export type ApplianceDefinitionsBeginCreateOrUpdateResponse = ApplianceDefinitio /** * The response body as parsed JSON or XML */ - parsedBody: ApplianceDefinition; + parsedBody: SubscriptionListResult; }; }; /** - * Contains response data for the beginCreateOrUpdateById operation. + * Contains response data for the list operation. */ -export type ApplianceDefinitionsBeginCreateOrUpdateByIdResponse = ApplianceDefinition & { +export type TenantsListResponse = TenantListResult & { /** * The underlying HTTP response. */ @@ -874,14 +385,14 @@ export type ApplianceDefinitionsBeginCreateOrUpdateByIdResponse = ApplianceDefin /** * The response body as parsed JSON or XML */ - parsedBody: ApplianceDefinition; + parsedBody: TenantListResult; }; }; /** - * Contains response data for the listByResourceGroupNext operation. + * Contains response data for the listNext operation. */ -export type ApplianceDefinitionsListByResourceGroupNextResponse = ApplianceDefinitionListResult & { +export type TenantsListNextResponse = TenantListResult & { /** * The underlying HTTP response. */ @@ -894,6 +405,6 @@ export type ApplianceDefinitionsListByResourceGroupNextResponse = ApplianceDefin /** * The response body as parsed JSON or XML */ - parsedBody: ApplianceDefinitionListResult; + parsedBody: TenantListResult; }; }; diff --git a/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts index 5f035b2b393d..0ee452fa1bcb 100644 --- a/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts +++ b/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts @@ -12,59 +12,22 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; -export const Plan: msRest.CompositeMapper = { - serializedName: "Plan", +export const Location: msRest.CompositeMapper = { + serializedName: "Location", type: { name: "Composite", - className: "Plan", + className: "Location", modelProperties: { - name: { - required: true, - serializedName: "name", - type: { - name: "String" - } - }, - publisher: { - required: true, - serializedName: "publisher", - type: { - name: "String" - } - }, - product: { - required: true, - serializedName: "product", - type: { - name: "String" - } - }, - promotionCode: { - serializedName: "promotionCode", + id: { + readOnly: true, + serializedName: "id", type: { name: "String" } }, - version: { - required: true, - serializedName: "version", - type: { - name: "String" - } - } - } - } -}; - -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { + subscriptionId: { readOnly: true, - serializedName: "id", + serializedName: "subscriptionId", type: { name: "String" } @@ -76,163 +39,76 @@ export const Resource: msRest.CompositeMapper = { name: "String" } }, - type: { + displayName: { readOnly: true, - serializedName: "type", + serializedName: "displayName", type: { name: "String" } }, - location: { - serializedName: "location", + latitude: { + readOnly: true, + serializedName: "latitude", type: { name: "String" } }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const GenericResource: msRest.CompositeMapper = { - serializedName: "GenericResource", - type: { - name: "Composite", - className: "GenericResource", - modelProperties: { - ...Resource.type.modelProperties, - managedBy: { - serializedName: "managedBy", + longitude: { + readOnly: true, + serializedName: "longitude", type: { name: "String" } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "Sku" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "Identity" - } } } } }; -export const Appliance: msRest.CompositeMapper = { - serializedName: "Appliance", +export const SubscriptionPolicies: msRest.CompositeMapper = { + serializedName: "SubscriptionPolicies", type: { name: "Composite", - className: "Appliance", + className: "SubscriptionPolicies", modelProperties: { - ...GenericResource.type.modelProperties, - managedResourceGroupId: { - required: true, - serializedName: "properties.managedResourceGroupId", - type: { - name: "String" - } - }, - applianceDefinitionId: { - serializedName: "properties.applianceDefinitionId", - type: { - name: "String" - } - }, - parameters: { - serializedName: "properties.parameters", - type: { - name: "Object" - } - }, - outputs: { - readOnly: true, - serializedName: "properties.outputs", - type: { - name: "Object" - } - }, - provisioningState: { + locationPlacementId: { readOnly: true, - serializedName: "properties.provisioningState", + serializedName: "locationPlacementId", type: { name: "String" } }, - uiDefinitionUri: { - serializedName: "properties.uiDefinitionUri", + quotaId: { + readOnly: true, + serializedName: "quotaId", type: { name: "String" } }, - plan: { - serializedName: "plan", - type: { - name: "Composite", - className: "Plan" - } - }, - kind: { - serializedName: "kind", - constraints: { - Pattern: /^[-\w\._,\(\)]+$/ - }, + spendingLimit: { + readOnly: true, + serializedName: "spendingLimit", type: { - name: "String" + name: "Enum", + allowedValues: [ + "On", + "Off", + "CurrentPeriodOff" + ] } } } } }; -export const PlanPatchable: msRest.CompositeMapper = { - serializedName: "PlanPatchable", +export const ManagedByTenant: msRest.CompositeMapper = { + serializedName: "ManagedByTenant", type: { name: "Composite", - className: "PlanPatchable", + className: "ManagedByTenant", modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - publisher: { - serializedName: "publisher", - type: { - name: "String" - } - }, - product: { - serializedName: "product", - type: { - name: "String" - } - }, - promotionCode: { - serializedName: "promotionCode", - type: { - name: "String" - } - }, - version: { - serializedName: "version", + tenantId: { + readOnly: true, + serializedName: "tenantId", type: { name: "String" } @@ -241,250 +117,92 @@ export const PlanPatchable: msRest.CompositeMapper = { } }; -export const AppliancePatchable: msRest.CompositeMapper = { - serializedName: "AppliancePatchable", +export const Subscription: msRest.CompositeMapper = { + serializedName: "Subscription", type: { name: "Composite", - className: "AppliancePatchable", + className: "Subscription", modelProperties: { - ...GenericResource.type.modelProperties, - managedResourceGroupId: { - serializedName: "properties.managedResourceGroupId", - type: { - name: "String" - } - }, - applianceDefinitionId: { - serializedName: "properties.applianceDefinitionId", - type: { - name: "String" - } - }, - parameters: { - serializedName: "properties.parameters", - type: { - name: "Object" - } - }, - outputs: { - readOnly: true, - serializedName: "properties.outputs", - type: { - name: "Object" - } - }, - provisioningState: { + id: { readOnly: true, - serializedName: "properties.provisioningState", - type: { - name: "String" - } - }, - uiDefinitionUri: { - serializedName: "properties.uiDefinitionUri", + serializedName: "id", type: { name: "String" } }, - plan: { - serializedName: "plan", - type: { - name: "Composite", - className: "PlanPatchable" - } - }, - kind: { - serializedName: "kind", - constraints: { - Pattern: /^[-\w\._,\(\)]+$/ - }, - type: { - name: "String" - } - } - } - } -}; - -export const ApplianceProviderAuthorization: msRest.CompositeMapper = { - serializedName: "ApplianceProviderAuthorization", - type: { - name: "Composite", - className: "ApplianceProviderAuthorization", - modelProperties: { - principalId: { - required: true, - serializedName: "principalId", + subscriptionId: { + readOnly: true, + serializedName: "subscriptionId", type: { name: "String" } }, - roleDefinitionId: { - required: true, - serializedName: "roleDefinitionId", - type: { - name: "String" - } - } - } - } -}; - -export const ApplianceArtifact: msRest.CompositeMapper = { - serializedName: "ApplianceArtifact", - type: { - name: "Composite", - className: "ApplianceArtifact", - modelProperties: { - name: { - serializedName: "name", + displayName: { + readOnly: true, + serializedName: "displayName", type: { name: "String" } }, - uri: { - serializedName: "uri", + tenantId: { + readOnly: true, + serializedName: "tenantId", type: { name: "String" } }, - type: { - serializedName: "type", - type: { - name: "Enum", - allowedValues: [ - "Template", - "Custom" - ] - } - } - } - } -}; - -export const ApplianceDefinition: msRest.CompositeMapper = { - serializedName: "ApplianceDefinition", - type: { - name: "Composite", - className: "ApplianceDefinition", - modelProperties: { - ...GenericResource.type.modelProperties, - lockLevel: { - required: true, - serializedName: "properties.lockLevel", + state: { + readOnly: true, + serializedName: "state", type: { name: "Enum", allowedValues: [ - "CanNotDelete", - "ReadOnly", - "None" + "Enabled", + "Warned", + "PastDue", + "Disabled", + "Deleted" ] } }, - displayName: { - serializedName: "properties.displayName", + subscriptionPolicies: { + serializedName: "subscriptionPolicies", type: { - name: "String" + name: "Composite", + className: "SubscriptionPolicies" } }, - authorizations: { - required: true, - serializedName: "properties.authorizations", + authorizationSource: { + serializedName: "authorizationSource", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ApplianceProviderAuthorization" - } - } + name: "String" } }, - artifacts: { - serializedName: "properties.artifacts", + managedByTenants: { + serializedName: "managedByTenants", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ApplianceArtifact" + className: "ManagedByTenant" } } } - }, - description: { - serializedName: "properties.description", - type: { - name: "String" - } - }, - packageFileUri: { - required: true, - serializedName: "properties.packageFileUri", - type: { - name: "String" - } } } } }; -export const Sku: msRest.CompositeMapper = { - serializedName: "Sku", +export const TenantIdDescription: msRest.CompositeMapper = { + serializedName: "TenantIdDescription", type: { name: "Composite", - className: "Sku", + className: "TenantIdDescription", modelProperties: { - name: { - required: true, - serializedName: "name", - type: { - name: "String" - } - }, - tier: { - serializedName: "tier", - type: { - name: "String" - } - }, - size: { - serializedName: "size", - type: { - name: "String" - } - }, - family: { - serializedName: "family", - type: { - name: "String" - } - }, - model: { - serializedName: "model", - type: { - name: "String" - } - }, - capacity: { - serializedName: "capacity", - type: { - name: "Number" - } - } - } - } -}; - -export const Identity: msRest.CompositeMapper = { - serializedName: "Identity", - type: { - name: "Composite", - className: "Identity", - modelProperties: { - principalId: { + id: { readOnly: true, - serializedName: "principalId", + serializedName: "id", type: { name: "String" } @@ -495,43 +213,6 @@ export const Identity: msRest.CompositeMapper = { type: { name: "String" } - }, - type: { - serializedName: "type", - type: { - name: "Enum", - allowedValues: [ - "SystemAssigned" - ] - } - } - } - } -}; - -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - httpStatus: { - serializedName: "httpStatus", - type: { - name: "String" - } - }, - errorCode: { - serializedName: "errorCode", - type: { - name: "String" - } - }, - errorMessage: { - serializedName: "errorMessage", - type: { - name: "String" - } } } } @@ -560,6 +241,12 @@ export const OperationDisplay: msRest.CompositeMapper = { type: { name: "String" } + }, + description: { + serializedName: "description", + type: { + name: "String" + } } } } @@ -616,11 +303,11 @@ export const OperationListResult: msRest.CompositeMapper = { } }; -export const ApplianceListResult: msRest.CompositeMapper = { - serializedName: "ApplianceListResult", +export const LocationListResult: msRest.CompositeMapper = { + serializedName: "LocationListResult", type: { name: "Composite", - className: "ApplianceListResult", + className: "LocationListResult", modelProperties: { value: { serializedName: "", @@ -629,12 +316,35 @@ export const ApplianceListResult: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "Appliance" + className: "Location" + } + } + } + } + } + } +}; + +export const SubscriptionListResult: msRest.CompositeMapper = { + serializedName: "SubscriptionListResult", + type: { + name: "Composite", + className: "SubscriptionListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Subscription" } } } }, nextLink: { + required: true, serializedName: "nextLink", type: { name: "String" @@ -644,11 +354,11 @@ export const ApplianceListResult: msRest.CompositeMapper = { } }; -export const ApplianceDefinitionListResult: msRest.CompositeMapper = { - serializedName: "ApplianceDefinitionListResult", +export const TenantListResult: msRest.CompositeMapper = { + serializedName: "TenantListResult", type: { name: "Composite", - className: "ApplianceDefinitionListResult", + className: "TenantListResult", modelProperties: { value: { serializedName: "", @@ -657,12 +367,13 @@ export const ApplianceDefinitionListResult: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "ApplianceDefinition" + className: "TenantIdDescription" } } } }, nextLink: { + required: true, serializedName: "nextLink", type: { name: "String" diff --git a/sdk/managedapplications/arm-managedapplications/src/models/operationsMappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/operationsMappers.ts new file mode 100644 index 000000000000..689688180be7 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/models/operationsMappers.ts @@ -0,0 +1,14 @@ +/* + * 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. + */ + +export { + CloudError, + Operation, + OperationDisplay, + OperationListResult +} from "../models/mappers"; diff --git a/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts b/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts index 571c4b265cc8..9b62c11dd6da 100644 --- a/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts +++ b/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts @@ -30,56 +30,6 @@ export const apiVersion: msRest.OperationQueryParameter = { } } }; -export const applianceDefinitionId: msRest.OperationURLParameter = { - parameterPath: "applianceDefinitionId", - mapper: { - required: true, - serializedName: "applianceDefinitionId", - type: { - name: "String" - } - }, - skipEncoding: true -}; -export const applianceDefinitionName: msRest.OperationURLParameter = { - parameterPath: "applianceDefinitionName", - mapper: { - required: true, - serializedName: "applianceDefinitionName", - constraints: { - MaxLength: 64, - MinLength: 3 - }, - type: { - name: "String" - } - } -}; -export const applianceId: msRest.OperationURLParameter = { - parameterPath: "applianceId", - mapper: { - required: true, - serializedName: "applianceId", - type: { - name: "String" - } - }, - skipEncoding: true -}; -export const applianceName: msRest.OperationURLParameter = { - parameterPath: "applianceName", - mapper: { - required: true, - serializedName: "applianceName", - constraints: { - MaxLength: 64, - MinLength: 3 - }, - type: { - name: "String" - } - } -}; export const nextPageLink: msRest.OperationURLParameter = { parameterPath: "nextPageLink", mapper: { @@ -91,21 +41,6 @@ export const nextPageLink: msRest.OperationURLParameter = { }, skipEncoding: true }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - required: true, - serializedName: "resourceGroupName", - constraints: { - MaxLength: 90, - MinLength: 1, - Pattern: /^[-\w\._\(\)]+$/ - }, - type: { - name: "String" - } - } -}; export const subscriptionId: msRest.OperationURLParameter = { parameterPath: "subscriptionId", mapper: { diff --git a/sdk/managedapplications/arm-managedapplications/src/models/subscriptionsMappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/subscriptionsMappers.ts new file mode 100644 index 000000000000..18f9d89837b2 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/models/subscriptionsMappers.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export { + CloudError, + Location, + LocationListResult, + ManagedByTenant, + Subscription, + SubscriptionListResult, + SubscriptionPolicies +} from "../models/mappers"; diff --git a/sdk/managedapplications/arm-managedapplications/src/models/tenantsMappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/tenantsMappers.ts new file mode 100644 index 000000000000..3bb2cb4ae153 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/models/tenantsMappers.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +export { + CloudError, + TenantIdDescription, + TenantListResult +} from "../models/mappers"; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/index.ts b/sdk/managedapplications/arm-managedapplications/src/operations/index.ts index 50be9cad72d1..3e6732554b87 100644 --- a/sdk/managedapplications/arm-managedapplications/src/operations/index.ts +++ b/sdk/managedapplications/arm-managedapplications/src/operations/index.ts @@ -8,5 +8,6 @@ * regenerated. */ -export * from "./appliances"; -export * from "./applianceDefinitions"; +export * from "./operations"; +export * from "./subscriptions"; +export * from "./tenants"; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/operations.ts b/sdk/managedapplications/arm-managedapplications/src/operations/operations.ts new file mode 100644 index 000000000000..e114c7453606 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operations/operations.ts @@ -0,0 +1,123 @@ +/* + * 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/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { SubscriptionClientContext } from "../subscriptionClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: SubscriptionClientContext; + + /** + * Create a Operations. + * @param {SubscriptionClientContext} client Reference to the service client. + */ + constructor(client: SubscriptionClientContext) { + this.client = client; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Resources/operations", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/subscriptions.ts b/sdk/managedapplications/arm-managedapplications/src/operations/subscriptions.ts new file mode 100644 index 000000000000..9046e3108365 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operations/subscriptions.ts @@ -0,0 +1,227 @@ +/* + * 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/subscriptionsMappers"; +import * as Parameters from "../models/parameters"; +import { SubscriptionClientContext } from "../subscriptionClientContext"; + +/** Class representing a Subscriptions. */ +export class Subscriptions { + private readonly client: SubscriptionClientContext; + + /** + * Create a Subscriptions. + * @param {SubscriptionClientContext} client Reference to the service client. + */ + constructor(client: SubscriptionClientContext) { + this.client = client; + } + + /** + * This operation provides all the locations that are available for resource providers; however, + * each resource provider may support a subset of this list. + * @summary Gets all available geo-locations. + * @param subscriptionId The ID of the target subscription. + * @param [options] The optional parameters + * @returns Promise + */ + listLocations(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId The ID of the target subscription. + * @param callback The callback + */ + listLocations(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId The ID of the target subscription. + * @param options The optional parameters + * @param callback The callback + */ + listLocations(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listLocations(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + subscriptionId, + options + }, + listLocationsOperationSpec, + callback) as Promise; + } + + /** + * Gets details about a specified subscription. + * @param subscriptionId The ID of the target subscription. + * @param [options] The optional parameters + * @returns Promise + */ + get(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId The ID of the target subscription. + * @param callback The callback + */ + get(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId The ID of the target subscription. + * @param options The optional parameters + * @param callback The callback + */ + get(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + subscriptionId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Gets all subscriptions for a tenant. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets all subscriptions for a tenant. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listLocationsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/locations", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.LocationListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.Subscription + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/tenants.ts b/sdk/managedapplications/arm-managedapplications/src/operations/tenants.ts new file mode 100644 index 000000000000..5355aa0faa75 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operations/tenants.ts @@ -0,0 +1,123 @@ +/* + * 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/tenantsMappers"; +import * as Parameters from "../models/parameters"; +import { SubscriptionClientContext } from "../subscriptionClientContext"; + +/** Class representing a Tenants. */ +export class Tenants { + private readonly client: SubscriptionClientContext; + + /** + * Create a Tenants. + * @param {SubscriptionClientContext} client Reference to the service client. + */ + constructor(client: SubscriptionClientContext) { + this.client = client; + } + + /** + * Gets the tenants for your account. + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets the tenants for your account. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "tenants", + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.TenantListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.TenantListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/subscriptionClient.ts b/sdk/managedapplications/arm-managedapplications/src/subscriptionClient.ts new file mode 100644 index 000000000000..188113792eb6 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/subscriptionClient.ts @@ -0,0 +1,45 @@ +/* + * 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 operations from "./operations"; +import { SubscriptionClientContext } from "./subscriptionClientContext"; + + +class SubscriptionClient extends SubscriptionClientContext { + // Operation groups + operations: operations.Operations; + subscriptions: operations.Subscriptions; + tenants: operations.Tenants; + + /** + * Initializes a new instance of the SubscriptionClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.SubscriptionClientOptions) { + super(credentials, options); + this.operations = new operations.Operations(this); + this.subscriptions = new operations.Subscriptions(this); + this.tenants = new operations.Tenants(this); + } +} + +// Operation Specifications + +export { + SubscriptionClient, + SubscriptionClientContext, + Models as SubscriptionModels, + Mappers as SubscriptionMappers +}; +export * from "./operations"; diff --git a/sdk/managedapplications/arm-managedapplications/src/subscriptionClientContext.ts b/sdk/managedapplications/arm-managedapplications/src/subscriptionClientContext.ts new file mode 100644 index 000000000000..e5ef43809106 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/subscriptionClientContext.ts @@ -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-managedapplications"; +const packageVersion = "1.0.2"; + +export class SubscriptionClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + apiVersion?: string; + + /** + * Initializes a new instance of the SubscriptionClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.SubscriptionClientOptions) { + 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-06-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; + } + } +} diff --git a/sdk/managedapplications/arm-managedapplications/tsconfig.json b/sdk/managedapplications/arm-managedapplications/tsconfig.json index 87bbf5b5fa49..422b584abd5e 100644 --- a/sdk/managedapplications/arm-managedapplications/tsconfig.json +++ b/sdk/managedapplications/arm-managedapplications/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es6", "dom"], "declaration": true, "outDir": "./esm", "importHelpers": true