From ffcdc019f25a293660f529ab809d4bd11acecbf3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 30 Jun 2021 07:21:04 +0000 Subject: [PATCH] CodeGen from PR 14736 in Azure/azure-rest-api-specs Microsoft.Features: Add new API version 2021-07-01 (#14736) * The previous version in the 2021-08-1 folder * Add new feature registration apis * Update readme files * Update readme file * Remove feature configuration apis * Fix avocado * Fix validations * Fix validation * Fix validations * Fix validation * Fix title * Fix validation * Fix validation * Fix readme * Fix validation * Fix validation * Fix validation * Fix validation * Fix validation * suppress r4009 * Fix validation * Fix validation * Fix python * Fix readme * Fix python * Remove post api * Update example api-versions Co-authored-by: shenshengkafei --- sdk/features/arm-features/LICENSE.txt | 2 +- sdk/features/arm-features/README.md | 19 +- sdk/features/arm-features/package.json | 14 +- sdk/features/arm-features/rollup.config.js | 6 +- .../arm-features/src/featureClient.ts | 45 +- .../arm-features/src/featureClientContext.ts | 25 +- .../src/models/featuresMappers.ts | 7 +- sdk/features/arm-features/src/models/index.ts | 342 +++++++++++++- .../arm-features/src/models/mappers.ts | 295 +++++++++++- .../arm-features/src/models/parameters.ts | 15 +- ...subscriptionFeatureRegistrationsMappers.ts | 18 + .../arm-features/src/operations/features.ts | 156 +++++-- .../arm-features/src/operations/index.ts | 6 +- .../subscriptionFeatureRegistrations.ts | 421 ++++++++++++++++++ sdk/features/arm-features/tsconfig.json | 2 +- 15 files changed, 1278 insertions(+), 95 deletions(-) create mode 100644 sdk/features/arm-features/src/models/subscriptionFeatureRegistrationsMappers.ts create mode 100644 sdk/features/arm-features/src/operations/subscriptionFeatureRegistrations.ts diff --git a/sdk/features/arm-features/LICENSE.txt b/sdk/features/arm-features/LICENSE.txt index b73b4a1293c3..2d3163745319 100644 --- a/sdk/features/arm-features/LICENSE.txt +++ b/sdk/features/arm-features/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 Microsoft +Copyright (c) 2021 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/features/arm-features/README.md b/sdk/features/arm-features/README.md index 206666597069..a6c378bcb5d0 100644 --- a/sdk/features/arm-features/README.md +++ b/sdk/features/arm-features/README.md @@ -1,11 +1,11 @@ ## Azure FeatureClient SDK for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for FeatureClient. +This package contains an isomorphic SDK (runs both in node.js and in browsers) for FeatureClient. ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. ### Prerequisites @@ -21,7 +21,6 @@ Install both packages using the below command: ```bash npm install --save @azure/arm-features @azure/identity ``` - > **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. @@ -37,8 +36,7 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/ In the below samples, we pass the credential and the Azure subscription id to instantiate the client. Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. - -#### nodejs - Authentication, client creation, and listOperations as an example written in JavaScript. +#### nodejs - Authentication, client creation, and listOperations as an example written in JavaScript. ##### Sample code @@ -51,8 +49,8 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; // Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. const creds = new DefaultAzureCredential(); const client = new FeatureClient(creds, subscriptionId); - -client.listOperations().then((result) => { +const apiVersion = "testapiVersion"; +client.listOperations(apiVersion).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { @@ -61,7 +59,7 @@ client.listOperations().then((result) => { }); ``` -#### browser - Authentication, client creation, and listOperations as an example written in JavaScript. +#### browser - Authentication, client creation, and listOperations as an example written in JavaScript. In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. @@ -86,10 +84,11 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t const credential = new InteractiveBrowserCredential( { clientId: "", - tenantId: "" + tenant: "" }); const client = new Azure.ArmFeatures.FeatureClient(creds, subscriptionId); - client.listOperations().then((result) => { + const apiVersion = "testapiVersion"; + client.listOperations(apiVersion).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { diff --git a/sdk/features/arm-features/package.json b/sdk/features/arm-features/package.json index 32b4ebd94156..84db74f0ea45 100644 --- a/sdk/features/arm-features/package.json +++ b/sdk/features/arm-features/package.json @@ -4,10 +4,10 @@ "description": "FeatureClient Library with typescript type definitions for node.js and browser.", "version": "1.1.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.4.0", - "@azure/ms-rest-js": "^1.11.0", + "@azure/ms-rest-azure-js": "^2.1.0", + "@azure/ms-rest-js": "^2.2.0", "@azure/core-auth": "^1.1.4", - "tslib": "^1.9.3" + "tslib": "^1.10.0" }, "keywords": [ "node", @@ -22,12 +22,12 @@ "types": "./esm/featureClient.d.ts", "devDependencies": { "typescript": "^3.6.0", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.4.9" + "uglify-js": "^3.6.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/features/arm-features", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/features/arm-features", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" diff --git a/sdk/features/arm-features/rollup.config.js b/sdk/features/arm-features/rollup.config.js index 811aa48ee8ba..71d7b2c6ee2b 100644 --- a/sdk/features/arm-features/rollup.config.js +++ b/sdk/features/arm-features/rollup.config.js @@ -21,15 +21,15 @@ const config = { "@azure/ms-rest-azure-js": "msRestAzure" }, banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. */` }, plugins: [ - nodeResolve({ module: true }), + nodeResolve({ mainFields: ['module', 'main'] }), sourcemaps() ] }; diff --git a/sdk/features/arm-features/src/featureClient.ts b/sdk/features/arm-features/src/featureClient.ts index b3a263b43844..9c9a4ae49a55 100644 --- a/sdk/features/arm-features/src/featureClient.ts +++ b/sdk/features/arm-features/src/featureClient.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -20,6 +19,7 @@ import { FeatureClientContext } from "./featureClientContext"; class FeatureClient extends FeatureClientContext { // Operation groups features: operations.Features; + subscriptionFeatureRegistrations: operations.SubscriptionFeatureRegistrations; /** * Initializes a new instance of the FeatureClient class. @@ -29,32 +29,38 @@ class FeatureClient extends FeatureClientContext { * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and * @azure/ms-rest-browserauth are also supported. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The Azure subscription ID. + * @param providerNamespace The provider namespace. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FeatureClientOptions) { - super(credentials, subscriptionId, options); + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, providerNamespace: string, options?: Models.FeatureClientOptions) { + super(credentials, subscriptionId, providerNamespace, options); this.features = new operations.Features(this); + this.subscriptionFeatureRegistrations = new operations.SubscriptionFeatureRegistrations(this); } /** * Lists all of the available Microsoft.Features REST API operations. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - listOperations(options?: msRest.RequestOptionsBase): Promise; + listOperations(apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - listOperations(callback: msRest.ServiceCallback): void; + listOperations(apiVersion: string, callback: msRest.ServiceCallback): void; /** + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - listOperations(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listOperations(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + listOperations(apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listOperations(apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { + apiVersion, options }, listOperationsOperationSpec, @@ -64,25 +70,29 @@ class FeatureClient extends FeatureClientContext { /** * Lists all of the available Microsoft.Features REST API operations. * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - listOperationsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + listOperationsNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - listOperationsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + listOperationsNext(nextPageLink: string, apiVersion: string, callback: msRest.ServiceCallback): void; /** * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - listOperationsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listOperationsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + listOperationsNext(nextPageLink: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listOperationsNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { nextPageLink, + apiVersion, options }, listOperationsNextOperationSpec, @@ -106,7 +116,7 @@ const listOperationsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.OperationListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -119,6 +129,9 @@ const listOperationsNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -127,7 +140,7 @@ const listOperationsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.OperationListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer diff --git a/sdk/features/arm-features/src/featureClientContext.ts b/sdk/features/arm-features/src/featureClientContext.ts index 078693ce2e04..387aac141794 100644 --- a/sdk/features/arm-features/src/featureClientContext.ts +++ b/sdk/features/arm-features/src/featureClientContext.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -10,8 +9,8 @@ import * as Models from "./models"; import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; import * as msRestAzure from "@azure/ms-rest-azure-js"; +import { TokenCredential } from "@azure/core-auth"; const packageName = "@azure/arm-features"; const packageVersion = "1.1.0"; @@ -19,7 +18,7 @@ const packageVersion = "1.1.0"; export class FeatureClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials | TokenCredential; subscriptionId: string; - apiVersion?: string; + providerNamespace: string; /** * Initializes a new instance of the FeatureClient class. @@ -29,39 +28,43 @@ export class FeatureClientContext extends msRestAzure.AzureServiceClient { * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and * @azure/ms-rest-browserauth are also supported. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The Azure subscription ID. + * @param providerNamespace The provider namespace. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FeatureClientOptions) { + constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, providerNamespace: string, options?: Models.FeatureClientOptions) { if (credentials == undefined) { throw new Error('\'credentials\' cannot be null.'); } if (subscriptionId == undefined) { throw new Error('\'subscriptionId\' cannot be null.'); } + if (providerNamespace == undefined) { + throw new Error('\'providerNamespace\' cannot be null.'); + } if (!options) { options = {}; } - if(!options.userAgent) { + if (!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); - this.apiVersion = '2015-12-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; this.subscriptionId = subscriptionId; + this.providerNamespace = providerNamespace; - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } } diff --git a/sdk/features/arm-features/src/models/featuresMappers.ts b/sdk/features/arm-features/src/models/featuresMappers.ts index ba6a46b5b7e9..f41fa6457b61 100644 --- a/sdk/features/arm-features/src/models/featuresMappers.ts +++ b/sdk/features/arm-features/src/models/featuresMappers.ts @@ -1,13 +1,14 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. */ export { - CloudError, + ErrorDefinition, + ErrorResponse, FeatureOperationsListResult, FeatureProperties, FeatureResult diff --git a/sdk/features/arm-features/src/models/index.ts b/sdk/features/arm-features/src/models/index.ts index 32c8ff5b37f0..62047a82fd92 100644 --- a/sdk/features/arm-features/src/models/index.ts +++ b/sdk/features/arm-features/src/models/index.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -75,6 +75,175 @@ export interface Operation { display?: OperationDisplay; } +/** + * Error definition. + */ +export interface ErrorDefinition { + /** + * Service specific error code which serves as the substatus for the HTTP error code. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly code?: string; + /** + * Description of the error. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly message?: string; + /** + * Internal error details. + */ + details?: ErrorDefinition[]; +} + +/** + * Error response indicates that the service is not able to process the incoming request. + */ +export interface ErrorResponse { + /** + * The error details. + */ + error?: ErrorDefinition; +} + +/** + * An Azure proxy resource. + */ +export interface ProxyResource extends BaseResource { + /** + * Azure resource Id. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * Azure resource name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * Azure resource type. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * Authorization Profile + */ +export interface AuthorizationProfile { + /** + * The requested time + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly requestedTime?: Date; + /** + * The requester + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly requester?: string; + /** + * The requester object id + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly requesterObjectId?: string; + /** + * The approved time + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly approvedTime?: Date; + /** + * The approver + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly approver?: string; +} + +/** + * An interface representing SubscriptionFeatureRegistrationProperties. + */ +export interface SubscriptionFeatureRegistrationProperties { + /** + * The tenantId. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly tenantId?: string; + /** + * The subscriptionId. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly subscriptionId?: string; + /** + * The featureName. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly featureName?: string; + /** + * The featureDisplayName. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly displayName?: string; + /** + * The providerNamespace. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly providerNamespace?: string; + /** + * The state. Possible values include: 'NotSpecified', 'NotRegistered', 'Pending', 'Registering', + * 'Registered', 'Unregistering', 'Unregistered' + */ + state?: SubscriptionFeatureRegistrationState; + authorizationProfile?: AuthorizationProfile; + /** + * Key-value pairs for meta data. + */ + metadata?: { [propertyName: string]: string }; + /** + * The feature release date. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly releaseDate?: Date; + /** + * The feature registration date. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly registrationDate?: Date; + /** + * The feature documentation link. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly documentationLink?: string; + /** + * The feature approval type. Possible values include: 'NotSpecified', 'ApprovalRequired', + * 'AutoApproval' + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly approvalType?: SubscriptionFeatureRegistrationApprovalType; + /** + * Indicates whether feature should be displayed in Portal. Default value: false. + */ + shouldFeatureDisplayInPortal?: boolean; + /** + * The feature description. + */ + description?: string; +} + +/** + * Subscription feature registration details + */ +export interface SubscriptionFeatureRegistration extends ProxyResource { + properties?: SubscriptionFeatureRegistrationProperties; +} + +/** + * Optional Parameters. + */ +export interface SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * Subscription Feature Registration Type details. + */ + subscriptionFeatureRegistrationType?: SubscriptionFeatureRegistration; +} + /** * An interface representing FeatureClientOptions. */ @@ -107,6 +276,35 @@ export interface FeatureOperationsListResult extends Array { nextLink?: string; } +/** + * @interface + * The list of subscription feature registrations. + * @extends Array + */ +export interface SubscriptionFeatureRegistrationList extends Array { + /** + * The link used to get the next page of subscription feature registrations list. + */ + nextLink?: string; +} + +/** + * Defines values for SubscriptionFeatureRegistrationState. + * Possible values include: 'NotSpecified', 'NotRegistered', 'Pending', 'Registering', + * 'Registered', 'Unregistering', 'Unregistered' + * @readonly + * @enum {string} + */ +export type SubscriptionFeatureRegistrationState = 'NotSpecified' | 'NotRegistered' | 'Pending' | 'Registering' | 'Registered' | 'Unregistering' | 'Unregistered'; + +/** + * Defines values for SubscriptionFeatureRegistrationApprovalType. + * Possible values include: 'NotSpecified', 'ApprovalRequired', 'AutoApproval' + * @readonly + * @enum {string} + */ +export type SubscriptionFeatureRegistrationApprovalType = 'NotSpecified' | 'ApprovalRequired' | 'AutoApproval'; + /** * Contains response data for the listOperations operation. */ @@ -227,6 +425,26 @@ export type FeaturesRegisterResponse = FeatureResult & { }; }; +/** + * Contains response data for the unregister operation. + */ +export type FeaturesUnregisterResponse = FeatureResult & { + /** + * 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: FeatureResult; + }; +}; + /** * Contains response data for the listAllNext operation. */ @@ -266,3 +484,123 @@ export type FeaturesListNextResponse = FeatureOperationsListResult & { parsedBody: FeatureOperationsListResult; }; }; + +/** + * Contains response data for the get operation. + */ +export type SubscriptionFeatureRegistrationsGetResponse = SubscriptionFeatureRegistration & { + /** + * 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: SubscriptionFeatureRegistration; + }; +}; + +/** + * Contains response data for the createOrUpdate operation. + */ +export type SubscriptionFeatureRegistrationsCreateOrUpdateResponse = SubscriptionFeatureRegistration & { + /** + * 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: SubscriptionFeatureRegistration; + }; +}; + +/** + * Contains response data for the listBySubscription operation. + */ +export type SubscriptionFeatureRegistrationsListBySubscriptionResponse = SubscriptionFeatureRegistrationList & { + /** + * 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: SubscriptionFeatureRegistrationList; + }; +}; + +/** + * Contains response data for the listAllBySubscription operation. + */ +export type SubscriptionFeatureRegistrationsListAllBySubscriptionResponse = SubscriptionFeatureRegistrationList & { + /** + * 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: SubscriptionFeatureRegistrationList; + }; +}; + +/** + * Contains response data for the listBySubscriptionNext operation. + */ +export type SubscriptionFeatureRegistrationsListBySubscriptionNextResponse = SubscriptionFeatureRegistrationList & { + /** + * 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: SubscriptionFeatureRegistrationList; + }; +}; + +/** + * Contains response data for the listAllBySubscriptionNext operation. + */ +export type SubscriptionFeatureRegistrationsListAllBySubscriptionNextResponse = SubscriptionFeatureRegistrationList & { + /** + * 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: SubscriptionFeatureRegistrationList; + }; +}; diff --git a/sdk/features/arm-features/src/models/mappers.ts b/sdk/features/arm-features/src/models/mappers.ts index 98e5d389930c..c345882e5a1a 100644 --- a/sdk/features/arm-features/src/models/mappers.ts +++ b/sdk/features/arm-features/src/models/mappers.ts @@ -1,6 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. @@ -114,6 +114,269 @@ export const Operation: msRest.CompositeMapper = { } }; +export const ErrorDefinition: msRest.CompositeMapper = { + serializedName: "ErrorDefinition", + type: { + name: "Composite", + className: "ErrorDefinition", + modelProperties: { + code: { + readOnly: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + readOnly: true, + serializedName: "message", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDefinition" + } + } + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDefinition" + } + } + } + } +}; + +export const ProxyResource: msRest.CompositeMapper = { + serializedName: "ProxyResource", + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const AuthorizationProfile: msRest.CompositeMapper = { + serializedName: "AuthorizationProfile", + type: { + name: "Composite", + className: "AuthorizationProfile", + modelProperties: { + requestedTime: { + readOnly: true, + serializedName: "requestedTime", + type: { + name: "DateTime" + } + }, + requester: { + readOnly: true, + serializedName: "requester", + type: { + name: "String" + } + }, + requesterObjectId: { + readOnly: true, + serializedName: "requesterObjectId", + type: { + name: "String" + } + }, + approvedTime: { + readOnly: true, + serializedName: "approvedTime", + type: { + name: "DateTime" + } + }, + approver: { + readOnly: true, + serializedName: "approver", + type: { + name: "String" + } + } + } + } +}; + +export const SubscriptionFeatureRegistrationProperties: msRest.CompositeMapper = { + serializedName: "SubscriptionFeatureRegistration_properties", + type: { + name: "Composite", + className: "SubscriptionFeatureRegistrationProperties", + modelProperties: { + tenantId: { + readOnly: true, + serializedName: "tenantId", + type: { + name: "String" + } + }, + subscriptionId: { + readOnly: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + featureName: { + readOnly: true, + serializedName: "featureName", + type: { + name: "String" + } + }, + displayName: { + readOnly: true, + serializedName: "displayName", + type: { + name: "String" + } + }, + providerNamespace: { + readOnly: true, + serializedName: "providerNamespace", + type: { + name: "String" + } + }, + state: { + serializedName: "state", + type: { + name: "String" + } + }, + authorizationProfile: { + serializedName: "authorizationProfile", + type: { + name: "Composite", + className: "AuthorizationProfile" + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + releaseDate: { + readOnly: true, + serializedName: "releaseDate", + type: { + name: "DateTime" + } + }, + registrationDate: { + readOnly: true, + serializedName: "registrationDate", + type: { + name: "DateTime" + } + }, + documentationLink: { + readOnly: true, + serializedName: "documentationLink", + constraints: { + MaxLength: 1000 + }, + type: { + name: "String" + } + }, + approvalType: { + readOnly: true, + serializedName: "approvalType", + type: { + name: "String" + } + }, + shouldFeatureDisplayInPortal: { + serializedName: "shouldFeatureDisplayInPortal", + defaultValue: false, + type: { + name: "Boolean" + } + }, + description: { + serializedName: "description", + constraints: { + MaxLength: 1000 + }, + type: { + name: "String" + } + } + } + } +}; + +export const SubscriptionFeatureRegistration: msRest.CompositeMapper = { + serializedName: "SubscriptionFeatureRegistration", + type: { + name: "Composite", + className: "SubscriptionFeatureRegistration", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SubscriptionFeatureRegistrationProperties" + } + } + } + } +}; + export const OperationListResult: msRest.CompositeMapper = { serializedName: "OperationListResult", type: { @@ -169,3 +432,31 @@ export const FeatureOperationsListResult: msRest.CompositeMapper = { } } }; + +export const SubscriptionFeatureRegistrationList: msRest.CompositeMapper = { + serializedName: "SubscriptionFeatureRegistrationList", + type: { + name: "Composite", + className: "SubscriptionFeatureRegistrationList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubscriptionFeatureRegistration" + } + } + } + } + } + } +}; diff --git a/sdk/features/arm-features/src/models/parameters.ts b/sdk/features/arm-features/src/models/parameters.ts index 439bb9ed6b84..1c09c72b71ea 100644 --- a/sdk/features/arm-features/src/models/parameters.ts +++ b/sdk/features/arm-features/src/models/parameters.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -51,6 +50,16 @@ export const nextPageLink: msRest.OperationURLParameter = { }, skipEncoding: true }; +export const providerNamespace: msRest.OperationURLParameter = { + parameterPath: "providerNamespace", + mapper: { + required: true, + serializedName: "providerNamespace", + type: { + name: "String" + } + } +}; export const resourceProviderNamespace: msRest.OperationURLParameter = { parameterPath: "resourceProviderNamespace", mapper: { diff --git a/sdk/features/arm-features/src/models/subscriptionFeatureRegistrationsMappers.ts b/sdk/features/arm-features/src/models/subscriptionFeatureRegistrationsMappers.ts new file mode 100644 index 000000000000..86d645c615a8 --- /dev/null +++ b/sdk/features/arm-features/src/models/subscriptionFeatureRegistrationsMappers.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { + AuthorizationProfile, + BaseResource, + ErrorDefinition, + ErrorResponse, + ProxyResource, + SubscriptionFeatureRegistration, + SubscriptionFeatureRegistrationList, + SubscriptionFeatureRegistrationProperties +} from "../models/mappers"; diff --git a/sdk/features/arm-features/src/operations/features.ts b/sdk/features/arm-features/src/operations/features.ts index 33c754666843..133fab6db08f 100644 --- a/sdk/features/arm-features/src/operations/features.ts +++ b/sdk/features/arm-features/src/operations/features.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -28,22 +27,26 @@ export class Features { /** * Gets all the preview features that are available through AFEC for the subscription. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - listAll(options?: msRest.RequestOptionsBase): Promise; + listAll(apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - listAll(callback: msRest.ServiceCallback): void; + listAll(apiVersion: string, callback: msRest.ServiceCallback): void; /** + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - listAll(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listAll(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + listAll(apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAll(apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { + apiVersion, options }, listAllOperationSpec, @@ -54,25 +57,29 @@ export class Features { * Gets all the preview features in a provider namespace that are available through AFEC for the * subscription. * @param resourceProviderNamespace The namespace of the resource provider for getting features. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - list(resourceProviderNamespace: string, options?: msRest.RequestOptionsBase): Promise; + list(resourceProviderNamespace: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceProviderNamespace The namespace of the resource provider for getting features. + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - list(resourceProviderNamespace: string, callback: msRest.ServiceCallback): void; + list(resourceProviderNamespace: string, apiVersion: string, callback: msRest.ServiceCallback): void; /** * @param resourceProviderNamespace The namespace of the resource provider for getting features. + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - list(resourceProviderNamespace: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(resourceProviderNamespace: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + list(resourceProviderNamespace: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(resourceProviderNamespace: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceProviderNamespace, + apiVersion, options }, listOperationSpec, @@ -83,28 +90,32 @@ export class Features { * Gets the preview feature with the specified name. * @param resourceProviderNamespace The resource provider namespace for the feature. * @param featureName The name of the feature to get. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - get(resourceProviderNamespace: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + get(resourceProviderNamespace: string, featureName: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceProviderNamespace The resource provider namespace for the feature. * @param featureName The name of the feature to get. + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - get(resourceProviderNamespace: string, featureName: string, callback: msRest.ServiceCallback): void; + get(resourceProviderNamespace: string, featureName: string, apiVersion: string, callback: msRest.ServiceCallback): void; /** * @param resourceProviderNamespace The resource provider namespace for the feature. * @param featureName The name of the feature to get. + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - get(resourceProviderNamespace: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceProviderNamespace: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get(resourceProviderNamespace: string, featureName: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceProviderNamespace: string, featureName: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceProviderNamespace, featureName, + apiVersion, options }, getOperationSpec, @@ -115,56 +126,100 @@ export class Features { * Registers the preview feature for the subscription. * @param resourceProviderNamespace The namespace of the resource provider. * @param featureName The name of the feature to register. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - register(resourceProviderNamespace: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + register(resourceProviderNamespace: string, featureName: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceProviderNamespace The namespace of the resource provider. * @param featureName The name of the feature to register. + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - register(resourceProviderNamespace: string, featureName: string, callback: msRest.ServiceCallback): void; + register(resourceProviderNamespace: string, featureName: string, apiVersion: string, callback: msRest.ServiceCallback): void; /** * @param resourceProviderNamespace The namespace of the resource provider. * @param featureName The name of the feature to register. + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - register(resourceProviderNamespace: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - register(resourceProviderNamespace: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + register(resourceProviderNamespace: string, featureName: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + register(resourceProviderNamespace: string, featureName: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceProviderNamespace, featureName, + apiVersion, options }, registerOperationSpec, callback) as Promise; } + /** + * Unregisters the preview feature for the subscription. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param featureName The name of the feature to unregister. + * @param apiVersion The API version to use for this operation. + * @param [options] The optional parameters + * @returns Promise + */ + unregister(resourceProviderNamespace: string, featureName: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceProviderNamespace The namespace of the resource provider. + * @param featureName The name of the feature to unregister. + * @param apiVersion The API version to use for this operation. + * @param callback The callback + */ + unregister(resourceProviderNamespace: string, featureName: string, apiVersion: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceProviderNamespace The namespace of the resource provider. + * @param featureName The name of the feature to unregister. + * @param apiVersion The API version to use for this operation. + * @param options The optional parameters + * @param callback The callback + */ + unregister(resourceProviderNamespace: string, featureName: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + unregister(resourceProviderNamespace: string, featureName: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceProviderNamespace, + featureName, + apiVersion, + options + }, + unregisterOperationSpec, + callback) as Promise; + } + /** * Gets all the preview features that are available through AFEC for the subscription. * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - listAllNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + listAllNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - listAllNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + listAllNext(nextPageLink: string, apiVersion: string, callback: msRest.ServiceCallback): void; /** * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param options The optional parameters * @param callback The callback */ - listAllNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listAllNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + listAllNext(nextPageLink: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAllNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { nextPageLink, + apiVersion, options }, listAllNextOperationSpec, @@ -175,25 +230,29 @@ export class Features { * Gets all the preview features in a provider namespace that are available through AFEC for the * subscription. * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param [options] The optional parameters * @returns Promise */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + listNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; /** * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. * @param callback The callback */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, apiVersion: string, callback: msRest.ServiceCallback): void; /** * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this 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 { + listNext(nextPageLink: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { nextPageLink, + apiVersion, options }, listNextOperationSpec, @@ -220,7 +279,7 @@ const listAllOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -244,7 +303,7 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -269,7 +328,7 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -294,7 +353,32 @@ const registerOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const unregisterOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/unregister", + urlParameters: [ + Parameters.resourceProviderNamespace, + Parameters.featureName, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.FeatureResult + }, + default: { + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -307,6 +391,9 @@ const listAllNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -315,7 +402,7 @@ const listAllNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -328,6 +415,9 @@ const listNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -336,7 +426,7 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer diff --git a/sdk/features/arm-features/src/operations/index.ts b/sdk/features/arm-features/src/operations/index.ts index e7a795418c8a..c3482fd0855e 100644 --- a/sdk/features/arm-features/src/operations/index.ts +++ b/sdk/features/arm-features/src/operations/index.ts @@ -1,7 +1,6 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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 @@ -9,3 +8,4 @@ */ export * from "./features"; +export * from "./subscriptionFeatureRegistrations"; diff --git a/sdk/features/arm-features/src/operations/subscriptionFeatureRegistrations.ts b/sdk/features/arm-features/src/operations/subscriptionFeatureRegistrations.ts new file mode 100644 index 000000000000..e45370536c0f --- /dev/null +++ b/sdk/features/arm-features/src/operations/subscriptionFeatureRegistrations.ts @@ -0,0 +1,421 @@ +/* + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/subscriptionFeatureRegistrationsMappers"; +import * as Parameters from "../models/parameters"; +import { FeatureClientContext } from "../featureClientContext"; + +/** Class representing a SubscriptionFeatureRegistrations. */ +export class SubscriptionFeatureRegistrations { + private readonly client: FeatureClientContext; + + /** + * Create a SubscriptionFeatureRegistrations. + * @param {FeatureClientContext} client Reference to the service client. + */ + constructor(client: FeatureClientContext) { + this.client = client; + } + + /** + * Returns a feature registration + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param [options] The optional parameters + * @returns Promise + */ + get(apiVersion: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param callback The callback + */ + get(apiVersion: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param options The optional parameters + * @param callback The callback + */ + get(apiVersion: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(apiVersion: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + apiVersion, + featureName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create or update a feature registration. + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(apiVersion: string, featureName: string, options?: Models.SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams): Promise; + /** + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param callback The callback + */ + createOrUpdate(apiVersion: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param options The optional parameters + * @param callback The callback + */ + createOrUpdate(apiVersion: string, featureName: string, options: Models.SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams, callback: msRest.ServiceCallback): void; + createOrUpdate(apiVersion: string, featureName: string, options?: Models.SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + apiVersion, + featureName, + options + }, + createOrUpdateOperationSpec, + callback) as Promise; + } + + /** + * Deletes a feature registration + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(apiVersion: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param callback The callback + */ + deleteMethod(apiVersion: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param apiVersion The API version to use for this operation. + * @param featureName The feature name. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(apiVersion: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(apiVersion: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + apiVersion, + featureName, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Returns subscription feature registrations for given subscription and provider namespace. + * @param apiVersion The API version to use for this operation. + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscription(apiVersion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiVersion The API version to use for this operation. + * @param callback The callback + */ + listBySubscription(apiVersion: string, callback: msRest.ServiceCallback): void; + /** + * @param apiVersion The API version to use for this operation. + * @param options The optional parameters + * @param callback The callback + */ + listBySubscription(apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscription(apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + apiVersion, + options + }, + listBySubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Returns subscription feature registrations for given subscription. + * @param apiVersion The API version to use for this operation. + * @param [options] The optional parameters + * @returns Promise + */ + listAllBySubscription(apiVersion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param apiVersion The API version to use for this operation. + * @param callback The callback + */ + listAllBySubscription(apiVersion: string, callback: msRest.ServiceCallback): void; + /** + * @param apiVersion The API version to use for this operation. + * @param options The optional parameters + * @param callback The callback + */ + listAllBySubscription(apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAllBySubscription(apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + apiVersion, + options + }, + listAllBySubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Returns subscription feature registrations for given subscription and provider namespace. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscriptionNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. + * @param callback The callback + */ + listBySubscriptionNext(nextPageLink: string, apiVersion: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. + * @param options The optional parameters + * @param callback The callback + */ + listBySubscriptionNext(nextPageLink: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + apiVersion, + options + }, + listBySubscriptionNextOperationSpec, + callback) as Promise; + } + + /** + * Returns subscription feature registrations for given subscription. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. + * @param [options] The optional parameters + * @returns Promise + */ + listAllBySubscriptionNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. + * @param callback The callback + */ + listAllBySubscriptionNext(nextPageLink: string, apiVersion: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param apiVersion The API version to use for this operation. + * @param options The optional parameters + * @param callback The callback + */ + listAllBySubscriptionNext(nextPageLink: string, apiVersion: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAllBySubscriptionNext(nextPageLink: string, apiVersion: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + apiVersion, + options + }, + listAllBySubscriptionNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations/{featureName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.providerNamespace, + Parameters.featureName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionFeatureRegistration + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const createOrUpdateOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations/{featureName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.providerNamespace, + Parameters.featureName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: [ + "options", + "subscriptionFeatureRegistrationType" + ], + mapper: Mappers.SubscriptionFeatureRegistration + }, + responses: { + 200: { + bodyMapper: Mappers.SubscriptionFeatureRegistration + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations/{featureName}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.providerNamespace, + Parameters.featureName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listBySubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations", + urlParameters: [ + Parameters.subscriptionId, + Parameters.providerNamespace + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionFeatureRegistrationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listAllBySubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Features/subscriptionFeatureRegistrations", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionFeatureRegistrationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionFeatureRegistrationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listAllBySubscriptionNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionFeatureRegistrationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/features/arm-features/tsconfig.json b/sdk/features/arm-features/tsconfig.json index 87bbf5b5fa49..422b584abd5e 100644 --- a/sdk/features/arm-features/tsconfig.json +++ b/sdk/features/arm-features/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es6", "dom"], "declaration": true, "outDir": "./esm", "importHelpers": true