diff --git a/sdk/msi/arm-msi/LICENSE.txt b/sdk/msi/arm-msi/LICENSE.txt index a70e8cf66038..2d3163745319 100644 --- a/sdk/msi/arm-msi/LICENSE.txt +++ b/sdk/msi/arm-msi/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 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/msi/arm-msi/README.md b/sdk/msi/arm-msi/README.md index f4e16fd5e9a5..e9b4e32d94fa 100644 --- a/sdk/msi/arm-msi/README.md +++ b/sdk/msi/arm-msi/README.md @@ -1,11 +1,11 @@ ## Azure ManagedServiceIdentityClient SDK for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ManagedServiceIdentityClient. +This package contains an isomorphic SDK (runs both in node.js and in browsers) for ManagedServiceIdentityClient. ### 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-msi @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 list operations as an example written in JavaScript. +#### nodejs - Authentication, client creation, and getByScope systemAssignedIdentities 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 ManagedServiceIdentityClient(creds, subscriptionId); - -client.operations.list().then((result) => { +const scope = "testscope"; +client.systemAssignedIdentities.getByScope(scope).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { @@ -61,7 +59,7 @@ client.operations.list().then((result) => { }); ``` -#### browser - Authentication, client creation, and list operations as an example written in JavaScript. +#### browser - Authentication, client creation, and getByScope systemAssignedIdentities 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.ArmMsi.ManagedServiceIdentityClient(creds, subscriptionId); - client.operations.list().then((result) => { + const scope = "testscope"; + client.systemAssignedIdentities.getByScope(scope).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { diff --git a/sdk/msi/arm-msi/package.json b/sdk/msi/arm-msi/package.json index 17813d7667fe..f0b0c76a7980 100644 --- a/sdk/msi/arm-msi/package.json +++ b/sdk/msi/arm-msi/package.json @@ -4,10 +4,10 @@ "description": "ManagedServiceIdentityClient Library with typescript type definitions for node.js and browser.", "version": "1.2.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,17 +22,18 @@ "types": "./esm/managedServiceIdentityClient.d.ts", "devDependencies": { "typescript": "^3.6.0", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", - "uglify-js": "^3.4.9" + "rollup": "^1.18.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.6.0" }, - "homepage": "https://github.com/azure/azure-sdk-for-js/tree/feature/v4/sdk/msi/arm-msi", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/msi/arm-msi", "repository": { "type": "git", - "url": "https://github.com/azure/azure-sdk-for-js.git" + "url": "https://github.com/Azure/azure-sdk-for-js.git" }, "bugs": { - "url": "https://github.com/azure/azure-sdk-for-js/issues" + "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", @@ -44,6 +45,7 @@ "esm/**/*.d.ts", "esm/**/*.d.ts.map", "src/**/*.ts", + "README.md", "rollup.config.js", "tsconfig.json" ], diff --git a/sdk/msi/arm-msi/rollup.config.js b/sdk/msi/arm-msi/rollup.config.js index 9a44f3d82402..0f5370c29395 100644 --- a/sdk/msi/arm-msi/rollup.config.js +++ b/sdk/msi/arm-msi/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/managedServiceIdentityClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/managedServiceIdentityClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/arm-msi.js", format: "umd", @@ -15,17 +21,17 @@ 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ mainFields: ['module', 'main'] }), + sourcemaps() ] }; + export default config; diff --git a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts b/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts index 75e4af9098c7..25e91f475cbd 100644 --- a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts +++ b/sdk/msi/arm-msi/src/managedServiceIdentityClient.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 @@ -18,6 +17,7 @@ import { ManagedServiceIdentityClientContext } from "./managedServiceIdentityCli class ManagedServiceIdentityClient extends ManagedServiceIdentityClientContext { // Operation groups + systemAssignedIdentities: operations.SystemAssignedIdentities; operations: operations.Operations; userAssignedIdentities: operations.UserAssignedIdentities; @@ -34,6 +34,7 @@ class ManagedServiceIdentityClient extends ManagedServiceIdentityClientContext { */ constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ManagedServiceIdentityClientOptions) { super(credentials, subscriptionId, options); + this.systemAssignedIdentities = new operations.SystemAssignedIdentities(this); this.operations = new operations.Operations(this); this.userAssignedIdentities = new operations.UserAssignedIdentities(this); } diff --git a/sdk/msi/arm-msi/src/managedServiceIdentityClientContext.ts b/sdk/msi/arm-msi/src/managedServiceIdentityClientContext.ts index 993908a8cc45..fdd2d4cc58fc 100644 --- a/sdk/msi/arm-msi/src/managedServiceIdentityClientContext.ts +++ b/sdk/msi/arm-msi/src/managedServiceIdentityClientContext.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-msi"; const packageVersion = "1.2.1"; @@ -50,7 +49,7 @@ export class ManagedServiceIdentityClientContext extends msRestAzure.AzureServic super(credentials, options); - this.apiVersion = '2015-08-31-preview'; + this.apiVersion = '2018-11-30'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; diff --git a/sdk/msi/arm-msi/src/models/index.ts b/sdk/msi/arm-msi/src/models/index.ts index f9a18808eae5..d3aa8fdd5e8d 100644 --- a/sdk/msi/arm-msi/src/models/index.ts +++ b/sdk/msi/arm-msi/src/models/index.ts @@ -1,11 +1,9 @@ /* - * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; @@ -13,178 +11,241 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; - /** - * @interface - * An interface representing Identity. - * Describes an identity resource. - * - * @extends BaseResource + * Common fields that are returned in the response for all Azure Resource Manager resources + * @summary Resource */ -export interface Identity extends BaseResource { +export interface Resource extends BaseResource { /** - * @member {string} [id] The id of the created identity. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * @member {string} [name] The name of the created identity. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The name of the resource + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly name?: string; /** - * @member {string} [location] The Azure region where the identity lives. + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + * "Microsoft.Storage/storageAccounts" + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; +} + +/** + * The resource model definition for an Azure Resource Manager tracked top level resource which has + * 'tags' and a 'location' + * @summary Tracked Resource + */ +export interface TrackedResource extends Resource { + /** + * Resource tags. + */ + tags?: { [propertyName: string]: string }; + /** + * The geo-location where the resource lives + */ + location: string; +} + +/** + * Describes an identity resource. + */ +export interface Identity extends TrackedResource { + /** + * The id of the tenant which the identity belongs to. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly tenantId?: string; + /** + * The id of the service principal object associated with the created identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly principalId?: string; + /** + * The id of the app associated with the identity. This is a random generated UUID by MSI. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly clientId?: string; +} + +/** + * Describes an identity resource. + */ +export interface IdentityUpdate extends Resource { + /** + * The geo-location where the resource lives */ location?: string; /** - * @member {{ [propertyName: string]: string }} [tags] Resource tags + * Resource tags */ tags?: { [propertyName: string]: string }; /** - * @member {string} [tenantId] The id of the tenant which the identity - * belongs to. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The id of the tenant which the identity belongs to. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly tenantId?: string; /** - * @member {string} [principalId] The id of the service principal object - * associated with the created identity. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The id of the service principal object associated with the created identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly principalId?: string; /** - * @member {string} [clientId] The id of the app associated with the - * identity. This is a random generated UUID by MSI. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The id of the app associated with the identity. This is a random generated UUID by MSI. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly clientId?: string; +} + +/** + * The resource model definition for a Azure Resource Manager proxy resource. It will not have tags + * and a location + * @summary Proxy Resource + */ +export interface ProxyResource extends Resource { +} + +/** + * Describes a system assigned identity resource. + */ +export interface SystemAssignedIdentity extends ProxyResource { /** - * @member {string} [clientSecretUrl] The ManagedServiceIdentity DataPlane - * URL that can be queried to obtain the identity credentials. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The geo-location where the resource lives */ - readonly clientSecretUrl?: string; + location: string; + /** + * Resource tags + */ + tags?: { [propertyName: string]: string }; + /** + * The id of the tenant which the identity belongs to. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly tenantId?: string; + /** + * The id of the service principal object associated with the created identity. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly principalId?: string; + /** + * The id of the app associated with the identity. This is a random generated UUID by MSI. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly clientId?: string; /** - * @member {UserAssignedIdentities} [type] The type of resource i.e. - * Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: - * 'Microsoft.ManagedIdentity/userAssignedIdentities' - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity + * credentials. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly type?: UserAssignedIdentities; + readonly clientSecretUrl?: string; } /** - * @interface - * An interface representing OperationDisplay. - * @summary Operation Display. - * * The object that describes the operation. - * + * @summary Operation Display. */ export interface OperationDisplay { /** - * @member {string} [provider] Resource Provider Name. Friendly name of the - * resource provider. + * Resource Provider Name. Friendly name of the resource provider. */ provider?: string; /** - * @member {string} [operation] Operation Type. The type of operation. For - * example: read, write, delete. + * Operation Type. The type of operation. For example: read, write, delete. */ operation?: string; /** - * @member {string} [resource] Resource Type. The resource type on which the - * operation is performed. + * Resource Type. The resource type on which the operation is performed. */ resource?: string; /** - * @member {string} [description] Operation description. A description of the - * operation. + * Operation description. A description of the operation. */ description?: string; } /** - * @interface - * An interface representing Operation. - * @summary Microsoft.ManagedIdentity Operation. - * * Operation supported by the Microsoft.ManagedIdentity REST API. - * + * @summary Microsoft.ManagedIdentity Operation. */ export interface Operation { /** - * @member {string} [name] Operation Name. The name of the REST Operation. - * This is of the format {provider}/{resource}/{operation}. + * Operation Name. The name of the REST Operation. This is of the format + * {provider}/{resource}/{operation}. */ name?: string; /** - * @member {OperationDisplay} [display] Operation Display. The object that - * describes the operation. + * Operation Display. The object that describes the operation. */ display?: OperationDisplay; } /** - * @interface - * An interface representing ManagedServiceIdentityClientOptions. - * @extends AzureServiceClientOptions + * The resource model definition for an Azure Resource Manager resource with an etag. + * @summary Entity Resource */ -export interface ManagedServiceIdentityClientOptions extends AzureServiceClientOptions { +export interface AzureEntityResource extends Resource { /** - * @member {string} [baseUri] + * Resource Etag. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - baseUri?: string; + readonly etag?: string; } +/** + * An interface representing ManagedServiceIdentityClientOptions. + */ +export interface ManagedServiceIdentityClientOptions extends AzureServiceClientOptions { + baseUri?: string; +} /** * @interface - * An interface representing the OperationListResult. + * A list of operations supported by Microsoft.ManagedIdentity Resource Provider. * @summary Operations List. - * - * A list of operations supported by Microsoft.ManagedIdentity Resource - * Provider. - * * @extends Array */ export interface OperationListResult extends Array { /** - * @member {string} [nextLink] The url to get the next page of results, if - * any. + * The url to get the next page of results, if any. */ nextLink?: string; } /** * @interface - * An interface representing the UserAssignedIdentitiesListResult. * Values returned by the List operation. - * * @extends Array */ export interface UserAssignedIdentitiesListResult extends Array { /** - * @member {string} [nextLink] The url to get the next page of results, if - * any. + * The url to get the next page of results, if any. */ nextLink?: string; } /** - * Defines values for UserAssignedIdentities. - * Possible values include: 'Microsoft.ManagedIdentity/userAssignedIdentities' - * @readonly - * @enum {string} + * Contains response data for the getByScope operation. */ -export type UserAssignedIdentities = 'Microsoft.ManagedIdentity/userAssignedIdentities'; +export type SystemAssignedIdentitiesGetByScopeResponse = SystemAssignedIdentity & { + /** + * 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: SystemAssignedIdentity; + }; +}; /** * Contains response data for the list operation. @@ -198,6 +259,7 @@ export type OperationsListResponse = OperationListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -217,6 +279,7 @@ export type OperationsListNextResponse = OperationListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -236,6 +299,7 @@ export type UserAssignedIdentitiesListBySubscriptionResponse = UserAssignedIdent * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -255,6 +319,7 @@ export type UserAssignedIdentitiesListByResourceGroupResponse = UserAssignedIden * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -274,6 +339,7 @@ export type UserAssignedIdentitiesCreateOrUpdateResponse = Identity & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -293,6 +359,7 @@ export type UserAssignedIdentitiesUpdateResponse = Identity & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -312,6 +379,7 @@ export type UserAssignedIdentitiesGetResponse = Identity & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -331,6 +399,7 @@ export type UserAssignedIdentitiesListBySubscriptionNextResponse = UserAssignedI * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -350,6 +419,7 @@ export type UserAssignedIdentitiesListByResourceGroupNextResponse = UserAssigned * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ diff --git a/sdk/msi/arm-msi/src/models/mappers.ts b/sdk/msi/arm-msi/src/models/mappers.ts index dea5dc5be474..66a3cb764e54 100644 --- a/sdk/msi/arm-msi/src/models/mappers.ts +++ b/sdk/msi/arm-msi/src/models/mappers.ts @@ -1,11 +1,9 @@ /* - * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; @@ -14,11 +12,11 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; -export const Identity: msRest.CompositeMapper = { - serializedName: "Identity", +export const Resource: msRest.CompositeMapper = { + serializedName: "Resource", type: { name: "Composite", - className: "Identity", + className: "Resource", modelProperties: { id: { readOnly: true, @@ -34,6 +32,85 @@ export const Identity: msRest.CompositeMapper = { name: "String" } }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: msRest.CompositeMapper = { + serializedName: "TrackedResource", + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const Identity: msRest.CompositeMapper = { + serializedName: "Identity", + type: { + name: "Composite", + className: "Identity", + modelProperties: { + ...TrackedResource.type.modelProperties, + tenantId: { + readOnly: true, + serializedName: "properties.tenantId", + type: { + name: "Uuid" + } + }, + principalId: { + readOnly: true, + serializedName: "properties.principalId", + type: { + name: "Uuid" + } + }, + clientId: { + readOnly: true, + serializedName: "properties.clientId", + type: { + name: "Uuid" + } + } + } + } +}; + +export const IdentityUpdate: msRest.CompositeMapper = { + serializedName: "IdentityUpdate", + type: { + name: "Composite", + className: "IdentityUpdate", + modelProperties: { + ...Resource.type.modelProperties, location: { serializedName: "location", type: { @@ -71,17 +148,71 @@ export const Identity: msRest.CompositeMapper = { type: { name: "Uuid" } + } + } + } +}; + +export const ProxyResource: msRest.CompositeMapper = { + serializedName: "ProxyResource", + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const SystemAssignedIdentity: msRest.CompositeMapper = { + serializedName: "SystemAssignedIdentity", + type: { + name: "Composite", + className: "SystemAssignedIdentity", + modelProperties: { + ...ProxyResource.type.modelProperties, + location: { + required: true, + serializedName: "location", + type: { + name: "String" + } }, - clientSecretUrl: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { + type: { + name: "String" + } + } + } + }, + tenantId: { readOnly: true, - serializedName: "properties.clientSecretUrl", + serializedName: "properties.tenantId", type: { - name: "String" + name: "Uuid" } }, - type: { + principalId: { readOnly: true, - serializedName: "type", + serializedName: "properties.principalId", + type: { + name: "Uuid" + } + }, + clientId: { + readOnly: true, + serializedName: "properties.clientId", + type: { + name: "Uuid" + } + }, + clientSecretUrl: { + readOnly: true, + serializedName: "properties.clientSecretUrl", type: { name: "String" } @@ -147,6 +278,24 @@ export const Operation: msRest.CompositeMapper = { } }; +export const AzureEntityResource: msRest.CompositeMapper = { + serializedName: "AzureEntityResource", + type: { + name: "Composite", + className: "AzureEntityResource", + modelProperties: { + ...Resource.type.modelProperties, + etag: { + readOnly: true, + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + export const OperationListResult: msRest.CompositeMapper = { serializedName: "OperationListResult", type: { diff --git a/sdk/msi/arm-msi/src/models/operationsMappers.ts b/sdk/msi/arm-msi/src/models/operationsMappers.ts index 2edcc577920e..938d3e665a23 100644 --- a/sdk/msi/arm-msi/src/models/operationsMappers.ts +++ b/sdk/msi/arm-msi/src/models/operationsMappers.ts @@ -1,17 +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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - OperationListResult, + CloudError, Operation, OperationDisplay, - CloudError + OperationListResult } from "../models/mappers"; - diff --git a/sdk/msi/arm-msi/src/models/parameters.ts b/sdk/msi/arm-msi/src/models/parameters.ts index 52c2fc91f383..606aa036a419 100644 --- a/sdk/msi/arm-msi/src/models/parameters.ts +++ b/sdk/msi/arm-msi/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 @@ -61,6 +60,17 @@ export const resourceName: msRest.OperationURLParameter = { } } }; +export const scope: msRest.OperationURLParameter = { + parameterPath: "scope", + mapper: { + required: true, + serializedName: "scope", + type: { + name: "String" + } + }, + skipEncoding: true +}; export const subscriptionId: msRest.OperationURLParameter = { parameterPath: "subscriptionId", mapper: { diff --git a/sdk/msi/arm-msi/src/models/systemAssignedIdentitiesMappers.ts b/sdk/msi/arm-msi/src/models/systemAssignedIdentitiesMappers.ts new file mode 100644 index 000000000000..a4a6c2712a4b --- /dev/null +++ b/sdk/msi/arm-msi/src/models/systemAssignedIdentitiesMappers.ts @@ -0,0 +1,19 @@ +/* + * 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 { + AzureEntityResource, + BaseResource, + CloudError, + Identity, + IdentityUpdate, + ProxyResource, + Resource, + SystemAssignedIdentity, + TrackedResource +} from "../models/mappers"; diff --git a/sdk/msi/arm-msi/src/models/userAssignedIdentitiesMappers.ts b/sdk/msi/arm-msi/src/models/userAssignedIdentitiesMappers.ts index 27f851e405f7..56578110fb35 100644 --- a/sdk/msi/arm-msi/src/models/userAssignedIdentitiesMappers.ts +++ b/sdk/msi/arm-msi/src/models/userAssignedIdentitiesMappers.ts @@ -1,17 +1,20 @@ /* - * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export { - UserAssignedIdentitiesListResult, - Identity, + AzureEntityResource, BaseResource, - CloudError + CloudError, + Identity, + IdentityUpdate, + ProxyResource, + Resource, + SystemAssignedIdentity, + TrackedResource, + UserAssignedIdentitiesListResult } from "../models/mappers"; - diff --git a/sdk/msi/arm-msi/src/operations/index.ts b/sdk/msi/arm-msi/src/operations/index.ts index 2df8e87dde37..fc8fcbc9f55c 100644 --- a/sdk/msi/arm-msi/src/operations/index.ts +++ b/sdk/msi/arm-msi/src/operations/index.ts @@ -1,12 +1,12 @@ /* - * 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 * from "./systemAssignedIdentities"; export * from "./operations"; export * from "./userAssignedIdentities"; diff --git a/sdk/msi/arm-msi/src/operations/operations.ts b/sdk/msi/arm-msi/src/operations/operations.ts index 9084ea1a3fed..c83bf1a92577 100644 --- a/sdk/msi/arm-msi/src/operations/operations.ts +++ b/sdk/msi/arm-msi/src/operations/operations.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 @@ -108,6 +107,9 @@ const listNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], diff --git a/sdk/msi/arm-msi/src/operations/systemAssignedIdentities.ts b/sdk/msi/arm-msi/src/operations/systemAssignedIdentities.ts new file mode 100644 index 000000000000..6090e3080d57 --- /dev/null +++ b/sdk/msi/arm-msi/src/operations/systemAssignedIdentities.ts @@ -0,0 +1,83 @@ +/* + * 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/systemAssignedIdentitiesMappers"; +import * as Parameters from "../models/parameters"; +import { ManagedServiceIdentityClientContext } from "../managedServiceIdentityClientContext"; + +/** Class representing a SystemAssignedIdentities. */ +export class SystemAssignedIdentities { + private readonly client: ManagedServiceIdentityClientContext; + + /** + * Create a SystemAssignedIdentities. + * @param {ManagedServiceIdentityClientContext} client Reference to the service client. + */ + constructor(client: ManagedServiceIdentityClientContext) { + this.client = client; + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * @param scope The resource provider scope of the resource. Parent resource being extended by + * Managed Identities. + * @param [options] The optional parameters + * @returns Promise + */ + getByScope(scope: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param scope The resource provider scope of the resource. Parent resource being extended by + * Managed Identities. + * @param callback The callback + */ + getByScope(scope: string, callback: msRest.ServiceCallback): void; + /** + * @param scope The resource provider scope of the resource. Parent resource being extended by + * Managed Identities. + * @param options The optional parameters + * @param callback The callback + */ + getByScope(scope: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getByScope(scope: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + scope, + options + }, + getByScopeOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getByScopeOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "{scope}/providers/Microsoft.ManagedIdentity/identities/default", + urlParameters: [ + Parameters.scope + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SystemAssignedIdentity + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts index 14db9b390413..10aacf218d70 100644 --- a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts +++ b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.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 @@ -122,14 +121,14 @@ export class UserAssignedIdentities { * @param [options] The optional parameters * @returns Promise */ - update(resourceGroupName: string, resourceName: string, parameters: Models.Identity, options?: msRest.RequestOptionsBase): Promise; + update(resourceGroupName: string, resourceName: string, parameters: Models.IdentityUpdate, options?: msRest.RequestOptionsBase): Promise; /** * @param resourceGroupName The name of the Resource Group to which the identity belongs. * @param resourceName The name of the identity resource. * @param parameters Parameters to update the identity * @param callback The callback */ - update(resourceGroupName: string, resourceName: string, parameters: Models.Identity, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, parameters: Models.IdentityUpdate, callback: msRest.ServiceCallback): void; /** * @param resourceGroupName The name of the Resource Group to which the identity belongs. * @param resourceName The name of the identity resource. @@ -137,8 +136,8 @@ export class UserAssignedIdentities { * @param options The optional parameters * @param callback The callback */ - update(resourceGroupName: string, resourceName: string, parameters: Models.Identity, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, resourceName: string, parameters: Models.Identity, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update(resourceGroupName: string, resourceName: string, parameters: Models.IdentityUpdate, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, parameters: Models.IdentityUpdate, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -372,7 +371,7 @@ const updateOperationSpec: msRest.OperationSpec = { requestBody: { parameterPath: "parameters", mapper: { - ...Mappers.Identity, + ...Mappers.IdentityUpdate, required: true } }, @@ -443,6 +442,9 @@ const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], @@ -464,6 +466,9 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { urlParameters: [ Parameters.nextPageLink ], + queryParameters: [ + Parameters.apiVersion + ], headerParameters: [ Parameters.acceptLanguage ], diff --git a/sdk/msi/arm-msi/tsconfig.json b/sdk/msi/arm-msi/tsconfig.json index 87bbf5b5fa49..422b584abd5e 100644 --- a/sdk/msi/arm-msi/tsconfig.json +++ b/sdk/msi/arm-msi/tsconfig.json @@ -9,7 +9,7 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es6", "dom"], "declaration": true, "outDir": "./esm", "importHelpers": true