From c0b5758f31b6bde7393ebef68182af27c93a4705 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 31 Jan 2023 14:47:53 +0000 Subject: [PATCH] CodeGen from PR 22354 in Azure/azure-rest-api-specs Merge b9d3fed756a3416c0d8cbb4b6e6466c7d0aae3ac into 630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f --- common/config/rush/pnpm-lock.yaml | 54 ++-- sdk/msi/arm-msi/CHANGELOG.md | 27 +- sdk/msi/arm-msi/LICENSE | 2 +- sdk/msi/arm-msi/README.md | 2 +- sdk/msi/arm-msi/_meta.json | 8 +- sdk/msi/arm-msi/package.json | 19 +- sdk/msi/arm-msi/review/arm-msi.api.md | 69 ++--- sdk/msi/arm-msi/src/index.ts | 1 + .../src/managedServiceIdentityClient.ts | 45 ++-- sdk/msi/arm-msi/src/models/index.ts | 143 ++++------- sdk/msi/arm-msi/src/models/mappers.ts | 139 ++++------- sdk/msi/arm-msi/src/models/parameters.ts | 77 +++--- .../federatedIdentityCredentials.ts | 65 +++-- sdk/msi/arm-msi/src/operations/operations.ts | 30 ++- .../src/operations/userAssignedIdentities.ts | 236 ++++-------------- .../federatedIdentityCredentials.ts | 8 +- .../userAssignedIdentities.ts | 13 - sdk/msi/arm-msi/src/pagingHelper.ts | 39 +++ sdk/msi/arm-msi/tsconfig.json | 10 +- 19 files changed, 380 insertions(+), 607 deletions(-) create mode 100644 sdk/msi/arm-msi/src/pagingHelper.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9e1d6b32806e..32a6ecb4d01a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1967,7 +1967,7 @@ packages: rollup: 2.79.1 dev: false - /@rollup/plugin-typescript/10.0.1_bgwi2fgwyi362qsw25gfipc3ca: + /@rollup/plugin-typescript/10.0.1_bhcmvni67fkldpaxrtldxbogce: resolution: {integrity: sha512-wBykxRLlX7EzL8BmUqMqk5zpx2onnmRMSw/l9M1sVfkJvdwfxogZQVNUM9gVMJbjRLDR5H6U0OMOrlDGmIV45A==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1984,7 +1984,7 @@ packages: resolve: 1.22.1 rollup: 2.79.1 tslib: 2.5.0 - typescript: 4.9.4 + typescript: 4.9.5 dev: false /@rollup/plugin-virtual/2.1.0_rollup@2.79.1: @@ -3807,7 +3807,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.0.0-dev.20230130 + typescript: 5.0.0-dev.20230131 dev: false /downlevel-dts/0.7.0: @@ -3816,7 +3816,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 4.9.4 + typescript: 4.9.5 dev: false /downlevel-dts/0.8.0: @@ -3825,7 +3825,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 4.9.4 + typescript: 4.9.5 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8311,7 +8311,7 @@ packages: hasBin: true dev: false - /ts-node/10.9.1_gjo33tkf7m2dtuw6tmxt3xwf4q: + /ts-node/10.9.1_7iyetdgfmqiorh7qupktbe7tm4: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8337,12 +8337,12 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.8.4 + typescript: 4.9.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false - /ts-node/10.9.1_hrxs3cimgx563ee773t2eh6j4y: + /ts-node/10.9.1_gjo33tkf7m2dtuw6tmxt3xwf4q: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8368,12 +8368,12 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.2.4 + typescript: 4.8.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false - /ts-node/10.9.1_laqv367ntbladgchwutjrnj4ky: + /ts-node/10.9.1_hrxs3cimgx563ee773t2eh6j4y: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8392,19 +8392,19 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 - '@types/node': 17.0.45 + '@types/node': 14.18.36 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.6.4 + typescript: 4.2.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false - /ts-node/10.9.1_ocil65wecyuhsmrrocoajouipe: + /ts-node/10.9.1_laqv367ntbladgchwutjrnj4ky: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8423,14 +8423,14 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 - '@types/node': 14.18.36 + '@types/node': 17.0.45 acorn: 8.8.2 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.9.4 + typescript: 4.6.4 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: false @@ -8647,14 +8647,14 @@ packages: hasBin: true dev: false - /typescript/4.9.4: - resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==} + /typescript/4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} engines: {node: '>=4.2.0'} hasBin: true dev: false - /typescript/5.0.0-dev.20230130: - resolution: {integrity: sha512-4zmbh58Vt3HDAD0AvHr1ccmAkKKODriYMNajcSzUylVgXCXrNGTJOReMp54GBs67KfQFaLOpVZlLrlD2FKn9Kg==} + /typescript/5.0.0-dev.20230131: + resolution: {integrity: sha512-A1VAxSLhrW5D7zq7nLkE36JAfDL72gJrN8p5Y6zvvndkOGtfgJp3//M0iqCRfLe0l8noJb8cRI+kdpgSuC1giw==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -13095,7 +13095,7 @@ packages: dev: false file:projects/arm-msi.tgz: - resolution: {integrity: sha512-7WhqaXYe1gaajUpN330AFS9o4ZzO836by2vQROb6+mfPnx5cXODNbf7MiRM+3lgNTxy1n+piE4s2ScsCDZD6zw==, tarball: file:projects/arm-msi.tgz} + resolution: {integrity: sha512-ASwo+S9K6HVfzUK8tGyRhVfzmcG+Yc4brfg064Wr+sUB0Cg0CVtax0hrQVpmA3evNw7vTuTCFqQiWKP6E+GT+A==, tarball: file:projects/arm-msi.tgz} name: '@rush-temp/arm-msi' version: 0.0.0 dependencies: @@ -13106,18 +13106,18 @@ packages: '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 '@types/chai': 4.3.4 + '@types/node': 14.18.36 chai: 4.3.7 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 tslib: 2.5.0 - typescript: 4.2.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - supports-color dev: false @@ -16460,7 +16460,7 @@ packages: name: '@rush-temp/dev-tool' version: 0.0.0 dependencies: - '@_ts/max': /typescript/4.9.4 + '@_ts/max': /typescript/4.9.5 '@_ts/min': /typescript/4.2.4 '@microsoft/api-extractor': 7.34.0 '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 @@ -17890,7 +17890,7 @@ packages: version: 0.0.0 dependencies: '@microsoft/api-extractor': 7.34.0 - '@rollup/plugin-typescript': 10.0.1_bgwi2fgwyi362qsw25gfipc3ca + '@rollup/plugin-typescript': 10.0.1_bhcmvni67fkldpaxrtldxbogce '@types/chai': 4.3.4 '@types/mocha': 7.0.2 '@types/node': 14.18.36 @@ -17922,9 +17922,9 @@ packages: rollup: 2.79.1 rollup-plugin-shim: 1.0.0 rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 - ts-node: 10.9.1_ocil65wecyuhsmrrocoajouipe + ts-node: 10.9.1_7iyetdgfmqiorh7qupktbe7tm4 tslib: 2.5.0 - typescript: 4.9.4 + typescript: 4.9.5 util: 0.12.5 uuid: 9.0.0 transitivePeerDependencies: diff --git a/sdk/msi/arm-msi/CHANGELOG.md b/sdk/msi/arm-msi/CHANGELOG.md index bc78e4a2da8b..28021985af25 100644 --- a/sdk/msi/arm-msi/CHANGELOG.md +++ b/sdk/msi/arm-msi/CHANGELOG.md @@ -1,23 +1,10 @@ # Release History - -## 2.1.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 2.1.0-beta.2 (2022-06-27) + +## 2.1.0 (2023-01-31) **Features** - Added operation group FederatedIdentityCredentials - - Added operation UserAssignedIdentities.listAssociatedResources - - Added Interface AssociatedResourcesListResult - - Added Interface AzureResource - Added Interface FederatedIdentityCredential - Added Interface FederatedIdentityCredentialsCreateOrUpdateOptionalParams - Added Interface FederatedIdentityCredentialsDeleteOptionalParams @@ -29,16 +16,16 @@ - Added Interface IdentityUpdate - Added Interface ProxyResource - Added Interface SystemAssignedIdentity + - Added Interface SystemData - Added Interface TrackedResource - - Added Interface UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams - - Added Interface UserAssignedIdentitiesListAssociatedResourcesOptionalParams + - Added Type Alias CreatedByType - Added Type Alias FederatedIdentityCredentialsCreateOrUpdateResponse - Added Type Alias FederatedIdentityCredentialsGetResponse - Added Type Alias FederatedIdentityCredentialsListNextResponse - Added Type Alias FederatedIdentityCredentialsListResponse - - Added Type Alias UserAssignedIdentitiesListAssociatedResourcesNextResponse - - Added Type Alias UserAssignedIdentitiesListAssociatedResourcesResponse - - Class ManagedServiceIdentityClient has a new parameter federatedIdentityCredentials + - Interface Resource has a new optional parameter systemData + - Added Enum KnownCreatedByType + - Added function getContinuationToken ## 2.0.0 (2021-12-17) diff --git a/sdk/msi/arm-msi/LICENSE b/sdk/msi/arm-msi/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/msi/arm-msi/LICENSE +++ b/sdk/msi/arm-msi/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 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 e8f833aa03d0..22ab05af1e0d 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?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-msi) | [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 e69f8948502f..177cf26c2261 100644 --- a/sdk/msi/arm-msi/_meta.json +++ b/sdk/msi/arm-msi/_meta.json @@ -1,8 +1,8 @@ { - "commit": "fda2db441da3f1fab31bb235e97da3e33c8e3903", + "commit": "a29cb9769123ba1922ce8585c7f2cda0827edb40", "readme": "specification/msi/resource-manager/readme.md", - "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=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\msi\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/msi/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.5", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.3.2", - "use": "@autorest/typescript@6.0.0-rc.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.1", + "use": "@autorest/typescript@6.0.0-rc.5" } \ No newline at end of file diff --git a/sdk/msi/arm-msi/package.json b/sdk/msi/arm-msi/package.json index e41e03f99ef7..2df6b1109fde 100644 --- a/sdk/msi/arm-msi/package.json +++ b/sdk/msi/arm-msi/package.json @@ -3,13 +3,13 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ManagedServiceIdentityClient.", - "version": "2.1.0-beta.3", + "version": "2.1.0", "engines": { "node": ">=14.0.0" }, "dependencies": { "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -34,7 +34,7 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.2.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", @@ -44,6 +44,7 @@ "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", + "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/msi/arm-msi", @@ -107,13 +108,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-msi?view=azure-node-preview" - } -} + "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 498afe505b1d..c3de03dac18d 100644 --- a/sdk/msi/arm-msi/review/arm-msi.api.md +++ b/sdk/msi/arm-msi/review/arm-msi.api.md @@ -8,23 +8,6 @@ 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; @@ -38,6 +21,9 @@ export interface CloudErrorBody { target?: string; } +// @public +export type CreatedByType = string; + // @public export interface FederatedIdentityCredential extends ProxyResource { audiences?: string[]; @@ -73,8 +59,6 @@ export type FederatedIdentityCredentialsGetResponse = FederatedIdentityCredentia // @public export interface FederatedIdentityCredentialsListNextOptionalParams extends coreClient.OperationOptions { - skiptoken?: string; - top?: number; } // @public @@ -95,6 +79,9 @@ export interface FederatedIdentityCredentialsListResult { value?: FederatedIdentityCredential[]; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface Identity extends TrackedResource { readonly clientId?: string; @@ -113,6 +100,14 @@ export interface IdentityUpdate extends Resource { readonly tenantId?: string; } +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + // @public (undocumented) export class ManagedServiceIdentityClient extends coreClient.ServiceClient { // (undocumented) @@ -186,6 +181,7 @@ export interface ProxyResource extends Resource { export interface Resource { readonly id?: string; readonly name?: string; + readonly systemData?: SystemData; readonly type?: string; } @@ -213,6 +209,16 @@ export interface SystemAssignedIdentity extends ProxyResource { readonly tenantId?: string; } +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + // @public export interface TrackedResource extends Resource { location: string; @@ -226,7 +232,6 @@ 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; @@ -250,30 +255,6 @@ 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/index.ts b/sdk/msi/arm-msi/src/index.ts index 262cf486faa8..89694727a4ae 100644 --- a/sdk/msi/arm-msi/src/index.ts +++ b/sdk/msi/arm-msi/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { ManagedServiceIdentityClient } from "./managedServiceIdentityClient"; export * from "./operationsInterfaces"; diff --git a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts b/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts index d394acd67e14..4e8956b9e9dd 100644 --- a/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts +++ b/sdk/msi/arm-msi/src/managedServiceIdentityClient.ts @@ -60,7 +60,7 @@ export class ManagedServiceIdentityClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-msi/2.1.0-beta.3`; + const packageDetails = `azsdk-js-arm-msi/2.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -72,39 +72,48 @@ export class ManagedServiceIdentityClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: + endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + let bearerTokenAuthenticationPolicyFound: boolean = false; if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( (pipelinePolicy) => pipelinePolicy.name === coreRestPipeline.bearerTokenAuthenticationPolicyName ); - if (!bearerTokenAuthenticationPolicyFound) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - scopes: `${optionsWithDefaults.baseUri}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); } // Parameter assignments this.subscriptionId = subscriptionId; // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-01-31-preview"; + this.apiVersion = options.apiVersion || "2023-01-31"; 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 0730eb0150ad..7a417e18b357 100644 --- a/sdk/msi/arm-msi/src/models/index.ts +++ b/sdk/msi/arm-msi/src/models/index.ts @@ -11,7 +11,7 @@ import * as coreClient from "@azure/core-client"; /** Common fields that are returned in the response for all Azure Resource Manager resources */ export interface Resource { /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * Fully qualified resource ID for the resource. E.g. "/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; @@ -25,6 +25,27 @@ export interface Resource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; } /** An error response from the ManagedServiceIdentity service. */ @@ -81,59 +102,6 @@ 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; -} - /** Values returned by the List operation for federated identity credentials. */ export interface FederatedIdentityCredentialsListResult { /** The collection of federated identity credentials returned by the listing operation. */ @@ -233,6 +201,30 @@ export interface Identity extends TrackedResource { readonly clientId?: string; } +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + /** Optional parameters. */ export interface SystemAssignedIdentitiesGetByScopeOptionalParams extends coreClient.OperationOptions {} @@ -268,24 +260,6 @@ 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 {} @@ -325,24 +299,6 @@ 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 FederatedIdentityCredentialsListOptionalParams extends coreClient.OperationOptions { @@ -375,12 +331,7 @@ export interface FederatedIdentityCredentialsDeleteOptionalParams /** Optional parameters. */ export interface FederatedIdentityCredentialsListNextOptionalParams - extends coreClient.OperationOptions { - /** Number of records to return. */ - top?: 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; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type FederatedIdentityCredentialsListNextResponse = FederatedIdentityCredentialsListResult; diff --git a/sdk/msi/arm-msi/src/models/mappers.ts b/sdk/msi/arm-msi/src/models/mappers.ts index b1eb7f2a4d5a..caa3d91968f1 100644 --- a/sdk/msi/arm-msi/src/models/mappers.ts +++ b/sdk/msi/arm-msi/src/models/mappers.ts @@ -33,6 +33,58 @@ export const Resource: coreClient.CompositeMapper = { type: { name: "String" } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } } } } @@ -202,93 +254,6 @@ 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 FederatedIdentityCredentialsListResult: 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 e9aba8ecd9c9..f5d51b5879ae 100644 --- a/sdk/msi/arm-msi/src/models/parameters.ts +++ b/sdk/msi/arm-msi/src/models/parameters.ts @@ -56,7 +56,7 @@ export const scope: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-01-31-preview", + defaultValue: "2023-01-31", isConstant: true, serializedName: "api-version", type: { @@ -99,57 +99,61 @@ export const resourceGroupName: OperationURLParameter = { } }; -export const resourceName: OperationURLParameter = { - parameterPath: "resourceName", +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "resourceName", - required: true, + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const filter: OperationQueryParameter = { - parameterPath: ["options", "filter"], - mapper: { - serializedName: "$filter", - type: { - name: "String" - } - } +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: IdentityMapper }; -export const orderby: OperationQueryParameter = { - parameterPath: ["options", "orderby"], +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", mapper: { - serializedName: "$orderby", + serializedName: "resourceName", + required: true, type: { name: "String" } } }; -export const top: OperationQueryParameter = { - parameterPath: ["options", "top"], +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: IdentityUpdateMapper +}; + +export const resourceGroupName1: OperationURLParameter = { + parameterPath: "resourceGroupName", mapper: { constraints: { - InclusiveMinimum: 1 + MaxLength: 90, + MinLength: 1 }, - serializedName: "$top", + serializedName: "resourceGroupName", + required: true, type: { - name: "Number" + name: "String" } } }; -export const skip: OperationQueryParameter = { - parameterPath: ["options", "skip"], +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], mapper: { constraints: { InclusiveMinimum: 1 }, - serializedName: "$skip", + serializedName: "$top", type: { name: "Number" } @@ -166,28 +170,6 @@ export const skiptoken: OperationQueryParameter = { } }; -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - -export const parameters: OperationParameter = { - parameterPath: "parameters", - mapper: IdentityMapper -}; - -export const parameters1: OperationParameter = { - parameterPath: "parameters", - mapper: IdentityUpdateMapper -}; - export const parameters2: OperationParameter = { parameterPath: "parameters", mapper: FederatedIdentityCredentialMapper @@ -196,6 +178,9 @@ export const parameters2: OperationParameter = { export const federatedIdentityCredentialResourceName: OperationURLParameter = { parameterPath: "federatedIdentityCredentialResourceName", mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9]{1}[a-zA-Z0-9-_]{2,119}$") + }, serializedName: "federatedIdentityCredentialResourceName", required: true, type: { diff --git a/sdk/msi/arm-msi/src/operations/federatedIdentityCredentials.ts b/sdk/msi/arm-msi/src/operations/federatedIdentityCredentials.ts index b7b85607be27..7256b31b58fe 100644 --- a/sdk/msi/arm-msi/src/operations/federatedIdentityCredentials.ts +++ b/sdk/msi/arm-msi/src/operations/federatedIdentityCredentials.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { FederatedIdentityCredentials } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -41,7 +42,7 @@ export class FederatedIdentityCredentialsImpl /** * Lists all the federated identity credentials under the specified user assigned identity. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param options The options parameters. */ @@ -58,8 +59,16 @@ export class FederatedIdentityCredentialsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, resourceName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + resourceName, + options, + settings + ); } }; } @@ -67,11 +76,18 @@ export class FederatedIdentityCredentialsImpl private async *listPagingPage( resourceGroupName: string, resourceName: string, - options?: FederatedIdentityCredentialsListOptionalParams + options?: FederatedIdentityCredentialsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, resourceName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: FederatedIdentityCredentialsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, resourceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -80,7 +96,9 @@ export class FederatedIdentityCredentialsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -100,7 +118,7 @@ export class FederatedIdentityCredentialsImpl /** * Lists all the federated identity credentials under the specified user assigned identity. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param options The options parameters. */ @@ -117,7 +135,7 @@ export class FederatedIdentityCredentialsImpl /** * Create or update a federated identity credential under the specified user assigned identity. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param federatedIdentityCredentialResourceName The name of the federated identity credential * resource. @@ -145,7 +163,7 @@ export class FederatedIdentityCredentialsImpl /** * Gets the federated identity credential. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param federatedIdentityCredentialResourceName The name of the federated identity credential * resource. @@ -170,7 +188,7 @@ export class FederatedIdentityCredentialsImpl /** * Deletes the federated identity credential. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param federatedIdentityCredentialResourceName The name of the federated identity credential * resource. @@ -195,7 +213,7 @@ export class FederatedIdentityCredentialsImpl /** * ListNext - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. @@ -235,8 +253,8 @@ const listOperationSpec: coreClient.OperationSpec = { urlParameters: [ Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName + Parameters.resourceName, + Parameters.resourceGroupName1 ], headerParameters: [Parameters.accept], serializer @@ -261,8 +279,8 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { urlParameters: [ Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName, Parameters.resourceName, + Parameters.resourceGroupName1, Parameters.federatedIdentityCredentialResourceName ], headerParameters: [Parameters.accept, Parameters.contentType], @@ -285,8 +303,8 @@ const getOperationSpec: coreClient.OperationSpec = { urlParameters: [ Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName, Parameters.resourceName, + Parameters.resourceGroupName1, Parameters.federatedIdentityCredentialResourceName ], headerParameters: [Parameters.accept], @@ -307,8 +325,8 @@ const deleteOperationSpec: coreClient.OperationSpec = { urlParameters: [ Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName, Parameters.resourceName, + Parameters.resourceGroupName1, Parameters.federatedIdentityCredentialResourceName ], headerParameters: [Parameters.accept], @@ -325,17 +343,12 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.top, - Parameters.skiptoken - ], urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName + Parameters.resourceName, + Parameters.resourceGroupName1 ], headerParameters: [Parameters.accept], serializer diff --git a/sdk/msi/arm-msi/src/operations/operations.ts b/sdk/msi/arm-msi/src/operations/operations.ts index 7110ad87d6a8..01d32d9ea977 100644 --- a/sdk/msi/arm-msi/src/operations/operations.ts +++ b/sdk/msi/arm-msi/src/operations/operations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Operations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -48,22 +49,34 @@ export class OperationsImpl implements Operations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -130,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts index 99b234df470b..cd19c87cf4d0 100644 --- a/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts +++ b/sdk/msi/arm-msi/src/operations/userAssignedIdentities.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { UserAssignedIdentities } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,14 +17,10 @@ import { Identity, UserAssignedIdentitiesListBySubscriptionNextOptionalParams, UserAssignedIdentitiesListBySubscriptionOptionalParams, + UserAssignedIdentitiesListBySubscriptionResponse, UserAssignedIdentitiesListByResourceGroupNextOptionalParams, UserAssignedIdentitiesListByResourceGroupOptionalParams, - AzureResource, - UserAssignedIdentitiesListAssociatedResourcesNextOptionalParams, - UserAssignedIdentitiesListAssociatedResourcesOptionalParams, - UserAssignedIdentitiesListBySubscriptionResponse, UserAssignedIdentitiesListByResourceGroupResponse, - UserAssignedIdentitiesListAssociatedResourcesResponse, UserAssignedIdentitiesCreateOrUpdateOptionalParams, UserAssignedIdentitiesCreateOrUpdateResponse, IdentityUpdate, @@ -33,8 +30,7 @@ import { UserAssignedIdentitiesGetResponse, UserAssignedIdentitiesDeleteOptionalParams, UserAssignedIdentitiesListBySubscriptionNextResponse, - UserAssignedIdentitiesListByResourceGroupNextResponse, - UserAssignedIdentitiesListAssociatedResourcesNextResponse + UserAssignedIdentitiesListByResourceGroupNextResponse } from "../models"; /// @@ -65,22 +61,34 @@ export class UserAssignedIdentitiesImpl implements UserAssignedIdentities { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: UserAssignedIdentitiesListBySubscriptionOptionalParams + options?: UserAssignedIdentitiesListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: UserAssignedIdentitiesListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -109,19 +117,33 @@ export class UserAssignedIdentitiesImpl implements UserAssignedIdentities { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: UserAssignedIdentitiesListByResourceGroupOptionalParams + options?: UserAssignedIdentitiesListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: UserAssignedIdentitiesListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -129,7 +151,9 @@ export class UserAssignedIdentitiesImpl implements UserAssignedIdentities { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -145,77 +169,6 @@ 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. @@ -244,23 +197,6 @@ 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. @@ -364,26 +300,6 @@ 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); @@ -426,35 +342,6 @@ 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}", @@ -560,7 +447,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.nextLink, @@ -580,7 +466,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.nextLink, @@ -590,32 +475,3 @@ 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/federatedIdentityCredentials.ts b/sdk/msi/arm-msi/src/operationsInterfaces/federatedIdentityCredentials.ts index f93239c5eef7..eb48823d344c 100644 --- a/sdk/msi/arm-msi/src/operationsInterfaces/federatedIdentityCredentials.ts +++ b/sdk/msi/arm-msi/src/operationsInterfaces/federatedIdentityCredentials.ts @@ -22,7 +22,7 @@ import { export interface FederatedIdentityCredentials { /** * Lists all the federated identity credentials under the specified user assigned identity. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param options The options parameters. */ @@ -33,7 +33,7 @@ export interface FederatedIdentityCredentials { ): PagedAsyncIterableIterator; /** * Create or update a federated identity credential under the specified user assigned identity. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param federatedIdentityCredentialResourceName The name of the federated identity credential * resource. @@ -49,7 +49,7 @@ export interface FederatedIdentityCredentials { ): Promise; /** * Gets the federated identity credential. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param federatedIdentityCredentialResourceName The name of the federated identity credential * resource. @@ -63,7 +63,7 @@ export interface FederatedIdentityCredentials { ): Promise; /** * Deletes the federated identity credential. - * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the identity resource. * @param federatedIdentityCredentialResourceName The name of the federated identity credential * resource. diff --git a/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts b/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts index 231f3dfa3330..c29c170025bf 100644 --- a/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts +++ b/sdk/msi/arm-msi/src/operationsInterfaces/userAssignedIdentities.ts @@ -11,8 +11,6 @@ import { Identity, UserAssignedIdentitiesListBySubscriptionOptionalParams, UserAssignedIdentitiesListByResourceGroupOptionalParams, - AzureResource, - UserAssignedIdentitiesListAssociatedResourcesOptionalParams, UserAssignedIdentitiesCreateOrUpdateOptionalParams, UserAssignedIdentitiesCreateOrUpdateResponse, IdentityUpdate, @@ -42,17 +40,6 @@ 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/src/pagingHelper.ts b/sdk/msi/arm-msi/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/msi/arm-msi/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * 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 interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/msi/arm-msi/tsconfig.json b/sdk/msi/arm-msi/tsconfig.json index a0558542a57f..3e6ae96443f3 100644 --- a/sdk/msi/arm-msi/tsconfig.json +++ b/sdk/msi/arm-msi/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-msi": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"