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..54b411908e89 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,7 +49,6 @@ 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) => { console.log("The result is:"); console.log(result); @@ -61,7 +58,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,7 +83,7 @@ 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) => { diff --git a/sdk/features/arm-features/package.json b/sdk/features/arm-features/package.json index 68689a5ab408..f3fc3cff92ec 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.1", "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/feature/v4/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..c33143da82d2 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,12 +29,13 @@ 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 [options] The parameter options */ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FeatureClientOptions) { super(credentials, subscriptionId, options); this.features = new operations.Features(this); + this.subscriptionFeatureRegistrations = new operations.SubscriptionFeatureRegistrations(this); } /** @@ -106,7 +107,7 @@ const listOperationsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.OperationListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -119,6 +120,9 @@ const listOperationsNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -127,7 +131,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 d7a5c987763c..9ed17aba92f1 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.1"; @@ -29,7 +28,7 @@ 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 [options] The parameter options */ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FeatureClientOptions) { @@ -50,7 +49,7 @@ export class FeatureClientContext extends msRestAzure.AzureServiceClient { super(credentials, options); - this.apiVersion = '2015-12-01'; + this.apiVersion = '2021-07-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; 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..07ac385340e0 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 @@ -143,6 +142,38 @@ export class Features { 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 [options] The optional parameters + * @returns Promise + */ + unregister(resourceProviderNamespace: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceProviderNamespace The namespace of the resource provider. + * @param featureName The name of the feature to unregister. + * @param callback The callback + */ + unregister(resourceProviderNamespace: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceProviderNamespace The namespace of the resource provider. + * @param featureName The name of the feature to unregister. + * @param options The optional parameters + * @param callback The callback + */ + unregister(resourceProviderNamespace: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + unregister(resourceProviderNamespace: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceProviderNamespace, + featureName, + 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. @@ -220,7 +251,7 @@ const listAllOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -244,7 +275,7 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -269,7 +300,7 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -294,7 +325,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 +363,9 @@ const listAllNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -315,7 +374,7 @@ const listAllNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.FeatureOperationsListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, serializer @@ -328,6 +387,9 @@ const listNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -336,7 +398,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..e77ad400975e --- /dev/null +++ b/sdk/features/arm-features/src/operations/subscriptionFeatureRegistrations.ts @@ -0,0 +1,409 @@ +/* + * 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 providerNamespace The provider namespace. + * @param featureName The feature name. + * @param [options] The optional parameters + * @returns Promise + */ + get(providerNamespace: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param callback The callback + */ + get(providerNamespace: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param options The optional parameters + * @param callback The callback + */ + get(providerNamespace: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(providerNamespace: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + providerNamespace, + featureName, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Create or update a feature registration. + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param [options] The optional parameters + * @returns Promise + */ + createOrUpdate(providerNamespace: string, featureName: string, options?: Models.SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams): Promise; + /** + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param callback The callback + */ + createOrUpdate(providerNamespace: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param options The optional parameters + * @param callback The callback + */ + createOrUpdate(providerNamespace: string, featureName: string, options: Models.SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams, callback: msRest.ServiceCallback): void; + createOrUpdate(providerNamespace: string, featureName: string, options?: Models.SubscriptionFeatureRegistrationsCreateOrUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + providerNamespace, + featureName, + options + }, + createOrUpdateOperationSpec, + callback) as Promise; + } + + /** + * Deletes a feature registration + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(providerNamespace: string, featureName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param callback The callback + */ + deleteMethod(providerNamespace: string, featureName: string, callback: msRest.ServiceCallback): void; + /** + * @param providerNamespace The provider namespace. + * @param featureName The feature name. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(providerNamespace: string, featureName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(providerNamespace: string, featureName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + providerNamespace, + featureName, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Returns subscription feature registrations for given subscription and provider namespace. + * @param providerNamespace The provider namespace. + * @param [options] The optional parameters + * @returns Promise + */ + listBySubscription(providerNamespace: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param providerNamespace The provider namespace. + * @param callback The callback + */ + listBySubscription(providerNamespace: string, callback: msRest.ServiceCallback): void; + /** + * @param providerNamespace The provider namespace. + * @param options The optional parameters + * @param callback The callback + */ + listBySubscription(providerNamespace: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscription(providerNamespace: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + providerNamespace, + options + }, + listBySubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Returns subscription feature registrations for given subscription. + * @param [options] The optional parameters + * @returns Promise + */ + listAllBySubscription(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + listAllBySubscription(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + listAllBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAllBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + 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 [options] The optional parameters + * @returns Promise + */ + listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listBySubscriptionNext(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 + */ + listBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + 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 [options] The optional parameters + * @returns Promise + */ + listAllBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listAllBySubscriptionNext(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 + */ + listAllBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAllBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + 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