diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 935ca74901a6..aa5c5abc7050 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -615,6 +615,19 @@ packages: - supports-color dev: false + /@azure/arm-msi/2.0.0: + resolution: {integrity: sha512-yBprEoMQRNLyHtR/RuJh8ehQCcF6rO5049Pfped79uRd/Y8EW+pNpbW0EjqWC5lVllC1VG4B89aC5PwE3XeISA==} + engines: {node: '>=12.0.0'} + dependencies: + '@azure/core-auth': 1.3.2 + '@azure/core-client': 1.5.0 + '@azure/core-paging': 1.2.1 + '@azure/core-rest-pipeline': 1.5.0 + tslib: 2.3.1 + transitivePeerDependencies: + - supports-color + dev: false + /@azure/arm-storage/17.0.0: resolution: {integrity: sha512-WS9eT3/vDQ7a1z/8K5BkPhoAi0ilo94yCSws4KyWq6UIA3RaXBDpYYAlN0TOxad9rPeOnWXWcB9gLw3DmjZ4wg==} engines: {node: '>=12.0.0'} @@ -10777,11 +10790,12 @@ packages: dev: false file:projects/arm-imagebuilder.tgz: - resolution: {integrity: sha512-kyj4FpY8IBE52Ojym8PqCldNoyZMUgbMZDUTT7hn7Rd7WF3N843VdO2uiLxTz+CCpZfvC2WDGY+H+wiCQeCcHQ==, tarball: file:projects/arm-imagebuilder.tgz} + resolution: {integrity: sha512-MIdrvaZ9seOdk3YVV0q3O5yR20B6LAAJLBt40WwqFCgPfpQTLKZjbJYQ8TjrZ+JWxVppXOAjFmPPOwO/b/xvLA==, tarball: file:projects/arm-imagebuilder.tgz} name: '@rush-temp/arm-imagebuilder' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 + '@azure/arm-msi': 2.0.0 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.19.4 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 @@ -13951,7 +13965,7 @@ packages: dev: false file:projects/core-lro.tgz: - resolution: {integrity: sha512-HBOLfQKGgGh53OwwMxd12xQyT0PfH3r+ajH/UmdsJ7+9MV2Z2QjFoZcrJVq/2Vpjolvfj8eLOhh43BujCaXpxA==, tarball: file:projects/core-lro.tgz} + resolution: {integrity: sha512-ewaXXxQnfcoQb9H1pkXNur7L86VeTvVvxx4s4BkJARNGh9tdf8ADHKGMDsmwh76hwWQQvM75cCxOAwURhOkgLw==, tarball: file:projects/core-lro.tgz} name: '@rush-temp/core-lro' version: 0.0.0 dependencies: @@ -15763,7 +15777,7 @@ packages: dev: false file:projects/perf-search-documents.tgz: - resolution: {integrity: sha512-AgXMuGJhPrpPiIQTYpATvq2ZEyH/zDApKB1hUCr6PR+w5SAXk7fAjTEafBvPHdtKgIJ4mGjQGvjbiqKeisbCUA==, tarball: file:projects/perf-search-documents.tgz} + resolution: {integrity: sha512-fDGQFcgVitwZW22LuRwj1sHE0wCl34WzYcSfeZAnr+k/lf9LCZKPxmDkCejI+PV5N2MY1bnoKw873zzOma8Adw==, tarball: file:projects/perf-search-documents.tgz} name: '@rush-temp/perf-search-documents' version: 0.0.0 dependencies: diff --git a/sdk/msi/arm-msi/CHANGELOG.md b/sdk/msi/arm-msi/CHANGELOG.md index ece4b8570321..5fc47bd788f4 100644 --- a/sdk/msi/arm-msi/CHANGELOG.md +++ b/sdk/msi/arm-msi/CHANGELOG.md @@ -1,15 +1,18 @@ # Release History - -## 2.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + +## 2.1.0-beta.1 (2022-03-07) + +**Features** + + - Added operation UserAssignedIdentities.listAssociatedResources + - Added Interface AssociatedResourcesListResult + - Added Interface AzureResource + - Added Interface UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams + - Added Interface UserAssignedIdentitiesListAssociatedResourcesOptionalParams + - Added Type Alias UserAssignedIdentitiesListAssociatedResourcesNextResponse + - Added Type Alias UserAssignedIdentitiesListAssociatedResourcesResponse + + ## 2.0.0 (2021-12-17) The package of @azure/arm-msi is using our next generation design principles since version 2.0.0, which contains breaking changes. diff --git a/sdk/msi/arm-msi/LICENSE b/sdk/msi/arm-msi/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/msi/arm-msi/LICENSE +++ b/sdk/msi/arm-msi/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 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 8970343ad4a3..371e7367d819 100644 --- a/sdk/msi/arm-msi/README.md +++ b/sdk/msi/arm-msi/README.md @@ -6,7 +6,7 @@ The Managed Service Identity Client. [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/msi/arm-msi) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-msi) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-msi) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-msi?view=azure-node-preview) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/msi/arm-msi/_meta.json b/sdk/msi/arm-msi/_meta.json index e5e3f3c5be03..c427813e799b 100644 --- a/sdk/msi/arm-msi/_meta.json +++ b/sdk/msi/arm-msi/_meta.json @@ -1,7 +1,7 @@ { - "commit": "7086ee861c3a6196bb98f8b327af11d03e545a05", + "commit": "6982e62694821ee3d46b0d49ebae173729ac5eaf", "readme": "specification/msi/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/msi/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211207.1", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/msi/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220105.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211207.1" + "use": "@autorest/typescript@6.0.0-alpha.16.20220105.1" } \ No newline at end of file diff --git a/sdk/msi/arm-msi/api-extractor.json b/sdk/msi/arm-msi/api-extractor.json index 2608bcec840c..e362393849f9 100644 --- a/sdk/msi/arm-msi/api-extractor.json +++ b/sdk/msi/arm-msi/api-extractor.json @@ -1,18 +1,31 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-msi.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/msi/arm-msi/package.json b/sdk/msi/arm-msi/package.json index 7d375995ab87..9a927c31bfea 100644 --- a/sdk/msi/arm-msi/package.json +++ b/sdk/msi/arm-msi/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ManagedServiceIdentityClient.", - "version": "2.0.1", + "version": "1.0.0-beta.1", "engines": { "node": ">=12.0.0" }, @@ -97,4 +97,4 @@ }, "sideEffects": false, "autoPublish": true -} +} \ No newline at end of file diff --git a/sdk/msi/arm-msi/review/arm-msi.api.md b/sdk/msi/arm-msi/review/arm-msi.api.md index bf98fb3bd1b1..92d0a381076b 100644 --- a/sdk/msi/arm-msi/review/arm-msi.api.md +++ b/sdk/msi/arm-msi/review/arm-msi.api.md @@ -8,6 +8,23 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; +// @public +export interface AssociatedResourcesListResult { + readonly nextLink?: string; + readonly totalCount?: number; + readonly value?: AzureResource[]; +} + +// @public +export interface AzureResource { + readonly id?: string; + readonly name?: string; + readonly resourceGroup?: string; + readonly subscriptionDisplayName?: string; + readonly subscriptionId?: string; + readonly type?: string; +} + // @public export interface CloudError { error?: CloudErrorBody; @@ -149,6 +166,7 @@ export interface UserAssignedIdentities { createOrUpdate(resourceGroupName: string, resourceName: string, parameters: Identity, options?: UserAssignedIdentitiesCreateOrUpdateOptionalParams): Promise; delete(resourceGroupName: string, resourceName: string, options?: UserAssignedIdentitiesDeleteOptionalParams): Promise; get(resourceGroupName: string, resourceName: string, options?: UserAssignedIdentitiesGetOptionalParams): Promise; + listAssociatedResources(resourceGroupName: string, resourceName: string, options?: UserAssignedIdentitiesListAssociatedResourcesOptionalParams): PagedAsyncIterableIterator; listByResourceGroup(resourceGroupName: string, options?: UserAssignedIdentitiesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; listBySubscription(options?: UserAssignedIdentitiesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; update(resourceGroupName: string, resourceName: string, parameters: IdentityUpdate, options?: UserAssignedIdentitiesUpdateOptionalParams): Promise; @@ -172,6 +190,30 @@ export interface UserAssignedIdentitiesGetOptionalParams extends coreClient.Oper // @public export type UserAssignedIdentitiesGetResponse = Identity; +// @public +export interface UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + skip?: number; + skiptoken?: string; + top?: number; +} + +// @public +export type UserAssignedIdentitiesListAssociatedResourcesNextResponse = AssociatedResourcesListResult; + +// @public +export interface UserAssignedIdentitiesListAssociatedResourcesOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + skip?: number; + skiptoken?: string; + top?: number; +} + +// @public +export type UserAssignedIdentitiesListAssociatedResourcesResponse = AssociatedResourcesListResult; + // @public export interface UserAssignedIdentitiesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { } diff --git a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts b/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts index 91601fdbee60..69974b8ed9ef 100644 --- a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts +++ b/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts @@ -52,7 +52,7 @@ export class ManagedServiceIdentityClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-msi/2.0.0`; + const packageDetails = `azsdk-js-arm-msi/2.1.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -75,7 +75,7 @@ export class ManagedServiceIdentityClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2018-11-30"; + this.apiVersion = options.apiVersion || "2021-09-30-preview"; this.systemAssignedIdentities = new SystemAssignedIdentitiesImpl(this); this.operations = new OperationsImpl(this); this.userAssignedIdentities = new UserAssignedIdentitiesImpl(this); diff --git a/sdk/msi/arm-msi/src/models/index.ts b/sdk/msi/arm-msi/src/models/index.ts index e285b206a7b1..e22117a14bce 100644 --- a/sdk/msi/arm-msi/src/models/index.ts +++ b/sdk/msi/arm-msi/src/models/index.ts @@ -81,6 +81,59 @@ export interface UserAssignedIdentitiesListResult { nextLink?: string; } +/** Azure resources returned by the resource action to get a list of assigned resources. */ +export interface AssociatedResourcesListResult { + /** + * Total number of Azure resources assigned to the identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalCount?: number; + /** + * The collection of Azure resources returned by the resource action to get a list of assigned resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: AzureResource[]; + /** + * The url to get the next page of results, if any. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Describes an Azure resource that is attached to an identity. */ +export interface AzureResource { + /** + * The ID of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The name of the resource group this resource belongs to. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceGroup?: string; + /** + * The ID of the subscription this resource belongs to. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subscriptionId?: string; + /** + * The name of the subscription this resource belongs to. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subscriptionDisplayName?: string; +} + /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ export type ProxyResource = Resource & {}; @@ -197,6 +250,24 @@ export interface UserAssignedIdentitiesListByResourceGroupOptionalParams /** Contains response data for the listByResourceGroup operation. */ export type UserAssignedIdentitiesListByResourceGroupResponse = UserAssignedIdentitiesListResult; +/** Optional parameters. */ +export interface UserAssignedIdentitiesListAssociatedResourcesOptionalParams + extends coreClient.OperationOptions { + /** OData filter expression to apply to the query. */ + filter?: string; + /** OData orderBy expression to apply to the query. */ + orderby?: string; + /** Number of records to return. */ + top?: number; + /** Number of records to skip. */ + skip?: number; + /** A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. */ + skiptoken?: string; +} + +/** Contains response data for the listAssociatedResources operation. */ +export type UserAssignedIdentitiesListAssociatedResourcesResponse = AssociatedResourcesListResult; + /** Optional parameters. */ export interface UserAssignedIdentitiesCreateOrUpdateOptionalParams extends coreClient.OperationOptions {} @@ -236,6 +307,24 @@ export interface UserAssignedIdentitiesListByResourceGroupNextOptionalParams /** Contains response data for the listByResourceGroupNext operation. */ export type UserAssignedIdentitiesListByResourceGroupNextResponse = UserAssignedIdentitiesListResult; +/** Optional parameters. */ +export interface UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams + extends coreClient.OperationOptions { + /** OData filter expression to apply to the query. */ + filter?: string; + /** OData orderBy expression to apply to the query. */ + orderby?: string; + /** Number of records to return. */ + top?: number; + /** Number of records to skip. */ + skip?: number; + /** A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. */ + skiptoken?: string; +} + +/** Contains response data for the listAssociatedResourcesNext operation. */ +export type UserAssignedIdentitiesListAssociatedResourcesNextResponse = AssociatedResourcesListResult; + /** Optional parameters. */ export interface ManagedServiceIdentityClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/msi/arm-msi/src/models/mappers.ts b/sdk/msi/arm-msi/src/models/mappers.ts index eb088f84eaa2..9a50ef574499 100644 --- a/sdk/msi/arm-msi/src/models/mappers.ts +++ b/sdk/msi/arm-msi/src/models/mappers.ts @@ -202,6 +202,93 @@ export const UserAssignedIdentitiesListResult: coreClient.CompositeMapper = { } }; +export const AssociatedResourcesListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssociatedResourcesListResult", + modelProperties: { + totalCount: { + serializedName: "totalCount", + readOnly: true, + type: { + name: "Number" + } + }, + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AzureResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + resourceGroup: { + serializedName: "resourceGroup", + readOnly: true, + type: { + name: "String" + } + }, + subscriptionId: { + serializedName: "subscriptionId", + readOnly: true, + type: { + name: "String" + } + }, + subscriptionDisplayName: { + serializedName: "subscriptionDisplayName", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const ProxyResource: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/msi/arm-msi/src/models/parameters.ts b/sdk/msi/arm-msi/src/models/parameters.ts index 3ba8bcca3d81..9ed5f1d4762e 100644 --- a/sdk/msi/arm-msi/src/models/parameters.ts +++ b/sdk/msi/arm-msi/src/models/parameters.ts @@ -55,7 +55,7 @@ export const scope: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2018-11-30", + defaultValue: "2021-09-30-preview", isConstant: true, serializedName: "api-version", type: { @@ -98,6 +98,73 @@ export const resourceGroupName: OperationURLParameter = { } }; +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const orderby: OperationQueryParameter = { + parameterPath: ["options", "orderby"], + mapper: { + serializedName: "$orderby", + type: { + name: "String" + } + } +}; + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], + mapper: { + constraints: { + InclusiveMinimum: 1 + }, + serializedName: "$top", + type: { + name: "Number" + } + } +}; + +export const skip: OperationQueryParameter = { + parameterPath: ["options", "skip"], + mapper: { + constraints: { + InclusiveMinimum: 1 + }, + serializedName: "$skip", + type: { + name: "Number" + } + } +}; + +export const skiptoken: OperationQueryParameter = { + parameterPath: ["options", "skiptoken"], + mapper: { + serializedName: "$skiptoken", + type: { + name: "String" + } + } +}; + export const contentType: OperationParameter = { parameterPath: ["options", "contentType"], mapper: { @@ -115,17 +182,6 @@ export const parameters: OperationParameter = { mapper: IdentityMapper }; -export const resourceName: OperationURLParameter = { - parameterPath: "resourceName", - mapper: { - serializedName: "resourceName", - required: true, - type: { - name: "String" - } - } -}; - export const parameters1: OperationParameter = { parameterPath: "parameters", mapper: IdentityUpdateMapper diff --git a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts index 866488503fe5..99b234df470b 100644 --- a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts +++ b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts @@ -18,8 +18,12 @@ import { UserAssignedIdentitiesListBySubscriptionOptionalParams, UserAssignedIdentitiesListByResourceGroupNextOptionalParams, UserAssignedIdentitiesListByResourceGroupOptionalParams, + AzureResource, + UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams, + UserAssignedIdentitiesListAssociatedResourcesOptionalParams, UserAssignedIdentitiesListBySubscriptionResponse, UserAssignedIdentitiesListByResourceGroupResponse, + UserAssignedIdentitiesListAssociatedResourcesResponse, UserAssignedIdentitiesCreateOrUpdateOptionalParams, UserAssignedIdentitiesCreateOrUpdateResponse, IdentityUpdate, @@ -29,7 +33,8 @@ import { UserAssignedIdentitiesGetResponse, UserAssignedIdentitiesDeleteOptionalParams, UserAssignedIdentitiesListBySubscriptionNextResponse, - UserAssignedIdentitiesListByResourceGroupNextResponse + UserAssignedIdentitiesListByResourceGroupNextResponse, + UserAssignedIdentitiesListAssociatedResourcesNextResponse } from "../models"; /// @@ -140,6 +145,77 @@ export class UserAssignedIdentitiesImpl implements UserAssignedIdentities { } } + /** + * Lists the associated resources for this identity. + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param options The options parameters. + */ + public listAssociatedResources( + resourceGroupName: string, + resourceName: string, + options?: UserAssignedIdentitiesListAssociatedResourcesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAssociatedResourcesPagingAll( + resourceGroupName, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listAssociatedResourcesPagingPage( + resourceGroupName, + resourceName, + options + ); + } + }; + } + + private async *listAssociatedResourcesPagingPage( + resourceGroupName: string, + resourceName: string, + options?: UserAssignedIdentitiesListAssociatedResourcesOptionalParams + ): AsyncIterableIterator { + let result = await this._listAssociatedResources( + resourceGroupName, + resourceName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listAssociatedResourcesNext( + resourceGroupName, + resourceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listAssociatedResourcesPagingAll( + resourceGroupName: string, + resourceName: string, + options?: UserAssignedIdentitiesListAssociatedResourcesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAssociatedResourcesPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } + } + /** * Lists all the userAssignedIdentities available under the specified subscription. * @param options The options parameters. @@ -168,6 +244,23 @@ export class UserAssignedIdentitiesImpl implements UserAssignedIdentities { ); } + /** + * Lists the associated resources for this identity. + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param options The options parameters. + */ + private _listAssociatedResources( + resourceGroupName: string, + resourceName: string, + options?: UserAssignedIdentitiesListAssociatedResourcesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listAssociatedResourcesOperationSpec + ); + } + /** * Create or update an identity in the specified subscription and resource group. * @param resourceGroupName The name of the Resource Group to which the identity belongs. @@ -271,6 +364,26 @@ export class UserAssignedIdentitiesImpl implements UserAssignedIdentities { listByResourceGroupNextOperationSpec ); } + + /** + * ListAssociatedResourcesNext + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param nextLink The nextLink from the previous successful call to the ListAssociatedResources + * method. + * @param options The options parameters. + */ + private _listAssociatedResourcesNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, nextLink, options }, + listAssociatedResourcesNextOperationSpec + ); + } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); @@ -313,6 +426,35 @@ const listByResourceGroupOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listAssociatedResourcesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/listAssociatedResources", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AssociatedResourcesListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.orderby, + Parameters.top, + Parameters.skip, + Parameters.skiptoken + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; const createOrUpdateOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}", @@ -448,3 +590,32 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; +const listAssociatedResourcesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AssociatedResourcesListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.orderby, + Parameters.top, + Parameters.skip, + Parameters.skiptoken + ], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts b/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts index c29c170025bf..231f3dfa3330 100644 --- a/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts +++ b/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts @@ -11,6 +11,8 @@ import { Identity, UserAssignedIdentitiesListBySubscriptionOptionalParams, UserAssignedIdentitiesListByResourceGroupOptionalParams, + AzureResource, + UserAssignedIdentitiesListAssociatedResourcesOptionalParams, UserAssignedIdentitiesCreateOrUpdateOptionalParams, UserAssignedIdentitiesCreateOrUpdateResponse, IdentityUpdate, @@ -40,6 +42,17 @@ export interface UserAssignedIdentities { resourceGroupName: string, options?: UserAssignedIdentitiesListByResourceGroupOptionalParams ): PagedAsyncIterableIterator; + /** + * Lists the associated resources for this identity. + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param options The options parameters. + */ + listAssociatedResources( + resourceGroupName: string, + resourceName: string, + options?: UserAssignedIdentitiesListAssociatedResourcesOptionalParams + ): PagedAsyncIterableIterator; /** * Create or update an identity in the specified subscription and resource group. * @param resourceGroupName The name of the Resource Group to which the identity belongs. diff --git a/sdk/msi/arm-msi/tsconfig.json b/sdk/msi/arm-msi/tsconfig.json index 6e3251194117..3e6ae96443f3 100644 --- a/sdk/msi/arm-msi/tsconfig.json +++ b/sdk/msi/arm-msi/tsconfig.json @@ -9,11 +9,19 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/msi/ci.mgmt.yml b/sdk/msi/ci.mgmt.yml index 716fc22a4a7f..3c1f53eb976f 100644 --- a/sdk/msi/ci.mgmt.yml +++ b/sdk/msi/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -10,6 +10,7 @@ trigger: include: - sdk/msi/ci.mgmt.yml - sdk/msi/arm-msi/ + - sdk/msi/arm-msi pr: branches: include: @@ -23,11 +24,11 @@ pr: include: - sdk/msi/ci.mgmt.yml - sdk/msi/arm-msi/ - + - sdk/msi/arm-msi extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: msi Artifacts: - name: azure-arm-msi - safeName: azurearmmsi \ No newline at end of file + safeName: azurearmmsi