diff --git a/sdk/msi/arm-msi/LICENSE.txt b/sdk/msi/arm-msi/LICENSE.txt index a70e8cf66038..ea8fb1516028 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) 2020 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 c3f9cb728ff3..7380d72d3b86 100644 --- a/sdk/msi/arm-msi/README.md +++ b/sdk/msi/arm-msi/README.md @@ -9,23 +9,24 @@ This package contains an isomorphic SDK for ManagedServiceIdentityClient. ### How to Install -``` +```bash npm install @azure/arm-msi ``` ### How to use -#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. +#### nodejs - Authentication, client creation and getByScope systemAssignedIdentities as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth -``` -npm install @azure/ms-rest-nodeauth +- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. +```bash +npm install @azure/ms-rest-nodeauth@"^3.0.0" ``` ##### Sample code -```ts +```typescript import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; @@ -34,7 +35,8 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { 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); }); @@ -43,11 +45,11 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### 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. ##### Install @azure/ms-rest-browserauth -``` +```bash npm install @azure/ms-rest-browserauth ``` @@ -77,7 +79,8 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to authManager.login(); } const client = new Azure.ArmMsi.ManagedServiceIdentityClient(res.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) => { @@ -95,5 +98,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmsi%2Farm-msi%2FREADME.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/msi/arm-msi/README.png) diff --git a/sdk/msi/arm-msi/package.json b/sdk/msi/arm-msi/package.json index 04a96e27a6c5..e6455f67749e 100644 --- a/sdk/msi/arm-msi/package.json +++ b/sdk/msi/arm-msi/package.json @@ -4,9 +4,9 @@ "description": "ManagedServiceIdentityClient Library with typescript type definitions for node.js and browser.", "version": "1.1.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.1.0", - "@azure/ms-rest-js": "^1.1.0", - "tslib": "^1.9.3" + "@azure/ms-rest-azure-js": "^2.0.1", + "@azure/ms-rest-js": "^2.0.4", + "tslib": "^1.10.0" }, "keywords": [ "node", @@ -20,18 +20,19 @@ "module": "./esm/managedServiceIdentityClient.js", "types": "./esm/managedServiceIdentityClient.d.ts", "devDependencies": { - "typescript": "^3.1.1", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", - "uglify-js": "^3.4.9" + "typescript": "^3.5.3", + "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/master/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", @@ -43,6 +44,7 @@ "esm/**/*.d.ts", "esm/**/*.d.ts.map", "src/**/*.ts", + "README.md", "rollup.config.js", "tsconfig.json" ], @@ -52,5 +54,5 @@ "prepack": "npm install && npm run build" }, "sideEffects": false, - "authPublish": true + "autoPublish": true } diff --git a/sdk/msi/arm-msi/rollup.config.js b/sdk/msi/arm-msi/rollup.config.js index 9a44f3d82402..26253183196f 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", @@ -16,16 +22,16 @@ const config = { }, banner: `/* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * 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 2360b79199a9..cd7b58595b6e 100644 --- a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts +++ b/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts @@ -17,6 +17,7 @@ import { ManagedServiceIdentityClientContext } from "./managedServiceIdentityCli class ManagedServiceIdentityClient extends ManagedServiceIdentityClientContext { // Operation groups + systemAssignedIdentities: operations.SystemAssignedIdentities; operations: operations.Operations; userAssignedIdentities: operations.UserAssignedIdentities; @@ -28,6 +29,7 @@ class ManagedServiceIdentityClient extends ManagedServiceIdentityClientContext { */ constructor(credentials: msRest.ServiceClientCredentials, 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 f96cd5df3f4a..b11a37a1cae1 100644 --- a/sdk/msi/arm-msi/src/managedServiceIdentityClientContext.ts +++ b/sdk/msi/arm-msi/src/managedServiceIdentityClientContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/arm-msi"; -const packageVersion = "0.1.0"; +const packageVersion = "1.1.0"; export class ManagedServiceIdentityClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; @@ -44,7 +44,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..86946589b6ba 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. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * 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,236 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; - /** - * @interface - * An interface representing Identity. - * Describes an identity resource. - * - * @extends BaseResource + * An interface representing 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. Ex- 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 a ARM tracked top level 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 ARM proxy resource. It will have everything other than + * required location and tags + */ +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 a Azure Resource Manager resource with an etag. */ -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 +254,7 @@ export type OperationsListResponse = OperationListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -217,6 +274,7 @@ export type OperationsListNextResponse = OperationListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -236,6 +294,7 @@ export type UserAssignedIdentitiesListBySubscriptionResponse = UserAssignedIdent * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -255,6 +314,7 @@ export type UserAssignedIdentitiesListByResourceGroupResponse = UserAssignedIden * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -274,6 +334,7 @@ export type UserAssignedIdentitiesCreateOrUpdateResponse = Identity & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -293,6 +354,7 @@ export type UserAssignedIdentitiesUpdateResponse = Identity & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -312,6 +374,7 @@ export type UserAssignedIdentitiesGetResponse = Identity & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -331,6 +394,7 @@ export type UserAssignedIdentitiesListBySubscriptionNextResponse = UserAssignedI * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -350,6 +414,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..e2ffce89df3c 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. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * 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..689688180be7 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. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * 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..a0c98f337578 100644 --- a/sdk/msi/arm-msi/src/models/parameters.ts +++ b/sdk/msi/arm-msi/src/models/parameters.ts @@ -61,6 +61,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..1dd6bab81905 --- /dev/null +++ b/sdk/msi/arm-msi/src/models/systemAssignedIdentitiesMappers.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export { + 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..4c93bb7e4466 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. + * Licensed under the MIT License. See License.txt in the project root for license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * 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..c410b1e9c2da 100644 --- a/sdk/msi/arm-msi/src/operations/index.ts +++ b/sdk/msi/arm-msi/src/operations/index.ts @@ -8,5 +8,6 @@ * regenerated. */ +export * from "./systemAssignedIdentities"; export * from "./operations"; export * from "./userAssignedIdentities"; 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..178b1724dd09 --- /dev/null +++ b/sdk/msi/arm-msi/src/operations/systemAssignedIdentities.ts @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/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..3eea70db6b32 100644 --- a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts +++ b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts @@ -122,14 +122,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 +137,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 +372,7 @@ const updateOperationSpec: msRest.OperationSpec = { requestBody: { parameterPath: "parameters", mapper: { - ...Mappers.Identity, + ...Mappers.IdentityUpdate, required: true } }, 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