From 3af9f82a70ceedc0013271fc8ff2ad5b041de2cb Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 27 Sep 2024 03:59:02 +0000 Subject: [PATCH] CodeGen from PR 30768 in Azure/azure-rest-api-specs Merge f857628ff2d7bfaaefb117ed52ddcd5f082fdad0 into 139840784c38414085b3d799cee5545f9b6e8dec --- common/config/rush/pnpm-lock.yaml | 13 +- .../arm-healthdataaiservices/CHANGELOG.md | 16 +- .../arm-healthdataaiservices/README.md | 2 +- .../arm-healthdataaiservices/assets.json | 6 - .../eslint.config.mjs | 6 +- .../arm-healthdataaiservices/package.json | 82 +- .../arm-healthdataaiservices-api.api.md | 28 +- .../arm-healthdataaiservices-models.api.md | 19 +- .../review/arm-healthdataaiservices.api.md | 2 +- .../src/api/deidServices/index.ts | 774 ++++++++++-------- .../src/api/healthDataAIServicesContext.ts | 45 +- .../arm-healthdataaiservices/src/api/index.ts | 2 +- .../src/api/operations/index.ts | 24 +- .../api/privateEndpointConnections/index.ts | 224 ++--- .../src/api/privateLinks/index.ts | 29 +- .../src/classic/deidServices/index.ts | 38 +- .../src/classic/operations/index.ts | 9 +- .../privateEndpointConnections/index.ts | 2 +- .../src/classic/privateLinks/index.ts | 7 +- .../src/healthDataAIServicesClient.ts | 18 +- .../src/helpers/serializerHelpers.ts | 12 +- .../arm-healthdataaiservices/src/index.ts | 10 +- .../src/models/index.ts | 1 - .../src/models/models.ts | 53 +- .../src/models/options.ts | 18 +- .../src/models/pagingTypes.ts | 79 -- .../src/rest/clientDefinitions.ts | 198 ----- .../src/rest/healthDataAIServicesClient.ts | 61 -- .../src/rest/index.ts | 16 - .../src/rest/isUnexpected.ts | 253 ------ .../src/rest/models.ts | 234 ------ .../src/rest/outputModels.ts | 333 -------- .../src/rest/paginateHelper.ts | 131 --- .../src/rest/parameters.ts | 37 - .../src/rest/pollingHelper.ts | 270 ------ .../src/rest/responses.ts | 239 ------ .../src/restorePollerHelpers.ts | 84 +- .../{api => static-helpers}/pagingHelpers.ts | 140 +++- .../{api => static-helpers}/pollingHelpers.ts | 36 +- ...althdataaiservices_operations_test.spec.ts | 54 -- .../test/public/sampleTest.spec.ts | 21 + .../test/public/utils/recordedClient.ts | 14 +- .../arm-healthdataaiservices/tsconfig.json | 11 +- .../tsp-location.yaml | 4 +- sdk/healthdataaiservices/ci.mgmt.yml | 2 + 45 files changed, 1022 insertions(+), 2635 deletions(-) delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/assets.json delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/models/pagingTypes.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/clientDefinitions.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/healthDataAIServicesClient.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/index.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/isUnexpected.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/models.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/outputModels.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/paginateHelper.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/parameters.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/pollingHelper.ts delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/responses.ts rename sdk/healthdataaiservices/arm-healthdataaiservices/src/{api => static-helpers}/pagingHelpers.ts (61%) rename sdk/healthdataaiservices/arm-healthdataaiservices/src/{api => static-helpers}/pollingHelpers.ts (83%) delete mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/test/public/healthdataaiservices_operations_test.spec.ts create mode 100644 sdk/healthdataaiservices/arm-healthdataaiservices/test/public/sampleTest.spec.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 0c39bffa5ee4..725d4afb3e3a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -15576,31 +15576,30 @@ packages: dev: false file:projects/arm-healthdataaiservices.tgz: - resolution: {integrity: sha512-tyUVQWuRSVdZRjkIIEh5b4fZckDMvvH7VO1rsKdnfXJ+4tNr3u4ODFAPPokAPxM7oh5dY9zDx4v3DlU8B2ykyw==, tarball: file:projects/arm-healthdataaiservices.tgz} + resolution: {integrity: sha512-ZtfUEUKJqusSjCXtg6qKaejRebsjV8wRfQl1eEtass8UqWabY/P7cxCw/vuExaG0YvJplfd60W3Y+Vb+YtKtww==, tarball: file:projects/arm-healthdataaiservices.tgz} name: '@rush-temp/arm-healthdataaiservices' version: 0.0.0 dependencies: '@azure/identity': 4.4.1 '@microsoft/api-extractor': 7.47.9(@types/node@18.19.50) '@types/node': 18.19.50 - '@vitest/browser': 2.1.1(playwright@1.47.2)(typescript@5.6.2)(vitest@2.1.1) + '@vitest/browser': 2.1.1(playwright@1.47.2)(typescript@5.5.4)(vitest@2.1.1) '@vitest/coverage-istanbul': 2.1.1(vitest@2.1.1) dotenv: 16.4.5 - eslint: 9.11.0 + eslint: 8.57.1 mkdirp: 3.0.1 playwright: 1.47.2 prettier: 3.3.3 rimraf: 5.0.10 - tshy: 2.0.1 + tshy: 1.18.0 tslib: 2.7.0 - typescript: 5.6.2 + typescript: 5.5.4 vitest: 2.1.1(@types/node@18.19.50)(@vitest/browser@2.1.1) transitivePeerDependencies: - '@edge-runtime/vm' - '@vitest/ui' - bufferutil - happy-dom - - jiti - jsdom - less - lightningcss @@ -16732,7 +16731,7 @@ packages: dev: false file:projects/arm-mongocluster.tgz: - resolution: {integrity: sha512-5qfO0a31+swfnXGpyq3cmrbZ8Bj0tsLzx4frzixKRWNYsjpj3dbGiuLoIQDzcaw7mADeSVcXqduGOLAPxhtsdw==, tarball: file:projects/arm-mongocluster.tgz} + resolution: {integrity: sha512-EU8WPXxVnF2TP9sFdHD+Fhu0oD4WBj2gtulPY6pw393PtU2cp7IyaeETiBLyH2xxw4WRCyX1pjtNxADgOWpq1g==, tarball: file:projects/arm-mongocluster.tgz} name: '@rush-temp/arm-mongocluster' version: 0.0.0 dependencies: diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/CHANGELOG.md b/sdk/healthdataaiservices/arm-healthdataaiservices/CHANGELOG.md index 55f5947169a6..3ac0bd445e85 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/CHANGELOG.md +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/CHANGELOG.md @@ -1,15 +1,17 @@ # Release History - -## 1.0.0-beta.2 (Unreleased) - + +## 1.0.0-beta.2 (2024-09-27) +Compared with version 1.0.0-beta.1 + ### Features Added -### Breaking Changes + - Enum KnownManagedServiceIdentityType has a new value SystemAndUserAssigned -### Bugs Fixed - -### Other Changes +### Breaking Changes + - Enum KnownManagedServiceIdentityType no longer has value "SystemAssigned,UserAssigned" + + ## 1.0.0-beta.1 (2024-08-06) ### Features Added diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/README.md b/sdk/healthdataaiservices/arm-healthdataaiservices/README.md index 9f762aac6abf..0abeb8966ebd 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/README.md +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/README.md @@ -4,7 +4,6 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/arm-healthdataaiservices) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-healthdataaiservices) | [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-healthdataaiservices?view=azure-node-preview) | @@ -86,6 +85,7 @@ setLogLevel("info"); For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + ## Contributing If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/assets.json b/sdk/healthdataaiservices/arm-healthdataaiservices/assets.json deleted file mode 100644 index 52ab65ca68e6..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/healthdataaiservices/arm-healthdataaiservices", - "Tag": "js/healthdataaiservices/arm-healthdataaiservices_acbd358478" -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/eslint.config.mjs b/sdk/healthdataaiservices/arm-healthdataaiservices/eslint.config.mjs index 68c02604a4c1..113bdc3eaf5f 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/eslint.config.mjs +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/eslint.config.mjs @@ -8,10 +8,10 @@ export default [ "@azure/azure-sdk/ts-apiextractor-json-types": "warn", "@azure/azure-sdk/ts-package-json-types": "warn", "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "tsdoc/syntax": "warn", "@azure/azure-sdk/ts-package-json-module": "off", "@azure/azure-sdk/ts-package-json-files-required": "off", "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - }, - }, + "tsdoc/syntax": "warn" + } + } ]; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/package.json b/sdk/healthdataaiservices/arm-healthdataaiservices/package.json index d7cd1ba9fc9b..3acb6261392f 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/package.json +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/package.json @@ -47,7 +47,6 @@ "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/healthdataaiservices/arm-healthdataaiservices/README.md", "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", "//metadata": { "constantPaths": [ @@ -58,113 +57,124 @@ ] }, "dependencies": { + "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.1.0", - "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.6.0", - "@azure/core-lro": "^3.0.0", - "@azure/core-paging": "^1.5.0", "@azure/core-rest-pipeline": "^1.5.0", "@azure/logger": "^1.0.0", - "tslib": "^2.6.2" + "tslib": "^2.6.2", + "@azure/core-lro": "^3.0.0", + "@azure/abort-controller": "^2.1.2" }, "devDependencies": { - "@azure-tools/test-credential": "^2.0.0", - "@azure-tools/test-recorder": "^4.0.0", - "@azure/core-util": "^1.0.0", - "@azure/dev-tool": "^1.0.0", - "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^4.2.1", + "dotenv": "^16.0.0", "@microsoft/api-extractor": "^7.40.3", "@types/node": "^18.0.0", + "eslint": "^8.55.0", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "mkdirp": "^3.0.1", + "typescript": "~5.5.3", + "tshy": "^1.11.1", + "@azure/identity": "^4.2.1", "@vitest/browser": "^2.0.5", "@vitest/coverage-istanbul": "^2.0.5", - "dotenv": "^16.0.0", - "eslint": "^9.9.0", - "mkdirp": "^3.0.1", "playwright": "^1.41.2", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "typescript": "~5.6.2", - "vitest": "^2.0.5" + "vitest": "^2.0.5", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0" }, "scripts": { - "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", - "build": "npm run clean && dev-tool run build-package && mkdirp ./review && dev-tool run extract-api", - "build:samples": "echo skipped", - "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", - "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", "extract-api": "rimraf review && mkdirp ./review && dev-tool run extract-api", - "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\"", - "generate:client": "echo skipped", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", - "lint": "echo skipped", - "lint:fix": "echo skipped", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", - "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", "unit-test": "npm run unit-test:node && npm run unit-test:browser", "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", "unit-test:node": "dev-tool run test:vitest", - "update-snippets": "echo skipped" + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build:samples": "echo skipped", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "execute:samples": "echo skipped", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", + "generate:client": "echo skipped", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "build:test": "npm run clean && tshy && dev-tool run build-test", + "build": "npm run clean && tshy && mkdirp ./review && dev-tool run extract-api", + "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", + "test": "npm run clean && tshy && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test" }, "exports": { "./package.json": "./package.json", ".": { "browser": { + "source": "./src/index.ts", "types": "./dist/browser/index.d.ts", "default": "./dist/browser/index.js" }, "react-native": { + "source": "./src/index.ts", "types": "./dist/react-native/index.d.ts", "default": "./dist/react-native/index.js" }, "import": { + "source": "./src/index.ts", "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, "require": { + "source": "./src/index.ts", "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } }, "./api": { "browser": { + "source": "./src/api/index.ts", "types": "./dist/browser/api/index.d.ts", "default": "./dist/browser/api/index.js" }, "react-native": { + "source": "./src/api/index.ts", "types": "./dist/react-native/api/index.d.ts", "default": "./dist/react-native/api/index.js" }, "import": { + "source": "./src/api/index.ts", "types": "./dist/esm/api/index.d.ts", "default": "./dist/esm/api/index.js" }, "require": { + "source": "./src/api/index.ts", "types": "./dist/commonjs/api/index.d.ts", "default": "./dist/commonjs/api/index.js" } }, "./models": { "browser": { + "source": "./src/models/index.ts", "types": "./dist/browser/models/index.d.ts", "default": "./dist/browser/models/index.js" }, "react-native": { + "source": "./src/models/index.ts", "types": "./dist/react-native/models/index.d.ts", "default": "./dist/react-native/models/index.js" }, "import": { + "source": "./src/models/index.ts", "types": "./dist/esm/models/index.d.ts", "default": "./dist/esm/models/index.js" }, "require": { + "source": "./src/models/index.ts", "types": "./dist/commonjs/models/index.d.ts", "default": "./dist/commonjs/models/index.js" } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-api.api.md b/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-api.api.md index dab54b2198a7..3a66213e6358 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-api.api.md +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-api.api.md @@ -6,36 +6,31 @@ import { Client } from '@azure-rest/core-client'; import { ClientOptions } from '@azure-rest/core-client'; -import { HttpResponse } from '@azure-rest/core-client'; import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { Paged } from '@azure/core-paging'; import { PollerLike } from '@azure/core-lro'; -import { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import { RequestParameters } from '@azure-rest/core-client'; -import { StreamableMethod } from '@azure-rest/core-client'; import { TokenCredential } from '@azure/core-auth'; -// @public +// @public (undocumented) export function createHealthDataAIServices(credential: TokenCredential, options?: HealthDataAIServicesClientOptionalParams): HealthDataAIServicesContext; // @public -export function deidServicesCreate(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, resource: DeidService_2, options?: DeidServicesCreateOptionalParams): PollerLike, DeidService_2>; +export function deidServicesCreate(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, resource: DeidService, options?: DeidServicesCreateOptionalParams): PollerLike, DeidService>; // @public export function deidServicesDelete(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, options?: DeidServicesDeleteOptionalParams): PollerLike, void>; // @public -export function deidServicesGet(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, options?: DeidServicesGetOptionalParams): Promise; +export function deidServicesGet(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, options?: DeidServicesGetOptionalParams): Promise; // @public -export function deidServicesListByResourceGroup(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, options?: DeidServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; +export function deidServicesListByResourceGroup(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, options?: DeidServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; // @public -export function deidServicesListBySubscription(context: HealthDataAIServicesContext, subscriptionId: string, options?: DeidServicesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +export function deidServicesListBySubscription(context: HealthDataAIServicesContext, subscriptionId: string, options?: DeidServicesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; // @public -export function deidServicesUpdate(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, properties: DeidUpdate_2, options?: DeidServicesUpdateOptionalParams): PollerLike, DeidService_2>; +export function deidServicesUpdate(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, properties: DeidUpdate, options?: DeidServicesUpdateOptionalParams): PollerLike, DeidService>; // @public export interface HealthDataAIServicesClientOptionalParams extends ClientOptions { @@ -43,24 +38,23 @@ export interface HealthDataAIServicesClientOptionalParams extends ClientOptions } // @public (undocumented) -export type HealthDataAIServicesContext = Client & { - path: Routes; -}; +export interface HealthDataAIServicesContext extends Client { +} // @public export function operationsList(context: HealthDataAIServicesContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; // @public -export function privateEndpointConnectionsCreate(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource_2, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, PrivateEndpointConnectionResource_2>; +export function privateEndpointConnectionsCreate(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, privateEndpointConnectionName: string, resource: PrivateEndpointConnectionResource, options?: PrivateEndpointConnectionsCreateOptionalParams): PollerLike, PrivateEndpointConnectionResource>; // @public export function privateEndpointConnectionsDelete(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): PollerLike, void>; // @public -export function privateEndpointConnectionsGet(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; +export function privateEndpointConnectionsGet(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; // @public -export function privateEndpointConnectionsListByDeidService(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, options?: PrivateEndpointConnectionsListByDeidServiceOptionalParams): PagedAsyncIterableIterator; +export function privateEndpointConnectionsListByDeidService(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, options?: PrivateEndpointConnectionsListByDeidServiceOptionalParams): PagedAsyncIterableIterator; // @public export function privateLinksListByDeidService(context: HealthDataAIServicesContext, subscriptionId: string, resourceGroupName: string, deidServiceName: string, options?: PrivateLinksListByDeidServiceOptionalParams): PagedAsyncIterableIterator; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-models.api.md b/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-models.api.md index edcacb690e73..03bba6030d16 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-models.api.md +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices-models.api.md @@ -9,11 +9,6 @@ import { OperationOptions } from '@azure-rest/core-client'; // @public export type ActionType = string; -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - // @public export type CreatedByType = string; @@ -105,8 +100,8 @@ export enum KnownCreatedByType { // @public export enum KnownManagedServiceIdentityType { - "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned", None = "None", + SystemAndUserAssigned = "SystemAssigned,UserAssigned", SystemAssigned = "SystemAssigned", UserAssigned = "UserAssigned" } @@ -181,18 +176,6 @@ export interface OperationsListOptionalParams extends OperationOptions { // @public export type Origin = string; -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; - next(): Promise>; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - // @public export interface PrivateEndpoint { readonly id?: string; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices.api.md b/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices.api.md index e92a68cab1d1..9987096f6455 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices.api.md +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/review/arm-healthdataaiservices.api.md @@ -137,8 +137,8 @@ export enum KnownCreatedByType { // @public export enum KnownManagedServiceIdentityType { - "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned", None = "None", + SystemAndUserAssigned = "SystemAssigned,UserAssigned", SystemAssigned = "SystemAssigned", UserAssigned = "UserAssigned" } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/deidServices/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/deidServices/index.ts index be41c99df1f5..cd786fce2445 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/deidServices/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/deidServices/index.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getLongRunningPoller } from "../pollingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; import { deidServicePropertiesSerializer, managedServiceIdentitySerializer, @@ -12,36 +10,20 @@ import { DeidUpdate, _DeidServiceListResult, } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; -import { buildPagedAsyncIterator } from "../pagingHelpers.js"; -import { - isUnexpected, - HealthDataAIServicesContext as Client, - DeidServicesCreate200Response, - DeidServicesCreate201Response, - DeidServicesCreateDefaultResponse, - DeidServicesCreateLogicalResponse, - DeidServicesDelete202Response, - DeidServicesDelete204Response, - DeidServicesDeleteDefaultResponse, - DeidServicesDeleteLogicalResponse, - DeidServicesGet200Response, - DeidServicesGetDefaultResponse, - DeidServicesListByResourceGroup200Response, - DeidServicesListByResourceGroupDefaultResponse, - DeidServicesListBySubscription200Response, - DeidServicesListBySubscriptionDefaultResponse, - DeidServicesUpdate200Response, - DeidServicesUpdate202Response, - DeidServicesUpdateDefaultResponse, - DeidServicesUpdateLogicalResponse, -} from "../../rest/index.js"; +import { HealthDataAIServicesContext as Client } from "../index.js"; import { StreamableMethod, operationOptionsToRequestParameters, + PathUncheckedResponse, createRestError, } from "@azure-rest/core-client"; import { serializeRecord } from "../../helpers/serializerHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; import { DeidServicesGetOptionalParams, DeidServicesListByResourceGroupOptionalParams, @@ -57,7 +39,7 @@ export function _deidServicesGetSend( resourceGroupName: string, deidServiceName: string, options: DeidServicesGetOptionalParams = { requestOptions: {} }, -): StreamableMethod { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}", @@ -69,9 +51,10 @@ export function _deidServicesGetSend( } export async function _deidServicesGetDeserialize( - result: DeidServicesGet200Response | DeidServicesGetDefaultResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -105,45 +88,56 @@ export async function _deidServicesGetDeserialize( privateEndpointConnections: result.body.properties?.["privateEndpointConnections"] === undefined ? result.body.properties?.["privateEndpointConnections"] - : result.body.properties?.["privateEndpointConnections"].map((p) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState["actionsRequired"], + : result.body.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, + }, + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { id: p.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + }; + }, + ), publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], }, identity: !result.body.identity @@ -152,7 +146,8 @@ export async function _deidServicesGetDeserialize( principalId: result.body.identity?.["principalId"], tenantId: result.body.identity?.["tenantId"], type: result.body.identity?.["type"], - userAssignedIdentities: result.body.identity?.["userAssignedIdentities"], + userAssignedIdentities: + result.body.identity?.["userAssignedIdentities"], }, }; } @@ -182,9 +177,7 @@ export function _deidServicesListByResourceGroupSend( options: DeidServicesListByResourceGroupOptionalParams = { requestOptions: {}, }, -): StreamableMethod< - DeidServicesListByResourceGroup200Response | DeidServicesListByResourceGroupDefaultResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices", @@ -195,16 +188,15 @@ export function _deidServicesListByResourceGroupSend( } export async function _deidServicesListByResourceGroupDeserialize( - result: - | DeidServicesListByResourceGroup200Response - | DeidServicesListByResourceGroupDefaultResponse, + result: PathUncheckedResponse, ): Promise<_DeidServiceListResult> { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } return { - value: result.body["value"].map((p) => { + value: result.body["value"].map((p: any) => { return { tags: p["tags"], location: p["location"], @@ -235,47 +227,62 @@ export async function _deidServicesListByResourceGroupDeserialize( privateEndpointConnections: p.properties?.["privateEndpointConnections"] === undefined ? p.properties?.["privateEndpointConnections"] - : p.properties?.["privateEndpointConnections"].map((p) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState[ - "actionsRequired" - ], + : p.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: + p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { + id: p.properties?.privateEndpoint?.["id"], + }, + privateLinkServiceConnectionState: { + status: + p.properties + ?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties + ?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties + ?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), publicNetworkAccess: p.properties?.["publicNetworkAccess"], }, identity: !p.identity @@ -303,8 +310,15 @@ export function deidServicesListByResourceGroup( ): PagedAsyncIterableIterator { return buildPagedAsyncIterator( context, - () => _deidServicesListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + () => + _deidServicesListByResourceGroupSend( + context, + subscriptionId, + resourceGroupName, + options, + ), _deidServicesListByResourceGroupDeserialize, + ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } @@ -315,9 +329,7 @@ export function _deidServicesListBySubscriptionSend( options: DeidServicesListBySubscriptionOptionalParams = { requestOptions: {}, }, -): StreamableMethod< - DeidServicesListBySubscription200Response | DeidServicesListBySubscriptionDefaultResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/providers/Microsoft.HealthDataAIServices/deidServices", @@ -327,14 +339,15 @@ export function _deidServicesListBySubscriptionSend( } export async function _deidServicesListBySubscriptionDeserialize( - result: DeidServicesListBySubscription200Response | DeidServicesListBySubscriptionDefaultResponse, + result: PathUncheckedResponse, ): Promise<_DeidServiceListResult> { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } return { - value: result.body["value"].map((p) => { + value: result.body["value"].map((p: any) => { return { tags: p["tags"], location: p["location"], @@ -365,47 +378,62 @@ export async function _deidServicesListBySubscriptionDeserialize( privateEndpointConnections: p.properties?.["privateEndpointConnections"] === undefined ? p.properties?.["privateEndpointConnections"] - : p.properties?.["privateEndpointConnections"].map((p) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState[ - "actionsRequired" - ], + : p.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: + p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { + id: p.properties?.privateEndpoint?.["id"], + }, + privateLinkServiceConnectionState: { + status: + p.properties + ?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties + ?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties + ?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), publicNetworkAccess: p.properties?.["publicNetworkAccess"], }, identity: !p.identity @@ -434,6 +462,7 @@ export function deidServicesListBySubscription( context, () => _deidServicesListBySubscriptionSend(context, subscriptionId, options), _deidServicesListBySubscriptionDeserialize, + ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } @@ -445,12 +474,7 @@ export function _deidServicesCreateSend( deidServiceName: string, resource: DeidService, options: DeidServicesCreateOptionalParams = { requestOptions: {} }, -): StreamableMethod< - | DeidServicesCreate200Response - | DeidServicesCreate201Response - | DeidServicesCreateDefaultResponse - | DeidServicesCreateLogicalResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}", @@ -461,7 +485,9 @@ export function _deidServicesCreateSend( .put({ ...operationOptionsToRequestParameters(options), body: { - tags: !resource.tags ? resource.tags : (serializeRecord(resource.tags as any) as any), + tags: !resource.tags + ? resource.tags + : (serializeRecord(resource.tags as any) as any), location: resource["location"], properties: !resource.properties ? resource.properties @@ -474,95 +500,103 @@ export function _deidServicesCreateSend( } export async function _deidServicesCreateDeserialize( - result: - | DeidServicesCreate200Response - | DeidServicesCreate201Response - | DeidServicesCreateDefaultResponse - | DeidServicesCreateLogicalResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - const res = result as unknown as DeidServicesCreateLogicalResponse; return { - tags: res.body["tags"], - location: res.body["location"], - id: res.body["id"], - name: res.body["name"], - type: res.body["type"], - systemData: !res.body.systemData + tags: result.body["tags"], + location: result.body["location"], + id: result.body["id"], + name: result.body["name"], + type: result.body["type"], + systemData: !result.body.systemData ? undefined : { - createdBy: res.body.systemData?.["createdBy"], - createdByType: res.body.systemData?.["createdByType"], + createdBy: result.body.systemData?.["createdBy"], + createdByType: result.body.systemData?.["createdByType"], createdAt: - res.body.systemData?.["createdAt"] !== undefined - ? new Date(res.body.systemData?.["createdAt"]) + result.body.systemData?.["createdAt"] !== undefined + ? new Date(result.body.systemData?.["createdAt"]) : undefined, - lastModifiedBy: res.body.systemData?.["lastModifiedBy"], - lastModifiedByType: res.body.systemData?.["lastModifiedByType"], + lastModifiedBy: result.body.systemData?.["lastModifiedBy"], + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: - res.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(res.body.systemData?.["lastModifiedAt"]) + result.body.systemData?.["lastModifiedAt"] !== undefined + ? new Date(result.body.systemData?.["lastModifiedAt"]) : undefined, }, - properties: !res.body.properties + properties: !result.body.properties ? undefined : { - provisioningState: res.body.properties?.["provisioningState"], - serviceUrl: res.body.properties?.["serviceUrl"], + provisioningState: result.body.properties?.["provisioningState"], + serviceUrl: result.body.properties?.["serviceUrl"], privateEndpointConnections: - res.body.properties?.["privateEndpointConnections"] === undefined - ? res.body.properties?.["privateEndpointConnections"] - : res.body.properties?.["privateEndpointConnections"].map((p) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState["actionsRequired"], + result.body.properties?.["privateEndpointConnections"] === undefined + ? result.body.properties?.["privateEndpointConnections"] + : result.body.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - publicNetworkAccess: res.body.properties?.["publicNetworkAccess"], + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { id: p.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], }, - identity: !res.body.identity + identity: !result.body.identity ? undefined : { - principalId: res.body.identity?.["principalId"], - tenantId: res.body.identity?.["tenantId"], - type: res.body.identity?.["type"], - userAssignedIdentities: res.body.identity?.["userAssignedIdentities"], + principalId: result.body.identity?.["principalId"], + tenantId: result.body.identity?.["tenantId"], + type: result.body.identity?.["type"], + userAssignedIdentities: + result.body.identity?.["userAssignedIdentities"], }, }; } @@ -576,19 +610,24 @@ export function deidServicesCreate( resource: DeidService, options: DeidServicesCreateOptionalParams = { requestOptions: {} }, ): PollerLike, DeidService> { - return getLongRunningPoller(context, _deidServicesCreateDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _deidServicesCreateSend( - context, - subscriptionId, - resourceGroupName, - deidServiceName, - resource, - options, - ), - }) as PollerLike, DeidService>; + return getLongRunningPoller( + context, + _deidServicesCreateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _deidServicesCreateSend( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + resource, + options, + ), + }, + ) as PollerLike, DeidService>; } export function _deidServicesUpdateSend( @@ -598,12 +637,7 @@ export function _deidServicesUpdateSend( deidServiceName: string, properties: DeidUpdate, options: DeidServicesUpdateOptionalParams = { requestOptions: {} }, -): StreamableMethod< - | DeidServicesUpdate200Response - | DeidServicesUpdate202Response - | DeidServicesUpdateDefaultResponse - | DeidServicesUpdateLogicalResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}", @@ -614,7 +648,9 @@ export function _deidServicesUpdateSend( .patch({ ...operationOptionsToRequestParameters(options), body: { - tags: !properties.tags ? properties.tags : (serializeRecord(properties.tags as any) as any), + tags: !properties.tags + ? properties.tags + : (serializeRecord(properties.tags as any) as any), identity: !properties.identity ? properties.identity : managedServiceIdentityUpdateSerializer(properties.identity), @@ -626,95 +662,103 @@ export function _deidServicesUpdateSend( } export async function _deidServicesUpdateDeserialize( - result: - | DeidServicesUpdate200Response - | DeidServicesUpdate202Response - | DeidServicesUpdateDefaultResponse - | DeidServicesUpdateLogicalResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - const res = result as unknown as DeidServicesUpdateLogicalResponse; return { - tags: res.body["tags"], - location: res.body["location"], - id: res.body["id"], - name: res.body["name"], - type: res.body["type"], - systemData: !res.body.systemData + tags: result.body["tags"], + location: result.body["location"], + id: result.body["id"], + name: result.body["name"], + type: result.body["type"], + systemData: !result.body.systemData ? undefined : { - createdBy: res.body.systemData?.["createdBy"], - createdByType: res.body.systemData?.["createdByType"], + createdBy: result.body.systemData?.["createdBy"], + createdByType: result.body.systemData?.["createdByType"], createdAt: - res.body.systemData?.["createdAt"] !== undefined - ? new Date(res.body.systemData?.["createdAt"]) + result.body.systemData?.["createdAt"] !== undefined + ? new Date(result.body.systemData?.["createdAt"]) : undefined, - lastModifiedBy: res.body.systemData?.["lastModifiedBy"], - lastModifiedByType: res.body.systemData?.["lastModifiedByType"], + lastModifiedBy: result.body.systemData?.["lastModifiedBy"], + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: - res.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(res.body.systemData?.["lastModifiedAt"]) + result.body.systemData?.["lastModifiedAt"] !== undefined + ? new Date(result.body.systemData?.["lastModifiedAt"]) : undefined, }, - properties: !res.body.properties + properties: !result.body.properties ? undefined : { - provisioningState: res.body.properties?.["provisioningState"], - serviceUrl: res.body.properties?.["serviceUrl"], + provisioningState: result.body.properties?.["provisioningState"], + serviceUrl: result.body.properties?.["serviceUrl"], privateEndpointConnections: - res.body.properties?.["privateEndpointConnections"] === undefined - ? res.body.properties?.["privateEndpointConnections"] - : res.body.properties?.["privateEndpointConnections"].map((p) => { - return { - id: p["id"], - name: p["name"], - type: p["type"], - systemData: !p.systemData - ? undefined - : { - createdBy: p.systemData?.["createdBy"], - createdByType: p.systemData?.["createdByType"], - createdAt: - p.systemData?.["createdAt"] !== undefined - ? new Date(p.systemData?.["createdAt"]) - : undefined, - lastModifiedBy: p.systemData?.["lastModifiedBy"], - lastModifiedByType: p.systemData?.["lastModifiedByType"], - lastModifiedAt: - p.systemData?.["lastModifiedAt"] !== undefined - ? new Date(p.systemData?.["lastModifiedAt"]) - : undefined, - }, - properties: !p.properties - ? undefined - : { - groupIds: p.properties?.["groupIds"], - privateEndpoint: !p.properties?.privateEndpoint - ? undefined - : { id: p.properties?.privateEndpoint?.["id"] }, - privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: - p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: - p.properties?.privateLinkServiceConnectionState["actionsRequired"], + result.body.properties?.["privateEndpointConnections"] === undefined + ? result.body.properties?.["privateEndpointConnections"] + : result.body.properties?.["privateEndpointConnections"].map( + (p: any) => { + return { + id: p["id"], + name: p["name"], + type: p["type"], + systemData: !p.systemData + ? undefined + : { + createdBy: p.systemData?.["createdBy"], + createdByType: p.systemData?.["createdByType"], + createdAt: + p.systemData?.["createdAt"] !== undefined + ? new Date(p.systemData?.["createdAt"]) + : undefined, + lastModifiedBy: p.systemData?.["lastModifiedBy"], + lastModifiedByType: + p.systemData?.["lastModifiedByType"], + lastModifiedAt: + p.systemData?.["lastModifiedAt"] !== undefined + ? new Date(p.systemData?.["lastModifiedAt"]) + : undefined, }, - provisioningState: p.properties?.["provisioningState"], - }, - }; - }), - publicNetworkAccess: res.body.properties?.["publicNetworkAccess"], + properties: !p.properties + ? undefined + : { + groupIds: p.properties?.["groupIds"], + privateEndpoint: !p.properties?.privateEndpoint + ? undefined + : { id: p.properties?.privateEndpoint?.["id"] }, + privateLinkServiceConnectionState: { + status: + p.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], + }, + provisioningState: + p.properties?.["provisioningState"], + }, + }; + }, + ), + publicNetworkAccess: result.body.properties?.["publicNetworkAccess"], }, - identity: !res.body.identity + identity: !result.body.identity ? undefined : { - principalId: res.body.identity?.["principalId"], - tenantId: res.body.identity?.["tenantId"], - type: res.body.identity?.["type"], - userAssignedIdentities: res.body.identity?.["userAssignedIdentities"], + principalId: result.body.identity?.["principalId"], + tenantId: result.body.identity?.["tenantId"], + type: result.body.identity?.["type"], + userAssignedIdentities: + result.body.identity?.["userAssignedIdentities"], }, }; } @@ -728,19 +772,24 @@ export function deidServicesUpdate( properties: DeidUpdate, options: DeidServicesUpdateOptionalParams = { requestOptions: {} }, ): PollerLike, DeidService> { - return getLongRunningPoller(context, _deidServicesUpdateDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _deidServicesUpdateSend( - context, - subscriptionId, - resourceGroupName, - deidServiceName, - properties, - options, - ), - }) as PollerLike, DeidService>; + return getLongRunningPoller( + context, + _deidServicesUpdateDeserialize, + ["200", "202"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _deidServicesUpdateSend( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + properties, + options, + ), + }, + ) as PollerLike, DeidService>; } export function _deidServicesDeleteSend( @@ -749,12 +798,7 @@ export function _deidServicesDeleteSend( resourceGroupName: string, deidServiceName: string, options: DeidServicesDeleteOptionalParams = { requestOptions: {} }, -): StreamableMethod< - | DeidServicesDelete202Response - | DeidServicesDelete204Response - | DeidServicesDeleteDefaultResponse - | DeidServicesDeleteLogicalResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}", @@ -766,13 +810,10 @@ export function _deidServicesDeleteSend( } export async function _deidServicesDeleteDeserialize( - result: - | DeidServicesDelete202Response - | DeidServicesDelete204Response - | DeidServicesDeleteDefaultResponse - | DeidServicesDeleteLogicalResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -787,10 +828,21 @@ export function deidServicesDelete( deidServiceName: string, options: DeidServicesDeleteOptionalParams = { requestOptions: {} }, ): PollerLike, void> { - return getLongRunningPoller(context, _deidServicesDeleteDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _deidServicesDeleteSend(context, subscriptionId, resourceGroupName, deidServiceName, options), - }) as PollerLike, void>; + return getLongRunningPoller( + context, + _deidServicesDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _deidServicesDeleteSend( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + options, + ), + }, + ) as PollerLike, void>; } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/healthDataAIServicesContext.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/healthDataAIServicesContext.ts index d63f1164f437..7fcd16e30b32 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/healthDataAIServicesContext.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/healthDataAIServicesContext.ts @@ -2,29 +2,54 @@ // Licensed under the MIT License. import { TokenCredential } from "@azure/core-auth"; -import { ClientOptions } from "@azure-rest/core-client"; -import { HealthDataAIServicesContext } from "../rest/index.js"; -import getClient from "../rest/index.js"; +import { ClientOptions, Client, getClient } from "@azure-rest/core-client"; +import { logger } from "../logger.js"; + +export interface HealthDataAIServicesContext extends Client {} /** Optional parameters for the client. */ -export interface HealthDataAIServicesClientOptionalParams extends ClientOptions { +export interface HealthDataAIServicesClientOptionalParams + extends ClientOptions { /** The API version to use for this operation. */ apiVersion?: string; } -export { HealthDataAIServicesContext } from "../rest/index.js"; - -/** The Microsoft Azure management API provides create, read, update, and delete functionality for Microsoft HealthDataAIServices resources including deidServices */ export function createHealthDataAIServices( credential: TokenCredential, options: HealthDataAIServicesClientOptionalParams = {}, ): HealthDataAIServicesContext { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-api` : "azsdk-js-api"; + const endpointUrl = + options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; - const clientContext = getClient(credential, { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api` + : "azsdk-js-api"; + const { apiVersion: _, ...updatedOptions } = { ...options, userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-02-28-preview"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, }); return clientContext; } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/index.ts index 14c04ee35ca1..63558da4a203 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/index.ts @@ -3,8 +3,8 @@ export { createHealthDataAIServices, - HealthDataAIServicesClientOptionalParams, HealthDataAIServicesContext, + HealthDataAIServicesClientOptionalParams, } from "./healthDataAIServicesContext.js"; export { deidServicesGet, diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/operations/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/operations/index.ts index e6a2af367b7d..6f83d02648c0 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/operations/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/operations/index.ts @@ -2,39 +2,38 @@ // Licensed under the MIT License. import { Operation, _OperationListResult } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; -import { buildPagedAsyncIterator } from "../pagingHelpers.js"; -import { - isUnexpected, - HealthDataAIServicesContext as Client, - OperationsList200Response, - OperationsListDefaultResponse, -} from "../../rest/index.js"; +import { HealthDataAIServicesContext as Client } from "../index.js"; import { StreamableMethod, operationOptionsToRequestParameters, + PathUncheckedResponse, createRestError, } from "@azure-rest/core-client"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; import { OperationsListOptionalParams } from "../../models/options.js"; export function _operationsListSend( context: Client, options: OperationsListOptionalParams = { requestOptions: {} }, -): StreamableMethod { +): StreamableMethod { return context .path("/providers/Microsoft.HealthDataAIServices/operations") .get({ ...operationOptionsToRequestParameters(options) }); } export async function _operationsListDeserialize( - result: OperationsList200Response | OperationsListDefaultResponse, + result: PathUncheckedResponse, ): Promise<_OperationListResult> { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } return { - value: result.body["value"].map((p) => { + value: result.body["value"].map((p: any) => { return { name: p["name"], isDataAction: p["isDataAction"], @@ -63,6 +62,7 @@ export function operationsList( context, () => _operationsListSend(context, options), _operationsListDeserialize, + ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateEndpointConnections/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateEndpointConnections/index.ts index 93301095eb1b..8d04cfdf546a 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateEndpointConnections/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateEndpointConnections/index.ts @@ -1,36 +1,24 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getLongRunningPoller } from "../pollingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; import { privateEndpointConnectionPropertiesSerializer, PrivateEndpointConnectionResource, _PrivateEndpointConnectionResourceListResult, } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; -import { buildPagedAsyncIterator } from "../pagingHelpers.js"; -import { - isUnexpected, - HealthDataAIServicesContext as Client, - PrivateEndpointConnectionsCreate200Response, - PrivateEndpointConnectionsCreate201Response, - PrivateEndpointConnectionsCreateDefaultResponse, - PrivateEndpointConnectionsCreateLogicalResponse, - PrivateEndpointConnectionsDelete202Response, - PrivateEndpointConnectionsDelete204Response, - PrivateEndpointConnectionsDeleteDefaultResponse, - PrivateEndpointConnectionsDeleteLogicalResponse, - PrivateEndpointConnectionsGet200Response, - PrivateEndpointConnectionsGetDefaultResponse, - PrivateEndpointConnectionsListByDeidService200Response, - PrivateEndpointConnectionsListByDeidServiceDefaultResponse, -} from "../../rest/index.js"; +import { HealthDataAIServicesContext as Client } from "../index.js"; import { StreamableMethod, operationOptionsToRequestParameters, + PathUncheckedResponse, createRestError, } from "@azure-rest/core-client"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; import { PrivateEndpointConnectionsGetOptionalParams, PrivateEndpointConnectionsCreateOptionalParams, @@ -45,9 +33,7 @@ export function _privateEndpointConnectionsGetSend( deidServiceName: string, privateEndpointConnectionName: string, options: PrivateEndpointConnectionsGetOptionalParams = { requestOptions: {} }, -): StreamableMethod< - PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", @@ -60,9 +46,10 @@ export function _privateEndpointConnectionsGetSend( } export async function _privateEndpointConnectionsGetDeserialize( - result: PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -94,10 +81,18 @@ export async function _privateEndpointConnectionsGetDeserialize( ? undefined : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: result.body.properties?.privateLinkServiceConnectionState["status"], - description: result.body.properties?.privateLinkServiceConnectionState["description"], + status: + result.body.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + result.body.properties?.privateLinkServiceConnectionState[ + "description" + ], actionsRequired: - result.body.properties?.privateLinkServiceConnectionState["actionsRequired"], + result.body.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], }, provisioningState: result.body.properties?.["provisioningState"], }, @@ -134,12 +129,7 @@ export function _privateEndpointConnectionsCreateSend( options: PrivateEndpointConnectionsCreateOptionalParams = { requestOptions: {}, }, -): StreamableMethod< - | PrivateEndpointConnectionsCreate200Response - | PrivateEndpointConnectionsCreate201Response - | PrivateEndpointConnectionsCreateDefaultResponse - | PrivateEndpointConnectionsCreateLogicalResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", @@ -159,51 +149,55 @@ export function _privateEndpointConnectionsCreateSend( } export async function _privateEndpointConnectionsCreateDeserialize( - result: - | PrivateEndpointConnectionsCreate200Response - | PrivateEndpointConnectionsCreate201Response - | PrivateEndpointConnectionsCreateDefaultResponse - | PrivateEndpointConnectionsCreateLogicalResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - const res = result as unknown as PrivateEndpointConnectionsCreateLogicalResponse; return { - id: res.body["id"], - name: res.body["name"], - type: res.body["type"], - systemData: !res.body.systemData + id: result.body["id"], + name: result.body["name"], + type: result.body["type"], + systemData: !result.body.systemData ? undefined : { - createdBy: res.body.systemData?.["createdBy"], - createdByType: res.body.systemData?.["createdByType"], + createdBy: result.body.systemData?.["createdBy"], + createdByType: result.body.systemData?.["createdByType"], createdAt: - res.body.systemData?.["createdAt"] !== undefined - ? new Date(res.body.systemData?.["createdAt"]) + result.body.systemData?.["createdAt"] !== undefined + ? new Date(result.body.systemData?.["createdAt"]) : undefined, - lastModifiedBy: res.body.systemData?.["lastModifiedBy"], - lastModifiedByType: res.body.systemData?.["lastModifiedByType"], + lastModifiedBy: result.body.systemData?.["lastModifiedBy"], + lastModifiedByType: result.body.systemData?.["lastModifiedByType"], lastModifiedAt: - res.body.systemData?.["lastModifiedAt"] !== undefined - ? new Date(res.body.systemData?.["lastModifiedAt"]) + result.body.systemData?.["lastModifiedAt"] !== undefined + ? new Date(result.body.systemData?.["lastModifiedAt"]) : undefined, }, - properties: !res.body.properties + properties: !result.body.properties ? undefined : { - groupIds: res.body.properties?.["groupIds"], - privateEndpoint: !res.body.properties?.privateEndpoint + groupIds: result.body.properties?.["groupIds"], + privateEndpoint: !result.body.properties?.privateEndpoint ? undefined - : { id: res.body.properties?.privateEndpoint?.["id"] }, + : { id: result.body.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: res.body.properties?.privateLinkServiceConnectionState["status"], - description: res.body.properties?.privateLinkServiceConnectionState["description"], + status: + result.body.properties?.privateLinkServiceConnectionState[ + "status" + ], + description: + result.body.properties?.privateLinkServiceConnectionState[ + "description" + ], actionsRequired: - res.body.properties?.privateLinkServiceConnectionState["actionsRequired"], + result.body.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], }, - provisioningState: res.body.properties?.["provisioningState"], + provisioningState: result.body.properties?.["provisioningState"], }, }; } @@ -223,20 +217,25 @@ export function privateEndpointConnectionsCreate( OperationState, PrivateEndpointConnectionResource > { - return getLongRunningPoller(context, _privateEndpointConnectionsCreateDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _privateEndpointConnectionsCreateSend( - context, - subscriptionId, - resourceGroupName, - deidServiceName, - privateEndpointConnectionName, - resource, - options, - ), - }) as PollerLike< + return getLongRunningPoller( + context, + _privateEndpointConnectionsCreateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsCreateSend( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + privateEndpointConnectionName, + resource, + options, + ), + }, + ) as PollerLike< OperationState, PrivateEndpointConnectionResource >; @@ -251,12 +250,7 @@ export function _privateEndpointConnectionsDeleteSend( options: PrivateEndpointConnectionsDeleteOptionalParams = { requestOptions: {}, }, -): StreamableMethod< - | PrivateEndpointConnectionsDelete202Response - | PrivateEndpointConnectionsDelete204Response - | PrivateEndpointConnectionsDeleteDefaultResponse - | PrivateEndpointConnectionsDeleteLogicalResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", @@ -269,13 +263,10 @@ export function _privateEndpointConnectionsDeleteSend( } export async function _privateEndpointConnectionsDeleteDeserialize( - result: - | PrivateEndpointConnectionsDelete202Response - | PrivateEndpointConnectionsDelete204Response - | PrivateEndpointConnectionsDeleteDefaultResponse - | PrivateEndpointConnectionsDeleteLogicalResponse, + result: PathUncheckedResponse, ): Promise { - if (isUnexpected(result)) { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -293,19 +284,24 @@ export function privateEndpointConnectionsDelete( requestOptions: {}, }, ): PollerLike, void> { - return getLongRunningPoller(context, _privateEndpointConnectionsDeleteDeserialize, { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _privateEndpointConnectionsDeleteSend( - context, - subscriptionId, - resourceGroupName, - deidServiceName, - privateEndpointConnectionName, - options, - ), - }) as PollerLike, void>; + return getLongRunningPoller( + context, + _privateEndpointConnectionsDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _privateEndpointConnectionsDeleteSend( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + privateEndpointConnectionName, + options, + ), + }, + ) as PollerLike, void>; } export function _privateEndpointConnectionsListByDeidServiceSend( @@ -316,10 +312,7 @@ export function _privateEndpointConnectionsListByDeidServiceSend( options: PrivateEndpointConnectionsListByDeidServiceOptionalParams = { requestOptions: {}, }, -): StreamableMethod< - | PrivateEndpointConnectionsListByDeidService200Response - | PrivateEndpointConnectionsListByDeidServiceDefaultResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections", @@ -331,16 +324,15 @@ export function _privateEndpointConnectionsListByDeidServiceSend( } export async function _privateEndpointConnectionsListByDeidServiceDeserialize( - result: - | PrivateEndpointConnectionsListByDeidService200Response - | PrivateEndpointConnectionsListByDeidServiceDefaultResponse, + result: PathUncheckedResponse, ): Promise<_PrivateEndpointConnectionResourceListResult> { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } return { - value: result.body["value"].map((p) => { + value: result.body["value"].map((p: any) => { return { id: p["id"], name: p["name"], @@ -369,9 +361,16 @@ export async function _privateEndpointConnectionsListByDeidServiceDeserialize( ? undefined : { id: p.properties?.privateEndpoint?.["id"] }, privateLinkServiceConnectionState: { - status: p.properties?.privateLinkServiceConnectionState["status"], - description: p.properties?.privateLinkServiceConnectionState["description"], - actionsRequired: p.properties?.privateLinkServiceConnectionState["actionsRequired"], + status: + p.properties?.privateLinkServiceConnectionState["status"], + description: + p.properties?.privateLinkServiceConnectionState[ + "description" + ], + actionsRequired: + p.properties?.privateLinkServiceConnectionState[ + "actionsRequired" + ], }, provisioningState: p.properties?.["provisioningState"], }, @@ -402,6 +401,7 @@ export function privateEndpointConnectionsListByDeidService( options, ), _privateEndpointConnectionsListByDeidServiceDeserialize, + ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateLinks/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateLinks/index.ts index 32be798a6378..ee4df73c60db 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateLinks/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/privateLinks/index.ts @@ -1,20 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PrivateLinkResource, _PrivateLinkResourceListResult } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; -import { buildPagedAsyncIterator } from "../pagingHelpers.js"; import { - isUnexpected, - HealthDataAIServicesContext as Client, - PrivateLinksListByDeidService200Response, - PrivateLinksListByDeidServiceDefaultResponse, -} from "../../rest/index.js"; + PrivateLinkResource, + _PrivateLinkResourceListResult, +} from "../../models/models.js"; +import { HealthDataAIServicesContext as Client } from "../index.js"; import { StreamableMethod, operationOptionsToRequestParameters, + PathUncheckedResponse, createRestError, } from "@azure-rest/core-client"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; import { PrivateLinksListByDeidServiceOptionalParams } from "../../models/options.js"; export function _privateLinksListByDeidServiceSend( @@ -23,9 +24,7 @@ export function _privateLinksListByDeidServiceSend( resourceGroupName: string, deidServiceName: string, options: PrivateLinksListByDeidServiceOptionalParams = { requestOptions: {} }, -): StreamableMethod< - PrivateLinksListByDeidService200Response | PrivateLinksListByDeidServiceDefaultResponse -> { +): StreamableMethod { return context .path( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources", @@ -37,14 +36,15 @@ export function _privateLinksListByDeidServiceSend( } export async function _privateLinksListByDeidServiceDeserialize( - result: PrivateLinksListByDeidService200Response | PrivateLinksListByDeidServiceDefaultResponse, + result: PathUncheckedResponse, ): Promise<_PrivateLinkResourceListResult> { - if (isUnexpected(result)) { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } return { - value: result.body["value"].map((p) => { + value: result.body["value"].map((p: any) => { return { id: p["id"], name: p["name"], @@ -97,6 +97,7 @@ export function privateLinksListByDeidService( options, ), _privateLinksListByDeidServiceDeserialize, + ["200"], { itemName: "value", nextLinkName: "nextLink" }, ); } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/deidServices/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/deidServices/index.ts index 698055c914ac..adcdd2bca151 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/deidServices/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/deidServices/index.ts @@ -11,7 +11,7 @@ import { deidServicesUpdate, deidServicesDelete, } from "../../api/deidServices/index.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { DeidServicesGetOptionalParams, @@ -61,19 +61,36 @@ export interface DeidServicesOperations { ) => PollerLike, void>; } -export function getDeidServices(context: HealthDataAIServicesContext, subscriptionId: string) { +export function getDeidServices( + context: HealthDataAIServicesContext, + subscriptionId: string, +) { return { get: ( resourceGroupName: string, deidServiceName: string, options?: DeidServicesGetOptionalParams, - ) => deidServicesGet(context, subscriptionId, resourceGroupName, deidServiceName, options), + ) => + deidServicesGet( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + options, + ), listByResourceGroup: ( resourceGroupName: string, options?: DeidServicesListByResourceGroupOptionalParams, - ) => deidServicesListByResourceGroup(context, subscriptionId, resourceGroupName, options), - listBySubscription: (options?: DeidServicesListBySubscriptionOptionalParams) => - deidServicesListBySubscription(context, subscriptionId, options), + ) => + deidServicesListByResourceGroup( + context, + subscriptionId, + resourceGroupName, + options, + ), + listBySubscription: ( + options?: DeidServicesListBySubscriptionOptionalParams, + ) => deidServicesListBySubscription(context, subscriptionId, options), create: ( resourceGroupName: string, deidServiceName: string, @@ -106,7 +123,14 @@ export function getDeidServices(context: HealthDataAIServicesContext, subscripti resourceGroupName: string, deidServiceName: string, options?: DeidServicesDeleteOptionalParams, - ) => deidServicesDelete(context, subscriptionId, resourceGroupName, deidServiceName, options), + ) => + deidServicesDelete( + context, + subscriptionId, + resourceGroupName, + deidServiceName, + options, + ), }; } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/operations/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/operations/index.ts index 9b91560312e7..334f2c86f481 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/operations/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/operations/index.ts @@ -4,18 +4,21 @@ import { HealthDataAIServicesContext } from "../../api/healthDataAIServicesContext.js"; import { Operation } from "../../models/models.js"; import { operationsList } from "../../api/operations/index.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { OperationsListOptionalParams } from "../../models/options.js"; /** Interface representing a Operations operations. */ export interface OperationsOperations { /** List the operations for the provider */ - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; + list: ( + options?: OperationsListOptionalParams, + ) => PagedAsyncIterableIterator; } export function getOperations(context: HealthDataAIServicesContext) { return { - list: (options?: OperationsListOptionalParams) => operationsList(context, options), + list: (options?: OperationsListOptionalParams) => + operationsList(context, options), }; } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateEndpointConnections/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateEndpointConnections/index.ts index 69b1e7eb94d7..9554f558cea1 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateEndpointConnections/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateEndpointConnections/index.ts @@ -9,7 +9,7 @@ import { privateEndpointConnectionsDelete, privateEndpointConnectionsListByDeidService, } from "../../api/privateEndpointConnections/index.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PollerLike, OperationState } from "@azure/core-lro"; import { PrivateEndpointConnectionsGetOptionalParams, diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateLinks/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateLinks/index.ts index b9ae9d2ddda2..4085dfb770f2 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateLinks/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/classic/privateLinks/index.ts @@ -4,7 +4,7 @@ import { HealthDataAIServicesContext } from "../../api/healthDataAIServicesContext.js"; import { PrivateLinkResource } from "../../models/models.js"; import { privateLinksListByDeidService } from "../../api/privateLinks/index.js"; -import { PagedAsyncIterableIterator } from "../../models/pagingTypes.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; import { PrivateLinksListByDeidServiceOptionalParams } from "../../models/options.js"; /** Interface representing a PrivateLinks operations. */ @@ -17,7 +17,10 @@ export interface PrivateLinksOperations { ) => PagedAsyncIterableIterator; } -export function getPrivateLinks(context: HealthDataAIServicesContext, subscriptionId: string) { +export function getPrivateLinks( + context: HealthDataAIServicesContext, + subscriptionId: string, +) { return { listByDeidService: ( resourceGroupName: string, diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/healthDataAIServicesClient.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/healthDataAIServicesClient.ts index ceb8c6acc450..a321039f5b10 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/healthDataAIServicesClient.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/healthDataAIServicesClient.ts @@ -3,17 +3,26 @@ import { TokenCredential } from "@azure/core-auth"; import { Pipeline } from "@azure/core-rest-pipeline"; -import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js"; -import { getDeidServicesOperations, DeidServicesOperations } from "./classic/deidServices/index.js"; +import { + getOperationsOperations, + OperationsOperations, +} from "./classic/operations/index.js"; +import { + getDeidServicesOperations, + DeidServicesOperations, +} from "./classic/deidServices/index.js"; import { getPrivateEndpointConnectionsOperations, PrivateEndpointConnectionsOperations, } from "./classic/privateEndpointConnections/index.js"; -import { getPrivateLinksOperations, PrivateLinksOperations } from "./classic/privateLinks/index.js"; +import { + getPrivateLinksOperations, + PrivateLinksOperations, +} from "./classic/privateLinks/index.js"; import { createHealthDataAIServices, - HealthDataAIServicesClientOptionalParams, HealthDataAIServicesContext, + HealthDataAIServicesClientOptionalParams, } from "./api/index.js"; export { HealthDataAIServicesClientOptionalParams } from "./api/healthDataAIServicesContext.js"; @@ -32,7 +41,6 @@ export class HealthDataAIServicesClient { const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-client` : "azsdk-js-client"; - this._client = createHealthDataAIServices(credential, { ...options, userAgentOptions: { userAgentPrefix }, diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/helpers/serializerHelpers.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/helpers/serializerHelpers.ts index 7518a16c2ee9..4baaac77c8be 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/helpers/serializerHelpers.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/helpers/serializerHelpers.ts @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -export function serializeRecord( - item: Record, -): Record; +export function serializeRecord< + T extends string | number | boolean | Date | null, + R, +>(item: Record): Record; export function serializeRecord( item: Record, serializer: (item: T) => R, @@ -32,5 +33,8 @@ export function serializeRecord( } function isSupportedRecordType(t: any) { - return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date; + return ( + ["number", "string", "boolean", "null"].includes(typeof t) || + t instanceof Date + ); } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/index.ts index 8747c24afada..df2eb6f321a3 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/index.ts @@ -1,6 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + export { HealthDataAIServicesClient, HealthDataAIServicesClientOptionalParams, @@ -59,9 +65,6 @@ export { PrivateEndpointConnectionsDeleteOptionalParams, PrivateEndpointConnectionsListByDeidServiceOptionalParams, PrivateLinksListByDeidServiceOptionalParams, - PageSettings, - ContinuablePage, - PagedAsyncIterableIterator, } from "./models/index.js"; export { DeidServicesOperations, @@ -69,3 +72,4 @@ export { PrivateEndpointConnectionsOperations, PrivateLinksOperations, } from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/index.ts index 8b22787363b1..1c01a023b15e 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/index.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/index.ts @@ -57,4 +57,3 @@ export { PrivateEndpointConnectionsListByDeidServiceOptionalParams, PrivateLinksListByDeidServiceOptionalParams, } from "./options.js"; -export { PageSettings, ContinuablePage, PagedAsyncIterableIterator } from "./pagingTypes.js"; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/models.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/models.ts index 632bb9d83ada..02d8db5b3787 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/models.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/models.ts @@ -2,18 +2,6 @@ // Licensed under the MIT License. import { serializeRecord } from "../helpers/serializerHelpers.js"; -import { - PrivateEndpointConnectionResource as PrivateEndpointConnectionResourceRest, - PrivateEndpointConnectionProperties as PrivateEndpointConnectionPropertiesRest, - PrivateLinkServiceConnectionState as PrivateLinkServiceConnectionStateRest, - TrackedResource as TrackedResourceRest, - DeidService as DeidServiceRest, - DeidServiceProperties as DeidServicePropertiesRest, - ManagedServiceIdentity as ManagedServiceIdentityRest, - DeidUpdate as DeidUpdateRest, - ManagedServiceIdentityUpdate as ManagedServiceIdentityUpdateRest, - DeidPropertiesUpdate as DeidPropertiesUpdateRest, -} from "../rest/index.js"; /** The response of a PrivateLinkResource list operation. */ export interface _PrivateLinkResourceListResult { @@ -138,7 +126,7 @@ export interface PrivateEndpointConnectionResource extends ProxyResource { export function privateEndpointConnectionResourceSerializer( item: PrivateEndpointConnectionResource, -): PrivateEndpointConnectionResourceRest { +): Record { return { properties: !item.properties ? item.properties @@ -160,14 +148,15 @@ export interface PrivateEndpointConnectionProperties { export function privateEndpointConnectionPropertiesSerializer( item: PrivateEndpointConnectionProperties, -): PrivateEndpointConnectionPropertiesRest { +): Record { return { privateEndpoint: !item.privateEndpoint ? item.privateEndpoint : privateEndpointSerializer(item.privateEndpoint), - privateLinkServiceConnectionState: privateLinkServiceConnectionStateSerializer( - item.privateLinkServiceConnectionState, - ), + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateSerializer( + item.privateLinkServiceConnectionState, + ), }; } @@ -193,7 +182,7 @@ export interface PrivateLinkServiceConnectionState { export function privateLinkServiceConnectionStateSerializer( item: PrivateLinkServiceConnectionState, -): PrivateLinkServiceConnectionStateRest { +): Record { return { status: item["status"], description: item["description"], @@ -262,7 +251,9 @@ export interface TrackedResource extends Resource { location: string; } -export function trackedResourceSerializer(item: TrackedResource): TrackedResourceRest { +export function trackedResourceSerializer( + item: TrackedResource, +): Record { return { tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), location: item["location"], @@ -277,14 +268,18 @@ export interface DeidService extends TrackedResource { identity?: ManagedServiceIdentity; } -export function deidServiceSerializer(item: DeidService): DeidServiceRest { +export function deidServiceSerializer( + item: DeidService, +): Record { return { tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), location: item["location"], properties: !item.properties ? item.properties : deidServicePropertiesSerializer(item.properties), - identity: !item.identity ? item.identity : managedServiceIdentitySerializer(item.identity), + identity: !item.identity + ? item.identity + : managedServiceIdentitySerializer(item.identity), }; } @@ -302,7 +297,7 @@ export interface DeidServiceProperties { export function deidServicePropertiesSerializer( item: DeidServiceProperties, -): DeidServicePropertiesRest { +): Record { return { publicNetworkAccess: item["publicNetworkAccess"], }; @@ -352,7 +347,7 @@ export interface ManagedServiceIdentity { export function managedServiceIdentitySerializer( item: ManagedServiceIdentity, -): ManagedServiceIdentityRest { +): Record { return { type: item["type"], userAssignedIdentities: !item.userAssignedIdentities @@ -372,8 +367,8 @@ export enum KnownManagedServiceIdentityType { SystemAssigned = "SystemAssigned", /** UserAssigned */ UserAssigned = "UserAssigned", - /** SystemAssigned,UserAssigned */ - "SystemAssigned,UserAssigned" = "SystemAssigned,UserAssigned", + /** SystemAndUserAssigned */ + SystemAndUserAssigned = "SystemAssigned,UserAssigned", } /** @@ -418,7 +413,9 @@ export interface DeidUpdate { properties?: DeidPropertiesUpdate; } -export function deidUpdateSerializer(item: DeidUpdate): DeidUpdateRest { +export function deidUpdateSerializer( + item: DeidUpdate, +): Record { return { tags: !item.tags ? item.tags : (serializeRecord(item.tags as any) as any), identity: !item.identity @@ -440,7 +437,7 @@ export interface ManagedServiceIdentityUpdate { export function managedServiceIdentityUpdateSerializer( item: ManagedServiceIdentityUpdate, -): ManagedServiceIdentityUpdateRest { +): Record { return { type: item["type"], userAssignedIdentities: !item.userAssignedIdentities @@ -460,7 +457,7 @@ export interface DeidPropertiesUpdate { export function deidPropertiesUpdateSerializer( item: DeidPropertiesUpdate, -): DeidPropertiesUpdateRest { +): Record { return { publicNetworkAccess: item["publicNetworkAccess"], }; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/options.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/options.ts index e641388f7de5..d63d91f83369 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/options.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/options.ts @@ -10,10 +10,12 @@ export interface OperationsListOptionalParams extends OperationOptions {} export interface DeidServicesGetOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface DeidServicesListByResourceGroupOptionalParams extends OperationOptions {} +export interface DeidServicesListByResourceGroupOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface DeidServicesListBySubscriptionOptionalParams extends OperationOptions {} +export interface DeidServicesListBySubscriptionOptionalParams + extends OperationOptions {} /** Optional parameters. */ export interface DeidServicesCreateOptionalParams extends OperationOptions { @@ -34,16 +36,19 @@ export interface DeidServicesDeleteOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface PrivateEndpointConnectionsGetOptionalParams extends OperationOptions {} +export interface PrivateEndpointConnectionsGetOptionalParams + extends OperationOptions {} /** Optional parameters. */ -export interface PrivateEndpointConnectionsCreateOptionalParams extends OperationOptions { +export interface PrivateEndpointConnectionsCreateOptionalParams + extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } /** Optional parameters. */ -export interface PrivateEndpointConnectionsDeleteOptionalParams extends OperationOptions { +export interface PrivateEndpointConnectionsDeleteOptionalParams + extends OperationOptions { /** Delay to wait until next poll, in milliseconds. */ updateIntervalInMs?: number; } @@ -53,4 +58,5 @@ export interface PrivateEndpointConnectionsListByDeidServiceOptionalParams extends OperationOptions {} /** Optional parameters. */ -export interface PrivateLinksListByDeidServiceOptionalParams extends OperationOptions {} +export interface PrivateLinksListByDeidServiceOptionalParams + extends OperationOptions {} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/pagingTypes.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/pagingTypes.ts deleted file mode 100644 index c002c23f31eb..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/models/pagingTypes.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * Options for the byPage method - */ -export interface PageSettings { - /** - * A reference to a specific page to start iterating from. - */ - continuationToken?: string; -} - -/** - * An interface that describes a page of results. - */ -export type ContinuablePage = TPage & { - /** - * The token that keeps track of where to continue the iterator - */ - continuationToken?: string; -}; - -/** - * An interface that allows async iterable iteration both to completion and by page. - */ -export interface PagedAsyncIterableIterator< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, -> { - /** - * The next method, part of the iteration protocol - */ - next(): Promise>; - /** - * The connection to the async iterator, part of the iteration protocol - */ - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - /** - * Return an AsyncIterableIterator that works a page at a time - */ - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; -} - -/** - * An interface that describes how to communicate with the service. - */ -export interface PagedResult< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, -> { - /** - * Link to the first page of results. - */ - firstPageLink?: string; - /** - * A method that returns a page of results. - */ - getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; - /** - * a function to implement the `byPage` method on the paged async iterator. - */ - byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; - - /** - * A function to extract elements from a page. - */ - toElements?: (page: TPage) => TElement[]; -} - -/** - * Options for the paging helper - */ -export interface BuildPagedAsyncIteratorOptions { - itemName?: string; - nextLinkName?: string; -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/clientDefinitions.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/clientDefinitions.ts deleted file mode 100644 index 961f7c6d3079..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/clientDefinitions.ts +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - OperationsListParameters, - DeidServicesGetParameters, - DeidServicesCreateParameters, - DeidServicesUpdateParameters, - DeidServicesDeleteParameters, - DeidServicesListByResourceGroupParameters, - DeidServicesListBySubscriptionParameters, - PrivateEndpointConnectionsGetParameters, - PrivateEndpointConnectionsCreateParameters, - PrivateEndpointConnectionsDeleteParameters, - PrivateEndpointConnectionsListByDeidServiceParameters, - PrivateLinksListByDeidServiceParameters, -} from "./parameters.js"; -import { - OperationsList200Response, - OperationsListDefaultResponse, - DeidServicesGet200Response, - DeidServicesGetDefaultResponse, - DeidServicesCreate200Response, - DeidServicesCreate201Response, - DeidServicesCreateDefaultResponse, - DeidServicesUpdate200Response, - DeidServicesUpdate202Response, - DeidServicesUpdateDefaultResponse, - DeidServicesDelete202Response, - DeidServicesDelete204Response, - DeidServicesDeleteDefaultResponse, - DeidServicesListByResourceGroup200Response, - DeidServicesListByResourceGroupDefaultResponse, - DeidServicesListBySubscription200Response, - DeidServicesListBySubscriptionDefaultResponse, - PrivateEndpointConnectionsGet200Response, - PrivateEndpointConnectionsGetDefaultResponse, - PrivateEndpointConnectionsCreate200Response, - PrivateEndpointConnectionsCreate201Response, - PrivateEndpointConnectionsCreateDefaultResponse, - PrivateEndpointConnectionsDelete202Response, - PrivateEndpointConnectionsDelete204Response, - PrivateEndpointConnectionsDeleteDefaultResponse, - PrivateEndpointConnectionsListByDeidService200Response, - PrivateEndpointConnectionsListByDeidServiceDefaultResponse, - PrivateLinksListByDeidService200Response, - PrivateLinksListByDeidServiceDefaultResponse, -} from "./responses.js"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; - -export interface OperationsList { - /** List the operations for the provider */ - get( - options?: OperationsListParameters, - ): StreamableMethod; -} - -export interface DeidServicesGet { - /** Get a DeidService */ - get( - options?: DeidServicesGetParameters, - ): StreamableMethod; - /** Create a DeidService */ - put( - options: DeidServicesCreateParameters, - ): StreamableMethod< - | DeidServicesCreate200Response - | DeidServicesCreate201Response - | DeidServicesCreateDefaultResponse - >; - /** Update a DeidService */ - patch( - options: DeidServicesUpdateParameters, - ): StreamableMethod< - | DeidServicesUpdate200Response - | DeidServicesUpdate202Response - | DeidServicesUpdateDefaultResponse - >; - /** Delete a DeidService */ - delete( - options?: DeidServicesDeleteParameters, - ): StreamableMethod< - | DeidServicesDelete202Response - | DeidServicesDelete204Response - | DeidServicesDeleteDefaultResponse - >; -} - -export interface DeidServicesListByResourceGroup { - /** List DeidService resources by resource group */ - get( - options?: DeidServicesListByResourceGroupParameters, - ): StreamableMethod< - DeidServicesListByResourceGroup200Response | DeidServicesListByResourceGroupDefaultResponse - >; -} - -export interface DeidServicesListBySubscription { - /** List DeidService resources by subscription ID */ - get( - options?: DeidServicesListBySubscriptionParameters, - ): StreamableMethod< - DeidServicesListBySubscription200Response | DeidServicesListBySubscriptionDefaultResponse - >; -} - -export interface PrivateEndpointConnectionsGet { - /** Get a specific private connection */ - get( - options?: PrivateEndpointConnectionsGetParameters, - ): StreamableMethod< - PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse - >; - /** Create a Private endpoint connection */ - put( - options: PrivateEndpointConnectionsCreateParameters, - ): StreamableMethod< - | PrivateEndpointConnectionsCreate200Response - | PrivateEndpointConnectionsCreate201Response - | PrivateEndpointConnectionsCreateDefaultResponse - >; - /** Delete the private endpoint connection */ - delete( - options?: PrivateEndpointConnectionsDeleteParameters, - ): StreamableMethod< - | PrivateEndpointConnectionsDelete202Response - | PrivateEndpointConnectionsDelete204Response - | PrivateEndpointConnectionsDeleteDefaultResponse - >; -} - -export interface PrivateEndpointConnectionsListByDeidService { - /** List private endpoint connections on the given resource */ - get( - options?: PrivateEndpointConnectionsListByDeidServiceParameters, - ): StreamableMethod< - | PrivateEndpointConnectionsListByDeidService200Response - | PrivateEndpointConnectionsListByDeidServiceDefaultResponse - >; -} - -export interface PrivateLinksListByDeidService { - /** List private links on the given resource */ - get( - options?: PrivateLinksListByDeidServiceParameters, - ): StreamableMethod< - PrivateLinksListByDeidService200Response | PrivateLinksListByDeidServiceDefaultResponse - >; -} - -export interface Routes { - /** Resource for '/providers/Microsoft.HealthDataAIServices/operations' has methods for the following verbs: get */ - (path: "/providers/Microsoft.HealthDataAIServices/operations"): OperationsList; - /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.HealthDataAIServices/deidServices/\{deidServiceName\}' has methods for the following verbs: get, put, patch, delete */ - ( - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}", - subscriptionId: string, - resourceGroupName: string, - deidServiceName: string, - ): DeidServicesGet; - /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.HealthDataAIServices/deidServices' has methods for the following verbs: get */ - ( - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices", - subscriptionId: string, - resourceGroupName: string, - ): DeidServicesListByResourceGroup; - /** Resource for '/subscriptions/\{subscriptionId\}/providers/Microsoft.HealthDataAIServices/deidServices' has methods for the following verbs: get */ - ( - path: "/subscriptions/{subscriptionId}/providers/Microsoft.HealthDataAIServices/deidServices", - subscriptionId: string, - ): DeidServicesListBySubscription; - /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.HealthDataAIServices/deidServices/\{deidServiceName\}/privateEndpointConnections/\{privateEndpointConnectionName\}' has methods for the following verbs: get, put, delete */ - ( - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - subscriptionId: string, - resourceGroupName: string, - deidServiceName: string, - privateEndpointConnectionName: string, - ): PrivateEndpointConnectionsGet; - /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.HealthDataAIServices/deidServices/\{deidServiceName\}/privateEndpointConnections' has methods for the following verbs: get */ - ( - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections", - subscriptionId: string, - resourceGroupName: string, - deidServiceName: string, - ): PrivateEndpointConnectionsListByDeidService; - /** Resource for '/subscriptions/\{subscriptionId\}/resourceGroups/\{resourceGroupName\}/providers/Microsoft.HealthDataAIServices/deidServices/\{deidServiceName\}/privateLinkResources' has methods for the following verbs: get */ - ( - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources", - subscriptionId: string, - resourceGroupName: string, - deidServiceName: string, - ): PrivateLinksListByDeidService; -} - -export type HealthDataAIServicesContext = Client & { - path: Routes; -}; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/healthDataAIServicesClient.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/healthDataAIServicesClient.ts deleted file mode 100644 index 1a6ffcd95342..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/healthDataAIServicesClient.ts +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getClient, ClientOptions } from "@azure-rest/core-client"; -import { logger } from "../logger.js"; -import { TokenCredential } from "@azure/core-auth"; -import { HealthDataAIServicesContext } from "./clientDefinitions.js"; - -/** The optional parameters for the client */ -export interface HealthDataAIServicesContextOptions extends ClientOptions { - /** The api version option of the client */ - apiVersion?: string; -} - -/** - * Initialize a new instance of `HealthDataAIServicesContext` - * @param credentials - uniquely identify client credential - * @param options - the parameter for all optional parameters - */ -export default function createClient( - credentials: TokenCredential, - { apiVersion = "2024-02-28-preview", ...options }: HealthDataAIServicesContextOptions = {}, -): HealthDataAIServicesContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; - const userAgentInfo = `azsdk-js-arm-healthdataaiservices/1.0.0-beta.2`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` - : `${userAgentInfo}`; - options = { - ...options, - userAgentOptions: { - userAgentPrefix, - }, - loggingOptions: { - logger: options.loggingOptions?.logger ?? logger.info, - }, - credentials: { - scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], - }, - }; - const client = getClient(endpointUrl, credentials, options) as HealthDataAIServicesContext; - - client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - client.pipeline.addPolicy({ - name: "ClientApiVersionPolicy", - sendRequest: (req, next) => { - // Use the apiVersion defined in request url directly - // Append one if there is no apiVersion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; - } - - return next(req); - }, - }); - return client; -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/index.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/index.ts deleted file mode 100644 index ad8f052fc7da..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import HealthDataAIServicesClient from "./healthDataAIServicesClient.js"; - -export * from "./healthDataAIServicesClient.js"; -export * from "./parameters.js"; -export * from "./responses.js"; -export * from "./clientDefinitions.js"; -export * from "./isUnexpected.js"; -export * from "./models.js"; -export * from "./outputModels.js"; -export * from "./paginateHelper.js"; -export * from "./pollingHelper.js"; - -export default HealthDataAIServicesClient; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/isUnexpected.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/isUnexpected.ts deleted file mode 100644 index 51ff0fac2f5d..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/isUnexpected.ts +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - OperationsList200Response, - OperationsListDefaultResponse, - DeidServicesGet200Response, - DeidServicesGetDefaultResponse, - DeidServicesCreate200Response, - DeidServicesCreate201Response, - DeidServicesCreateLogicalResponse, - DeidServicesCreateDefaultResponse, - DeidServicesUpdate200Response, - DeidServicesUpdate202Response, - DeidServicesUpdateLogicalResponse, - DeidServicesUpdateDefaultResponse, - DeidServicesDelete202Response, - DeidServicesDelete204Response, - DeidServicesDeleteLogicalResponse, - DeidServicesDeleteDefaultResponse, - DeidServicesListByResourceGroup200Response, - DeidServicesListByResourceGroupDefaultResponse, - DeidServicesListBySubscription200Response, - DeidServicesListBySubscriptionDefaultResponse, - PrivateEndpointConnectionsGet200Response, - PrivateEndpointConnectionsGetDefaultResponse, - PrivateEndpointConnectionsCreate200Response, - PrivateEndpointConnectionsCreate201Response, - PrivateEndpointConnectionsCreateLogicalResponse, - PrivateEndpointConnectionsCreateDefaultResponse, - PrivateEndpointConnectionsDelete202Response, - PrivateEndpointConnectionsDelete204Response, - PrivateEndpointConnectionsDeleteLogicalResponse, - PrivateEndpointConnectionsDeleteDefaultResponse, - PrivateEndpointConnectionsListByDeidService200Response, - PrivateEndpointConnectionsListByDeidServiceDefaultResponse, - PrivateLinksListByDeidService200Response, - PrivateLinksListByDeidServiceDefaultResponse, -} from "./responses.js"; - -const responseMap: Record = { - "GET /providers/Microsoft.HealthDataAIServices/operations": ["200"], - "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - ["200"], - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - ["200", "201"], - "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - ["200", "202"], - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - ["202", "204"], - "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices": - ["200"], - "GET /subscriptions/{subscriptionId}/providers/Microsoft.HealthDataAIServices/deidServices": [ - "200", - ], - "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}": - ["200"], - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}": - ["200", "201"], - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}": - ["202", "204"], - "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections": - ["200"], - "GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateLinkResources": - ["200"], -}; - -export function isUnexpected( - response: OperationsList200Response | OperationsListDefaultResponse, -): response is OperationsListDefaultResponse; -export function isUnexpected( - response: DeidServicesGet200Response | DeidServicesGetDefaultResponse, -): response is DeidServicesGetDefaultResponse; -export function isUnexpected( - response: - | DeidServicesCreate200Response - | DeidServicesCreate201Response - | DeidServicesCreateLogicalResponse - | DeidServicesCreateDefaultResponse, -): response is DeidServicesCreateDefaultResponse; -export function isUnexpected( - response: - | DeidServicesUpdate200Response - | DeidServicesUpdate202Response - | DeidServicesUpdateLogicalResponse - | DeidServicesUpdateDefaultResponse, -): response is DeidServicesUpdateDefaultResponse; -export function isUnexpected( - response: - | DeidServicesDelete202Response - | DeidServicesDelete204Response - | DeidServicesDeleteLogicalResponse - | DeidServicesDeleteDefaultResponse, -): response is DeidServicesDeleteDefaultResponse; -export function isUnexpected( - response: - | DeidServicesListByResourceGroup200Response - | DeidServicesListByResourceGroupDefaultResponse, -): response is DeidServicesListByResourceGroupDefaultResponse; -export function isUnexpected( - response: - | DeidServicesListBySubscription200Response - | DeidServicesListBySubscriptionDefaultResponse, -): response is DeidServicesListBySubscriptionDefaultResponse; -export function isUnexpected( - response: PrivateEndpointConnectionsGet200Response | PrivateEndpointConnectionsGetDefaultResponse, -): response is PrivateEndpointConnectionsGetDefaultResponse; -export function isUnexpected( - response: - | PrivateEndpointConnectionsCreate200Response - | PrivateEndpointConnectionsCreate201Response - | PrivateEndpointConnectionsCreateLogicalResponse - | PrivateEndpointConnectionsCreateDefaultResponse, -): response is PrivateEndpointConnectionsCreateDefaultResponse; -export function isUnexpected( - response: - | PrivateEndpointConnectionsDelete202Response - | PrivateEndpointConnectionsDelete204Response - | PrivateEndpointConnectionsDeleteLogicalResponse - | PrivateEndpointConnectionsDeleteDefaultResponse, -): response is PrivateEndpointConnectionsDeleteDefaultResponse; -export function isUnexpected( - response: - | PrivateEndpointConnectionsListByDeidService200Response - | PrivateEndpointConnectionsListByDeidServiceDefaultResponse, -): response is PrivateEndpointConnectionsListByDeidServiceDefaultResponse; -export function isUnexpected( - response: PrivateLinksListByDeidService200Response | PrivateLinksListByDeidServiceDefaultResponse, -): response is PrivateLinksListByDeidServiceDefaultResponse; -export function isUnexpected( - response: - | OperationsList200Response - | OperationsListDefaultResponse - | DeidServicesGet200Response - | DeidServicesGetDefaultResponse - | DeidServicesCreate200Response - | DeidServicesCreate201Response - | DeidServicesCreateLogicalResponse - | DeidServicesCreateDefaultResponse - | DeidServicesUpdate200Response - | DeidServicesUpdate202Response - | DeidServicesUpdateLogicalResponse - | DeidServicesUpdateDefaultResponse - | DeidServicesDelete202Response - | DeidServicesDelete204Response - | DeidServicesDeleteLogicalResponse - | DeidServicesDeleteDefaultResponse - | DeidServicesListByResourceGroup200Response - | DeidServicesListByResourceGroupDefaultResponse - | DeidServicesListBySubscription200Response - | DeidServicesListBySubscriptionDefaultResponse - | PrivateEndpointConnectionsGet200Response - | PrivateEndpointConnectionsGetDefaultResponse - | PrivateEndpointConnectionsCreate200Response - | PrivateEndpointConnectionsCreate201Response - | PrivateEndpointConnectionsCreateLogicalResponse - | PrivateEndpointConnectionsCreateDefaultResponse - | PrivateEndpointConnectionsDelete202Response - | PrivateEndpointConnectionsDelete204Response - | PrivateEndpointConnectionsDeleteLogicalResponse - | PrivateEndpointConnectionsDeleteDefaultResponse - | PrivateEndpointConnectionsListByDeidService200Response - | PrivateEndpointConnectionsListByDeidServiceDefaultResponse - | PrivateLinksListByDeidService200Response - | PrivateLinksListByDeidServiceDefaultResponse, -): response is - | OperationsListDefaultResponse - | DeidServicesGetDefaultResponse - | DeidServicesCreateDefaultResponse - | DeidServicesUpdateDefaultResponse - | DeidServicesDeleteDefaultResponse - | DeidServicesListByResourceGroupDefaultResponse - | DeidServicesListBySubscriptionDefaultResponse - | PrivateEndpointConnectionsGetDefaultResponse - | PrivateEndpointConnectionsCreateDefaultResponse - | PrivateEndpointConnectionsDeleteDefaultResponse - | PrivateEndpointConnectionsListByDeidServiceDefaultResponse - | PrivateLinksListByDeidServiceDefaultResponse { - const lroOriginal = response.headers["x-ms-original-url"]; - const url = new URL(lroOriginal ?? response.request.url); - const method = response.request.method; - let pathDetails = responseMap[`${method} ${url.pathname}`]; - if (!pathDetails) { - pathDetails = getParametrizedPathSuccess(method, url.pathname); - } - return !pathDetails.includes(response.status); -} - -function getParametrizedPathSuccess(method: string, path: string): string[] { - const pathParts = path.split("/"); - - // Traverse list to match the longest candidate - // matchedLen: the length of candidate path - // matchedValue: the matched status code array - let matchedLen = -1, - matchedValue: string[] = []; - - // Iterate the responseMap to find a match - for (const [key, value] of Object.entries(responseMap)) { - // Extracting the path from the map key which is in format - // GET /path/foo - if (!key.startsWith(method)) { - continue; - } - const candidatePath = getPathFromMapKey(key); - // Get each part of the url path - const candidateParts = candidatePath.split("/"); - - // track if we have found a match to return the values found. - let found = true; - for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { - if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { - const start = candidateParts[i]!.indexOf("}") + 1, - end = candidateParts[i]?.length; - // If the current part of the candidate is a "template" part - // Try to use the suffix of pattern to match the path - // {guid} ==> $ - // {guid}:export ==> :export$ - const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( - pathParts[j] || "", - ); - - if (!isMatched) { - found = false; - break; - } - continue; - } - - // If the candidate part is not a template and - // the parts don't match mark the candidate as not found - // to move on with the next candidate path. - if (candidateParts[i] !== pathParts[j]) { - found = false; - break; - } - } - - // We finished evaluating the current candidate parts - // Update the matched value if and only if we found the longer pattern - if (found && candidatePath.length > matchedLen) { - matchedLen = candidatePath.length; - matchedValue = value; - } - } - - return matchedValue; -} - -function getPathFromMapKey(mapKey: string): string { - const pathStart = mapKey.indexOf("/"); - return mapKey.slice(pathStart); -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/models.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/models.ts deleted file mode 100644 index a14e32ae224f..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/models.ts +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** A HealthDataAIServicesProviderHub resource */ -export interface DeidService extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: DeidServiceProperties; - /** The managed service identities assigned to this resource. */ - identity?: ManagedServiceIdentity; -} - -/** Details of the HealthDataAIServices DeidService. */ -export interface DeidServiceProperties { - /** Gets or sets allow or disallow public network access to resource */ - publicNetworkAccess?: PublicNetworkAccess; -} - -/** The private endpoint connection resource */ -export interface PrivateEndpointConnection extends Resource { - /** The private endpoint connection properties */ - properties?: PrivateEndpointConnectionProperties; -} - -/** Properties of the private endpoint connection. */ -export interface PrivateEndpointConnectionProperties { - /** The private endpoint resource. */ - privateEndpoint?: PrivateEndpoint; - /** A collection of information about the state of the connection between service consumer and provider. */ - privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; -} - -/** The Private Endpoint resource. */ -export interface PrivateEndpoint {} - -/** A collection of information about the state of the connection between service consumer and provider. */ -export interface PrivateLinkServiceConnectionState { - /** - * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. - * - * Possible values: "Pending", "Approved", "Rejected" - */ - status?: PrivateEndpointServiceConnectionStatus; - /** The reason for approval/rejection of the connection. */ - description?: string; - /** A message indicating if changes on the service provider require any updates on the consumer. */ - actionsRequired?: string; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource {} - -/** 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. - * - * Possible values: "User", "Application", "ManagedIdentity", "Key" - */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date | string; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** - * The type of identity that last modified the resource. - * - * Possible values: "User", "Application", "ManagedIdentity", "Key" - */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date | string; -} - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: Record; - /** The geo-location where the resource lives */ - location: string; -} - -/** The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. */ -export interface ResourceModelWithAllowedPropertySet extends TrackedResource { - /** - * The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. - * If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - */ - managedBy?: string; - /** - * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. - * If supported, the resource provider must validate and persist this value. - */ - kind?: string; - /** - * The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. - * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), - * If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - */ - eTag?: string; - identity?: Identity; - sku?: Sku; - plan?: Plan; -} - -/** Identity for the resource. */ -export interface Identity { - /** The identity type. */ - type?: ResourceIdentityType; -} - -/** The resource model definition representing SKU */ -export interface Sku { - /** The name of the SKU. Ex - P3. It is typically a letter+number code */ - name: string; - /** This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. */ - tier?: SkuTier; - /** The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. */ - size?: string; - /** If the service has different generations of hardware, for the same SKU, then that can be captured here. */ - family?: string; - /** If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. */ - capacity?: number; -} - -/** Plan for the resource. */ -export interface Plan { - /** A user defined name of the 3rd Party Artifact that is being procured. */ - name: string; - /** The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic */ - publisher: string; - /** The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. */ - product: string; - /** A publisher provided promotion code as provisioned in Data Market for the said product/artifact. */ - promotionCode?: string; - /** The version of the desired product/artifact. */ - version?: string; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -/** Holder for private endpoint connections */ -export interface PrivateEndpointConnectionResource extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: PrivateEndpointConnectionProperties; -} - -/** Private Links for DeidService resource */ -export interface PrivateLinkResource extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: PrivateLinkResourceProperties; -} - -/** Properties of a private link resource. */ -export interface PrivateLinkResourceProperties { - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; -} - -/** The base extension resource. */ -export interface ExtensionResource extends Resource {} - -/** The resource model definition for an Azure Resource Manager resource with an etag. */ -export interface AzureEntityResource extends Resource {} - -/** A private link resource. */ -export interface PrivateLinkResource extends Resource { - /** Resource properties. */ - properties?: PrivateLinkResourceProperties; -} - -/** Managed service identity (system assigned and/or user assigned identities) */ -export interface ManagedServiceIdentity { - /** - * The type of managed identity assigned to this resource. - * - * Possible values: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned" - */ - type: ManagedServiceIdentityType; - /** The identities assigned to this resource by the user. */ - userAssignedIdentities?: Record; -} - -/** User assigned identity properties */ -export interface UserAssignedIdentity {} - -/** Patch request body for DeidService */ -export interface DeidUpdate { - /** Resource tags. */ - tags?: Record; - /** Updatable managed service identity */ - identity?: ManagedServiceIdentityUpdate; - /** RP-specific properties */ - properties?: DeidPropertiesUpdate; -} - -/** The template for adding optional properties. */ -export interface ManagedServiceIdentityUpdate { - /** - * The type of managed identity assigned to this resource. - * - * Possible values: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned" - */ - type?: ManagedServiceIdentityType; - /** The identities assigned to this resource by the user. */ - userAssignedIdentities?: Record; -} - -/** The template for adding optional properties. */ -export interface DeidPropertiesUpdate { - /** Gets or sets allow or disallow public network access to resource */ - publicNetworkAccess?: PublicNetworkAccess; -} - -/** Alias for ResourceProvisioningState */ -export type ResourceProvisioningState = string; -/** Alias for ProvisioningState */ -export type ProvisioningState = string; -/** Alias for PrivateEndpointServiceConnectionStatus */ -export type PrivateEndpointServiceConnectionStatus = string; -/** Alias for PrivateEndpointConnectionProvisioningState */ -export type PrivateEndpointConnectionProvisioningState = string; -/** Alias for CreatedByType */ -export type CreatedByType = string; -/** Alias for ResourceIdentityType */ -export type ResourceIdentityType = "SystemAssigned"; -/** Alias for SkuTier */ -export type SkuTier = "Free" | "Basic" | "Standard" | "Premium"; -/** State of the public network access. */ -export type PublicNetworkAccess = "Enabled" | "Disabled"; -/** Alias for ManagedServiceIdentityType */ -export type ManagedServiceIdentityType = string; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/outputModels.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/outputModels.ts deleted file mode 100644 index 0ac87c9a1161..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/outputModels.ts +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { Paged } from "@azure/core-paging"; - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface OperationOutput { - /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - readonly name?: string; - /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - readonly display?: OperationDisplayOutput; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * - * Possible values: "user", "system", "user,system" - */ - readonly origin?: OriginOutput; - /** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * - * Possible values: "Internal" - */ - actionType?: ActionTypeOutput; -} - -/** Localized display information for and operation. */ -export interface OperationDisplayOutput { - /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ - readonly provider?: string; - /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ - readonly resource?: string; - /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ - readonly operation?: string; - /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ - readonly description?: string; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ -export interface ErrorResponseOutput { - /** The error object. */ - error?: ErrorDetailOutput; -} - -/** The error detail. */ -export interface ErrorDetailOutput { - /** The error code. */ - readonly code?: string; - /** The error message. */ - readonly message?: string; - /** The error target. */ - readonly target?: string; - /** The error details. */ - readonly details?: Array; - /** The error additional info. */ - readonly additionalInfo?: Array; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfoOutput { - /** The additional info type. */ - readonly type?: string; - /** The additional info. */ - readonly info?: Record; -} - -/** A HealthDataAIServicesProviderHub resource */ -export interface DeidServiceOutput extends TrackedResourceOutput { - /** The resource-specific properties for this resource. */ - properties?: DeidServicePropertiesOutput; - /** The managed service identities assigned to this resource. */ - identity?: ManagedServiceIdentityOutput; -} - -/** Details of the HealthDataAIServices DeidService. */ -export interface DeidServicePropertiesOutput { - /** - * The status of the last operation. - * - * Possible values: "Provisioning", "Updating", "Deleting", "Accepted" - */ - readonly provisioningState?: ProvisioningStateOutput; - /** Deid service url. */ - readonly serviceUrl?: string; - /** List of private endpoint connections. */ - readonly privateEndpointConnections?: Array; - /** Gets or sets allow or disallow public network access to resource */ - publicNetworkAccess?: PublicNetworkAccessOutput; -} - -/** The private endpoint connection resource */ -export interface PrivateEndpointConnectionOutput extends ResourceOutput { - /** The private endpoint connection properties */ - properties?: PrivateEndpointConnectionPropertiesOutput; -} - -/** Properties of the private endpoint connection. */ -export interface PrivateEndpointConnectionPropertiesOutput { - /** The group ids for the private endpoint resource. */ - readonly groupIds?: string[]; - /** The private endpoint resource. */ - privateEndpoint?: PrivateEndpointOutput; - /** A collection of information about the state of the connection between service consumer and provider. */ - privateLinkServiceConnectionState: PrivateLinkServiceConnectionStateOutput; - /** - * The provisioning state of the private endpoint connection resource. - * - * Possible values: "Succeeded", "Creating", "Deleting", "Failed" - */ - readonly provisioningState?: PrivateEndpointConnectionProvisioningStateOutput; -} - -/** The Private Endpoint resource. */ -export interface PrivateEndpointOutput { - /** The resource identifier for private endpoint */ - readonly id?: string; -} - -/** A collection of information about the state of the connection between service consumer and provider. */ -export interface PrivateLinkServiceConnectionStateOutput { - /** - * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. - * - * Possible values: "Pending", "Approved", "Rejected" - */ - status?: PrivateEndpointServiceConnectionStatusOutput; - /** The reason for approval/rejection of the connection. */ - description?: string; - /** A message indicating if changes on the service provider require any updates on the consumer. */ - actionsRequired?: string; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface ResourceOutput { - /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - readonly id?: string; - /** The name of the resource */ - readonly name?: string; - /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ - readonly type?: string; - /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - readonly systemData?: SystemDataOutput; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemDataOutput { - /** The identity that created the resource. */ - createdBy?: string; - /** - * The type of identity that created the resource. - * - * Possible values: "User", "Application", "ManagedIdentity", "Key" - */ - createdByType?: CreatedByTypeOutput; - /** The timestamp of resource creation (UTC). */ - createdAt?: string; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** - * The type of identity that last modified the resource. - * - * Possible values: "User", "Application", "ManagedIdentity", "Key" - */ - lastModifiedByType?: CreatedByTypeOutput; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: string; -} - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResourceOutput extends ResourceOutput { - /** Resource tags. */ - tags?: Record; - /** The geo-location where the resource lives */ - location: string; -} - -/** The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. */ -export interface ResourceModelWithAllowedPropertySetOutput extends TrackedResourceOutput { - /** - * The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. - * If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - */ - managedBy?: string; - /** - * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. - * If supported, the resource provider must validate and persist this value. - */ - kind?: string; - /** - * The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. - * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), - * If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - */ - eTag?: string; - identity?: IdentityOutput; - sku?: SkuOutput; - plan?: PlanOutput; -} - -/** Identity for the resource. */ -export interface IdentityOutput { - /** The principal ID of resource identity. The value must be an UUID. */ - readonly principalId?: string; - /** The tenant ID of resource. The value must be an UUID. */ - readonly tenantId?: string; - /** The identity type. */ - type?: ResourceIdentityTypeOutput; -} - -/** The resource model definition representing SKU */ -export interface SkuOutput { - /** The name of the SKU. Ex - P3. It is typically a letter+number code */ - name: string; - /** This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. */ - tier?: SkuTierOutput; - /** The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. */ - size?: string; - /** If the service has different generations of hardware, for the same SKU, then that can be captured here. */ - family?: string; - /** If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. */ - capacity?: number; -} - -/** Plan for the resource. */ -export interface PlanOutput { - /** A user defined name of the 3rd Party Artifact that is being procured. */ - name: string; - /** The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic */ - publisher: string; - /** The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. */ - product: string; - /** A publisher provided promotion code as provisioned in Data Market for the said product/artifact. */ - promotionCode?: string; - /** The version of the desired product/artifact. */ - version?: string; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResourceOutput extends ResourceOutput {} - -/** Holder for private endpoint connections */ -export interface PrivateEndpointConnectionResourceOutput extends ProxyResourceOutput { - /** The resource-specific properties for this resource. */ - properties?: PrivateEndpointConnectionPropertiesOutput; -} - -/** Private Links for DeidService resource */ -export interface PrivateLinkResourceOutput extends ProxyResourceOutput { - /** The resource-specific properties for this resource. */ - properties?: PrivateLinkResourcePropertiesOutput; -} - -/** Properties of a private link resource. */ -export interface PrivateLinkResourcePropertiesOutput { - /** The private link resource group id. */ - readonly groupId?: string; - /** The private link resource required member names. */ - readonly requiredMembers?: string[]; - /** The private link resource private link DNS zone name. */ - requiredZoneNames?: string[]; -} - -/** The base extension resource. */ -export interface ExtensionResourceOutput extends ResourceOutput {} - -/** The resource model definition for an Azure Resource Manager resource with an etag. */ -export interface AzureEntityResourceOutput extends ResourceOutput { - /** Resource Etag. */ - readonly etag?: string; -} - -/** A private link resource. */ -export interface PrivateLinkResourceOutput extends ResourceOutput { - /** Resource properties. */ - properties?: PrivateLinkResourcePropertiesOutput; -} - -/** Managed service identity (system assigned and/or user assigned identities) */ -export interface ManagedServiceIdentityOutput { - /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ - readonly principalId?: string; - /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ - readonly tenantId?: string; - /** - * The type of managed identity assigned to this resource. - * - * Possible values: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned" - */ - type: ManagedServiceIdentityTypeOutput; - /** The identities assigned to this resource by the user. */ - userAssignedIdentities?: Record; -} - -/** User assigned identity properties */ -export interface UserAssignedIdentityOutput { - /** The principal ID of the assigned identity. */ - readonly principalId?: string; - /** The client ID of the assigned identity. */ - readonly clientId?: string; -} - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export type OperationListResultOutput = Paged; -/** Alias for OriginOutput */ -export type OriginOutput = string; -/** Alias for ActionTypeOutput */ -export type ActionTypeOutput = string; -/** Alias for ResourceProvisioningStateOutput */ -export type ResourceProvisioningStateOutput = string; -/** Alias for ProvisioningStateOutput */ -export type ProvisioningStateOutput = string; -/** Alias for PrivateEndpointServiceConnectionStatusOutput */ -export type PrivateEndpointServiceConnectionStatusOutput = string; -/** Alias for PrivateEndpointConnectionProvisioningStateOutput */ -export type PrivateEndpointConnectionProvisioningStateOutput = string; -/** Alias for CreatedByTypeOutput */ -export type CreatedByTypeOutput = string; -/** Alias for ResourceIdentityTypeOutput */ -export type ResourceIdentityTypeOutput = "SystemAssigned"; -/** Alias for SkuTierOutput */ -export type SkuTierOutput = "Free" | "Basic" | "Standard" | "Premium"; -/** State of the public network access. */ -export type PublicNetworkAccessOutput = "Enabled" | "Disabled"; -/** Alias for ManagedServiceIdentityTypeOutput */ -export type ManagedServiceIdentityTypeOutput = string; -/** The response of a DeidService list operation. */ -export type DeidServiceListResultOutput = Paged; -/** The response of a PrivateEndpointConnectionResource list operation. */ -export type PrivateEndpointConnectionResourceListResultOutput = - Paged; -/** The response of a PrivateLinkResource list operation. */ -export type PrivateLinkResourceListResultOutput = Paged; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/paginateHelper.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/paginateHelper.ts deleted file mode 100644 index e27846d32a90..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/paginateHelper.ts +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; -import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; - -/** - * Helper type to extract the type of an array - */ -export type GetArrayType = T extends Array ? TData : never; - -/** - * The type of a custom function that defines how to get a page and a link to the next one if any. - */ -export type GetPage = ( - pageLink: string, - maxPageSize?: number, -) => Promise<{ - page: TPage; - nextPageLink?: string; -}>; - -/** - * Options for the paging helper - */ -export interface PagingOptions { - /** - * Custom function to extract pagination details for crating the PagedAsyncIterableIterator - */ - customGetPage?: GetPage[]>; -} - -/** - * Helper type to infer the Type of the paged elements from the response type - * This type is generated based on the swagger information for x-ms-pageable - * specifically on the itemName property which indicates the property of the response - * where the page items are found. The default value is `value`. - * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter - */ -export type PaginateReturn = TResult extends { - body: { value?: infer TPage }; -} - ? GetArrayType - : Array; - -/** - * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension - * @param client - Client to use for sending the next page requests - * @param initialResponse - Initial response containing the nextLink and current page of elements - * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results - * @returns - PagedAsyncIterableIterator to iterate the elements - */ -export function paginate( - client: Client, - initialResponse: TResponse, - options: PagingOptions = {}, -): PagedAsyncIterableIterator> { - // Extract element type from initial response - type TElement = PaginateReturn; - let firstRun = true; - const itemName = "value"; - const nextLinkName = "nextLink"; - const { customGetPage } = options; - const pagedResult: PagedResult = { - firstPageLink: "", - getPage: - typeof customGetPage === "function" - ? customGetPage - : async (pageLink: string) => { - const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); - firstRun = false; - checkPagingRequest(result); - const nextLink = getNextLink(result.body, nextLinkName); - const values = getElements(result.body, itemName); - return { - page: values, - nextPageLink: nextLink, - }; - }, - }; - - return getPagedAsyncIterator(pagedResult); -} - -/** - * Gets for the value of nextLink in the body - */ -function getNextLink(body: unknown, nextLinkName?: string): string | undefined { - if (!nextLinkName) { - return undefined; - } - - const nextLink = (body as Record)[nextLinkName]; - - if (typeof nextLink !== "string" && typeof nextLink !== "undefined") { - throw new Error(`Body Property ${nextLinkName} should be a string or undefined`); - } - - return nextLink; -} - -/** - * Gets the elements of the current request in the body. - */ -function getElements(body: unknown, itemName: string): T[] { - const value = (body as Record)[itemName] as T[]; - - // value has to be an array according to the x-ms-pageable extension. - // The fact that this must be an array is used above to calculate the - // type of elements in the page in PaginateReturn - if (!Array.isArray(value)) { - throw new Error( - `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, - ); - } - - return value ?? []; -} - -/** - * Checks if a request failed - */ -function checkPagingRequest(response: PathUncheckedResponse): void { - const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"]; - if (!Http2xxStatusCodes.includes(response.status)) { - throw createRestError( - `Pagination failed with unexpected statusCode ${response.status}`, - response, - ); - } -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/parameters.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/parameters.ts deleted file mode 100644 index c6037f57f0bc..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/parameters.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { RequestParameters } from "@azure-rest/core-client"; -import { DeidService, DeidUpdate, PrivateEndpointConnectionResource } from "./models.js"; - -export type OperationsListParameters = RequestParameters; -export type DeidServicesGetParameters = RequestParameters; -export type DeidServicesListByResourceGroupParameters = RequestParameters; -export type DeidServicesListBySubscriptionParameters = RequestParameters; - -export interface DeidServicesCreateBodyParam { - /** Resource create parameters. */ - body: DeidService; -} - -export type DeidServicesCreateParameters = DeidServicesCreateBodyParam & RequestParameters; - -export interface DeidServicesUpdateBodyParam { - /** The resource properties to be updated. */ - body: DeidUpdate; -} - -export type DeidServicesUpdateParameters = DeidServicesUpdateBodyParam & RequestParameters; -export type DeidServicesDeleteParameters = RequestParameters; -export type PrivateEndpointConnectionsGetParameters = RequestParameters; - -export interface PrivateEndpointConnectionsCreateBodyParam { - /** Resource create parameters. */ - body: PrivateEndpointConnectionResource; -} - -export type PrivateEndpointConnectionsCreateParameters = PrivateEndpointConnectionsCreateBodyParam & - RequestParameters; -export type PrivateEndpointConnectionsDeleteParameters = RequestParameters; -export type PrivateEndpointConnectionsListByDeidServiceParameters = RequestParameters; -export type PrivateLinksListByDeidServiceParameters = RequestParameters; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/pollingHelper.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/pollingHelper.ts deleted file mode 100644 index c9c42fb78e69..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/pollingHelper.ts +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { Client, HttpResponse } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { - CancelOnProgress, - CreateHttpPollerOptions, - RunningOperation, - OperationResponse, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { - DeidServicesCreate200Response, - DeidServicesCreate201Response, - DeidServicesCreateDefaultResponse, - DeidServicesCreateLogicalResponse, - DeidServicesUpdate200Response, - DeidServicesUpdate202Response, - DeidServicesUpdateDefaultResponse, - DeidServicesUpdateLogicalResponse, - DeidServicesDelete202Response, - DeidServicesDelete204Response, - DeidServicesDeleteDefaultResponse, - DeidServicesDeleteLogicalResponse, - PrivateEndpointConnectionsCreate200Response, - PrivateEndpointConnectionsCreate201Response, - PrivateEndpointConnectionsCreateDefaultResponse, - PrivateEndpointConnectionsCreateLogicalResponse, - PrivateEndpointConnectionsDelete202Response, - PrivateEndpointConnectionsDelete204Response, - PrivateEndpointConnectionsDeleteDefaultResponse, - PrivateEndpointConnectionsDeleteLogicalResponse, -} from "./responses.js"; - -/** - * A simple poller that can be used to poll a long running operation. - */ -export interface SimplePollerLike, TResult> { - /** - * Returns true if the poller has finished polling. - */ - isDone(): boolean; - /** - * Returns the state of the operation. - */ - getOperationState(): TState; - /** - * Returns the result value of the operation, - * regardless of the state of the poller. - * It can return undefined or an incomplete form of the final TResult value - * depending on the implementation. - */ - getResult(): TResult | undefined; - /** - * Returns a promise that will resolve once a single polling request finishes. - * It does this by calling the update method of the Poller's operation. - */ - poll(options?: { abortSignal?: AbortSignalLike }): Promise; - /** - * Returns a promise that will resolve once the underlying operation is completed. - */ - pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise; - /** - * Invokes the provided callback after each polling is completed, - * sending the current state of the poller's operation. - * - * It returns a method that can be used to stop receiving updates on the given callback function. - */ - onProgress(callback: (state: TState) => void): CancelOnProgress; - - /** - * Returns a promise that could be used for serialized version of the poller's operation - * by invoking the operation's serialize method. - */ - serialize(): Promise; - - /** - * Wait the poller to be submitted. - */ - submitted(): Promise; - - /** - * Returns a string representation of the poller's operation. Similar to serialize but returns a string. - * @deprecated Use serialize() instead. - */ - toString(): string; - - /** - * Stops the poller from continuing to poll. Please note this will only stop the client-side polling - * @deprecated Use abortSignal to stop polling instead. - */ - stopPolling(): void; - - /** - * Returns true if the poller is stopped. - * @deprecated Use abortSignal status to track this instead. - */ - isStopped(): boolean; -} - -/** - * Helper function that builds a Poller object to help polling a long running operation. - * @param client - Client to use for sending the request to get additional pages. - * @param initialResponse - The initial response. - * @param options - Options to set a resume state or custom polling interval. - * @returns - A poller object to poll for operation state updates and eventually get the final response. - */ -export async function getLongRunningPoller< - TResult extends DeidServicesCreateLogicalResponse | DeidServicesCreateDefaultResponse, ->( - client: Client, - initialResponse: - | DeidServicesCreate200Response - | DeidServicesCreate201Response - | DeidServicesCreateDefaultResponse, - options?: CreateHttpPollerOptions>, -): Promise, TResult>>; -export async function getLongRunningPoller< - TResult extends DeidServicesUpdateLogicalResponse | DeidServicesUpdateDefaultResponse, ->( - client: Client, - initialResponse: - | DeidServicesUpdate200Response - | DeidServicesUpdate202Response - | DeidServicesUpdateDefaultResponse, - options?: CreateHttpPollerOptions>, -): Promise, TResult>>; -export async function getLongRunningPoller< - TResult extends DeidServicesDeleteLogicalResponse | DeidServicesDeleteDefaultResponse, ->( - client: Client, - initialResponse: - | DeidServicesDelete202Response - | DeidServicesDelete204Response - | DeidServicesDeleteDefaultResponse, - options?: CreateHttpPollerOptions>, -): Promise, TResult>>; -export async function getLongRunningPoller< - TResult extends - | PrivateEndpointConnectionsCreateLogicalResponse - | PrivateEndpointConnectionsCreateDefaultResponse, ->( - client: Client, - initialResponse: - | PrivateEndpointConnectionsCreate200Response - | PrivateEndpointConnectionsCreate201Response - | PrivateEndpointConnectionsCreateDefaultResponse, - options?: CreateHttpPollerOptions>, -): Promise, TResult>>; -export async function getLongRunningPoller< - TResult extends - | PrivateEndpointConnectionsDeleteLogicalResponse - | PrivateEndpointConnectionsDeleteDefaultResponse, ->( - client: Client, - initialResponse: - | PrivateEndpointConnectionsDelete202Response - | PrivateEndpointConnectionsDelete204Response - | PrivateEndpointConnectionsDeleteDefaultResponse, - options?: CreateHttpPollerOptions>, -): Promise, TResult>>; -export async function getLongRunningPoller( - client: Client, - initialResponse: TResult, - options: CreateHttpPollerOptions> = {}, -): Promise, TResult>> { - const abortController = new AbortController(); - const poller: RunningOperation = { - sendInitialRequest: async () => { - // In the case of Rest Clients we are building the LRO poller object from a response that's the reason - // we are not triggering the initial request here, just extracting the information from the - // response we were provided. - return getLroResponse(initialResponse); - }, - sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => { - // This is the callback that is going to be called to poll the service - // to get the latest status. We use the client provided and the polling path - // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location - // depending on the lro pattern that the service implements. If non is provided we default to the initial path. - function abortListener(): void { - abortController.abort(); - } - const inputAbortSignal = pollOptions?.abortSignal; - const abortSignal = abortController.signal; - if (inputAbortSignal?.aborted) { - abortController.abort(); - } else if (!abortSignal.aborted) { - inputAbortSignal?.addEventListener("abort", abortListener, { - once: true, - }); - } - let response; - try { - response = await client - .pathUnchecked(path ?? initialResponse.request.url) - .get({ abortSignal }); - } finally { - inputAbortSignal?.removeEventListener("abort", abortListener); - } - const lroResponse = getLroResponse(response as TResult); - lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url; - return lroResponse; - }, - }; - - options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true; - const httpPoller = createHttpPoller(poller, options); - const simplePoller: SimplePollerLike, TResult> = { - isDone() { - return httpPoller.isDone; - }, - isStopped() { - return abortController.signal.aborted; - }, - getOperationState() { - if (!httpPoller.operationState) { - throw new Error( - "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", - ); - } - return httpPoller.operationState; - }, - getResult() { - return httpPoller.result; - }, - toString() { - if (!httpPoller.operationState) { - throw new Error( - "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", - ); - } - return JSON.stringify({ - state: httpPoller.operationState, - }); - }, - stopPolling() { - abortController.abort(); - }, - onProgress: httpPoller.onProgress, - poll: httpPoller.poll, - pollUntilDone: httpPoller.pollUntilDone, - serialize: httpPoller.serialize, - submitted: httpPoller.submitted, - }; - return simplePoller; -} - -/** - * Converts a Rest Client response to a response that the LRO implementation understands - * @param response - a rest client http response - * @returns - An LRO response that the LRO implementation understands - */ -function getLroResponse( - response: TResult, -): OperationResponse { - if (Number.isNaN(response.status)) { - throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`); - } - - return { - flatResponse: response, - rawResponse: { - ...response, - statusCode: Number.parseInt(response.status), - body: response.body, - }, - }; -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/responses.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/responses.ts deleted file mode 100644 index 52285ea0594c..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/rest/responses.ts +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse } from "@azure-rest/core-client"; -import { - OperationListResultOutput, - ErrorResponseOutput, - DeidServiceOutput, - DeidServiceListResultOutput, - PrivateEndpointConnectionResourceOutput, - PrivateEndpointConnectionResourceListResultOutput, - PrivateLinkResourceListResultOutput, -} from "./outputModels.js"; - -/** Azure operation completed successfully. */ -export interface OperationsList200Response extends HttpResponse { - status: "200"; - body: OperationListResultOutput; -} - -export interface OperationsListDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** Azure operation completed successfully. */ -export interface DeidServicesGet200Response extends HttpResponse { - status: "200"; - body: DeidServiceOutput; -} - -export interface DeidServicesGetDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** Azure operation completed successfully. */ -export interface DeidServicesListByResourceGroup200Response extends HttpResponse { - status: "200"; - body: DeidServiceListResultOutput; -} - -export interface DeidServicesListByResourceGroupDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** Azure operation completed successfully. */ -export interface DeidServicesListBySubscription200Response extends HttpResponse { - status: "200"; - body: DeidServiceListResultOutput; -} - -export interface DeidServicesListBySubscriptionDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** Resource 'DeidService' update operation succeeded */ -export interface DeidServicesCreate200Response extends HttpResponse { - status: "200"; - body: DeidServiceOutput; -} - -export interface DeidServicesCreate201Headers { - /** A link to the status monitor */ - "azure-asyncoperation"?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - "retry-after"?: number; -} - -/** Resource 'DeidService' create operation succeeded */ -export interface DeidServicesCreate201Response extends HttpResponse { - status: "201"; - body: DeidServiceOutput; - headers: RawHttpHeaders & DeidServicesCreate201Headers; -} - -export interface DeidServicesCreateDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** The final response for long-running create operation */ -export interface DeidServicesCreateLogicalResponse extends HttpResponse { - status: "200"; - body: DeidServiceOutput; -} - -/** Azure operation completed successfully. */ -export interface DeidServicesUpdate200Response extends HttpResponse { - status: "200"; - body: DeidServiceOutput; -} - -export interface DeidServicesUpdate202Headers { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - "retry-after"?: number; -} - -/** Resource update request accepted. */ -export interface DeidServicesUpdate202Response extends HttpResponse { - status: "202"; - headers: RawHttpHeaders & DeidServicesUpdate202Headers; -} - -export interface DeidServicesUpdateDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** The final response for long-running update operation */ -export interface DeidServicesUpdateLogicalResponse extends HttpResponse { - status: "200"; - body: DeidServiceOutput; -} - -export interface DeidServicesDelete202Headers { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - "retry-after"?: number; -} - -/** Resource deletion accepted. */ -export interface DeidServicesDelete202Response extends HttpResponse { - status: "202"; - headers: RawHttpHeaders & DeidServicesDelete202Headers; -} - -/** Resource does not exist. */ -export interface DeidServicesDelete204Response extends HttpResponse { - status: "204"; -} - -export interface DeidServicesDeleteDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** The final response for long-running delete operation */ -export interface DeidServicesDeleteLogicalResponse extends HttpResponse { - status: "200"; -} - -/** Azure operation completed successfully. */ -export interface PrivateEndpointConnectionsGet200Response extends HttpResponse { - status: "200"; - body: PrivateEndpointConnectionResourceOutput; -} - -export interface PrivateEndpointConnectionsGetDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** Resource 'PrivateEndpointConnectionResource' update operation succeeded */ -export interface PrivateEndpointConnectionsCreate200Response extends HttpResponse { - status: "200"; - body: PrivateEndpointConnectionResourceOutput; -} - -export interface PrivateEndpointConnectionsCreate201Headers { - /** A link to the status monitor */ - "azure-asyncoperation"?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - "retry-after"?: number; -} - -/** Resource 'PrivateEndpointConnectionResource' create operation succeeded */ -export interface PrivateEndpointConnectionsCreate201Response extends HttpResponse { - status: "201"; - body: PrivateEndpointConnectionResourceOutput; - headers: RawHttpHeaders & PrivateEndpointConnectionsCreate201Headers; -} - -export interface PrivateEndpointConnectionsCreateDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** The final response for long-running create operation */ -export interface PrivateEndpointConnectionsCreateLogicalResponse extends HttpResponse { - status: "200"; - body: PrivateEndpointConnectionResourceOutput; -} - -export interface PrivateEndpointConnectionsDelete202Headers { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - "retry-after"?: number; -} - -/** Resource deletion accepted. */ -export interface PrivateEndpointConnectionsDelete202Response extends HttpResponse { - status: "202"; - headers: RawHttpHeaders & PrivateEndpointConnectionsDelete202Headers; -} - -/** Resource does not exist. */ -export interface PrivateEndpointConnectionsDelete204Response extends HttpResponse { - status: "204"; -} - -export interface PrivateEndpointConnectionsDeleteDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** The final response for long-running delete operation */ -export interface PrivateEndpointConnectionsDeleteLogicalResponse extends HttpResponse { - status: "200"; -} - -/** Azure operation completed successfully. */ -export interface PrivateEndpointConnectionsListByDeidService200Response extends HttpResponse { - status: "200"; - body: PrivateEndpointConnectionResourceListResultOutput; -} - -export interface PrivateEndpointConnectionsListByDeidServiceDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} - -/** Azure operation completed successfully. */ -export interface PrivateLinksListByDeidService200Response extends HttpResponse { - status: "200"; - body: PrivateLinkResourceListResultOutput; -} - -export interface PrivateLinksListByDeidServiceDefaultResponse extends HttpResponse { - status: string; - body: ErrorResponseOutput; -} diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/restorePollerHelpers.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/restorePollerHelpers.ts index 7ad41df7ab1f..602f015e529e 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/restorePollerHelpers.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/restorePollerHelpers.ts @@ -1,14 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - PollerLike, - OperationState, - deserializeState, - ResourceLocationConfig, -} from "@azure/core-lro"; import { HealthDataAIServicesClient } from "./healthDataAIServicesClient.js"; -import { getLongRunningPoller } from "./api/pollingHelpers.js"; import { _deidServicesCreateDeserialize, _deidServicesUpdateDeserialize, @@ -18,8 +11,18 @@ import { _privateEndpointConnectionsCreateDeserialize, _privateEndpointConnectionsDeleteDeserialize, } from "./api/privateEndpointConnections/index.js"; -import { PathUncheckedResponse, OperationOptions } from "@azure-rest/core-client"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { + OperationOptions, + PathUncheckedResponse, +} from "@azure-rest/core-client"; import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; export interface RestorePollerOptions< TResult, @@ -43,7 +46,9 @@ export interface RestorePollerOptions< export function restorePoller( client: HealthDataAIServicesClient, serializedState: string, - sourceOperation: (...args: any[]) => PollerLike, TResult>, + sourceOperation: ( + ...args: any[] + ) => PollerLike, TResult>, options?: RestorePollerOptions, ): PollerLike, TResult> { const pollerConfig = deserializeState(serializedState).config; @@ -56,8 +61,9 @@ export function restorePoller( const resourceLocationConfig = metadata?.["resourceLocationConfig"] as | ResourceLocationConfig | undefined; - const deserializeHelper = - options?.processResponseBody ?? getDeserializationHelper(initialRequestUrl, requestMethod); + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; if (!deserializeHelper) { throw new Error( `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, @@ -66,6 +72,7 @@ export function restorePoller( return getLongRunningPoller( (client as any)["_client"] ?? client, deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, { updateIntervalInMs: options?.updateIntervalInMs, abortSignal: options?.abortSignal, @@ -76,23 +83,43 @@ export function restorePoller( ); } -const deserializeMap: Record = { +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - _deidServicesCreateDeserialize, + { + deserializer: _deidServicesCreateDeserialize, + expectedStatuses: ["200", "201"], + }, "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - _deidServicesUpdateDeserialize, + { + deserializer: _deidServicesUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}": - _deidServicesDeleteDeserialize, + { + deserializer: _deidServicesDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}": - _privateEndpointConnectionsCreateDeserialize, + { + deserializer: _privateEndpointConnectionsCreateDeserialize, + expectedStatuses: ["200", "201"], + }, "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthDataAIServices/deidServices/{deidServiceName}/privateEndpointConnections/{privateEndpointConnectionName}": - _privateEndpointConnectionsDeleteDeserialize, + { + deserializer: _privateEndpointConnectionsDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, }; function getDeserializationHelper( urlStr: string, method: string, -): ((result: unknown) => Promise) | undefined { +): DeserializationHelper | undefined { const path = new URL(urlStr).pathname; const pathParts = path.split("/"); @@ -100,7 +127,7 @@ function getDeserializationHelper( // matchedLen: the length of candidate path // matchedValue: the matched status code array let matchedLen = -1, - matchedValue: ((result: unknown) => Promise) | undefined; + matchedValue: DeserializationHelper | undefined; // Iterate the responseMap to find a match for (const [key, value] of Object.entries(deserializeMap)) { @@ -115,17 +142,24 @@ function getDeserializationHelper( // track if we have found a match to return the values found. let found = true; - for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { - if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + for ( + let i = candidateParts.length - 1, j = pathParts.length - 1; + i >= 1 && j >= 1; + i--, j-- + ) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.indexOf("}") !== -1 + ) { const start = candidateParts[i]!.indexOf("}") + 1, end = candidateParts[i]?.length; // If the current part of the candidate is a "template" part // Try to use the suffix of pattern to match the path // {guid} ==> $ // {guid}:export ==> :export$ - const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( - pathParts[j] || "", - ); + const isMatched = new RegExp( + `${candidateParts[i]?.slice(start, end)}`, + ).test(pathParts[j] || ""); if (!isMatched) { found = false; @@ -147,7 +181,7 @@ function getDeserializationHelper( // Update the matched value if and only if we found the longer pattern if (found && candidatePath.length > matchedLen) { matchedLen = candidatePath.length; - matchedValue = value as (result: unknown) => Promise; + matchedValue = value; } } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/pagingHelpers.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/static-helpers/pagingHelpers.ts similarity index 61% rename from sdk/healthdataaiservices/arm-healthdataaiservices/src/api/pagingHelpers.ts rename to sdk/healthdataaiservices/arm-healthdataaiservices/src/static-helpers/pagingHelpers.ts index 5342e57b798f..dc35b0af242d 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/pagingHelpers.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/static-helpers/pagingHelpers.ts @@ -1,16 +1,102 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; -import { RestError } from "@azure/core-rest-pipeline"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { - BuildPagedAsyncIteratorOptions, - ContinuablePage, - PageSettings, - PagedAsyncIterableIterator, - PagedResult, -} from "../models/pagingTypes.js"; -import { isUnexpected } from "../rest/index.js"; + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: ( + pageLink?: string, + ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} /** * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator @@ -24,6 +110,7 @@ export function buildPagedAsyncIterator< client: Client, getInitialResponse: () => PromiseLike, processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], options: BuildPagedAsyncIteratorOptions = {}, ): PagedAsyncIterableIterator { const itemName = options.itemName ?? "value"; @@ -34,7 +121,7 @@ export function buildPagedAsyncIterator< pageLink === undefined ? await getInitialResponse() : await client.pathUnchecked(pageLink).get(); - checkPagingRequest(result); + checkPagingRequest(result, expectedStatuses); const results = await processResponseBody(result as TResponse); const nextLink = getNextLink(results, nextLinkName); const values = getElements(results, itemName) as TPage; @@ -68,7 +155,9 @@ function getPagedAsyncIterator< >( pagedResult: PagedResult, ): PagedAsyncIterableIterator { - const iter = getItemAsyncIterator(pagedResult); + const iter = getItemAsyncIterator( + pagedResult, + ); return { next() { return iter.next(); @@ -87,7 +176,11 @@ function getPagedAsyncIterator< }; } -async function* getItemAsyncIterator( +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( pagedResult: PagedResult, ): AsyncIterableIterator { const pages = getPageAsyncIterator(pagedResult); @@ -96,14 +189,20 @@ async function* getItemAsyncIterator( +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( pagedResult: PagedResult, options: { pageLink?: string; } = {}, ): AsyncIterableIterator> { const { pageLink } = options; - let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); if (!response) { return; } @@ -131,7 +230,11 @@ function getNextLink(body: unknown, nextLinkName?: string): string | undefined { const nextLink = (body as Record)[nextLinkName]; - if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + if ( + typeof nextLink !== "string" && + typeof nextLink !== "undefined" && + nextLink !== null + ) { throw new RestError( `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, ); @@ -161,8 +264,11 @@ function getElements(body: unknown, itemName: string): T[] { /** * Checks if a request failed */ -function checkPagingRequest(response: PathUncheckedResponse): void { - if (isUnexpected(response)) { +function checkPagingRequest( + response: PathUncheckedResponse, + expectedStatuses: string[], +): void { + if (!expectedStatuses.includes(response.status)) { throw createRestError( `Pagination failed with unexpected statusCode ${response.status}`, response, diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/pollingHelpers.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/src/static-helpers/pollingHelpers.ts similarity index 83% rename from sdk/healthdataaiservices/arm-healthdataaiservices/src/api/pollingHelpers.ts rename to sdk/healthdataaiservices/arm-healthdataaiservices/src/static-helpers/pollingHelpers.ts index bfbeffa13669..87a63b1fc5d1 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/src/api/pollingHelpers.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/src/static-helpers/pollingHelpers.ts @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + import { PollerLike, OperationState, @@ -10,9 +13,12 @@ import { OperationResponse, } from "@azure/core-lro"; -import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@azure-rest/core-client"; import { AbortSignalLike } from "@azure/abort-controller"; -import { isUnexpected } from "../rest/index.js"; export interface GetLongRunningPollerOptions { /** Delay to wait until next poll, in milliseconds. */ @@ -39,24 +45,32 @@ export interface GetLongRunningPollerOptions { */ getInitialResponse?: () => PromiseLike; } -export function getLongRunningPoller( +export function getLongRunningPoller< + TResponse extends PathUncheckedResponse, + TResult = void, +>( client: Client, processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], options: GetLongRunningPollerOptions, ): PollerLike, TResult> { const { restoreFrom, getInitialResponse } = options; if (!restoreFrom && !getInitialResponse) { - throw new Error("Either restoreFrom or getInitialResponse must be specified"); + throw new Error( + "Either restoreFrom or getInitialResponse must be specified", + ); } let initialResponse: TResponse | undefined = undefined; const pollAbortController = new AbortController(); const poller: RunningOperation = { sendInitialRequest: async () => { if (!getInitialResponse) { - throw new Error("getInitialResponse is required when initializing a new poller"); + throw new Error( + "getInitialResponse is required when initializing a new poller", + ); } initialResponse = await getInitialResponse(); - return getLroResponse(initialResponse); + return getLroResponse(initialResponse, expectedStatuses); }, sendPollRequest: async ( path: string, @@ -88,12 +102,8 @@ export function getLongRunningPoller( response: TResponse, + expectedStatuses: string[], ): OperationResponse { - if (isUnexpected(response as PathUncheckedResponse)) { + if (!expectedStatuses.includes(response.status)) { throw createRestError(response); } + return { flatResponse: response, rawResponse: { diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/healthdataaiservices_operations_test.spec.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/healthdataaiservices_operations_test.spec.ts deleted file mode 100644 index b357852744fc..000000000000 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/healthdataaiservices_operations_test.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { env, Recorder, isPlaybackMode, delay } from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; -import { createRecorder } from "./utils/recordedClient.js"; -import { HealthDataAIServicesClient } from "../../src/healthDataAIServicesClient.js"; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("HealthDataAIServices test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: HealthDataAIServicesClient; - let location: string; - let resourceGroup: string; - let resourcename: string; - - beforeEach(async (context) => { - process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows"; - recorder = await createRecorder(context); - subscriptionId = env.SUBSCRIPTION_ID || ""; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new HealthDataAIServicesClient( - credential, - subscriptionId, - recorder.configureClientOptions({}), - ); - location = "eastus"; - resourceGroup = "myjstest"; - resourcename = "resourcetest"; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("operation list test", async function () { - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - assert.notEqual(resArray.length, 0); - }); -}); diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/sampleTest.spec.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..d4919ac91ac5 --- /dev/null +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/sampleTest.spec.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createRecorder } from "./utils/recordedClient.js"; +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async function () { + // recorder = await createRecorder(this); + }); + + afterEach(async function () { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/utils/recordedClient.ts b/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/utils/recordedClient.ts index 527ccc9dee86..6e425fdcfdf9 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/utils/recordedClient.ts +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/test/public/utils/recordedClient.ts @@ -1,7 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; +import { + Recorder, + RecorderStartOptions, + VitestTestContext, +} from "@azure-tools/test-recorder"; const replaceableVariables: Record = { SUBSCRIPTION_ID: "azure_subscription_id", @@ -9,10 +13,6 @@ const replaceableVariables: Record = { const recorderEnvSetup: RecorderStartOptions = { envSetupForPlayback: replaceableVariables, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], }; /** @@ -20,7 +20,9 @@ const recorderEnvSetup: RecorderStartOptions = { * Should be called first in the test suite to make sure environment variables are * read before they are being used. */ -export async function createRecorder(context: VitestTestContext): Promise { +export async function createRecorder( + context: VitestTestContext, +): Promise { const recorder = new Recorder(context); await recorder.start(recorderEnvSetup); return recorder; diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/tsconfig.json b/sdk/healthdataaiservices/arm-healthdataaiservices/tsconfig.json index a10f22a54c88..8c962911295c 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/tsconfig.json +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/tsconfig.json @@ -3,7 +3,14 @@ "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext", - "rootDir": "." + "rootDir": ".", + "skipLibCheck": true }, - "include": ["./src/**/*.ts", "./src/**/*.mts", "./src/**/*.cts", "test/**/*.ts", "./test/**/*.ts"] + "include": [ + "./src/**/*.ts", + "./src/**/*.mts", + "./src/**/*.cts", + "test/**/*.ts", + "./test/**/*.ts" + ] } diff --git a/sdk/healthdataaiservices/arm-healthdataaiservices/tsp-location.yaml b/sdk/healthdataaiservices/arm-healthdataaiservices/tsp-location.yaml index b62beaef0692..09e43c9c202a 100644 --- a/sdk/healthdataaiservices/arm-healthdataaiservices/tsp-location.yaml +++ b/sdk/healthdataaiservices/arm-healthdataaiservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/healthdataaiservices/HealthDataAIServices.Management -commit: c37a507e520767c5bafde6d8fbf9aabef6316fdb +commit: 65171caa921a67914855465095f912fb17445d7e repo: ../azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/healthdataaiservices/ci.mgmt.yml b/sdk/healthdataaiservices/ci.mgmt.yml index f12fd43d2f24..a09619075b90 100644 --- a/sdk/healthdataaiservices/ci.mgmt.yml +++ b/sdk/healthdataaiservices/ci.mgmt.yml @@ -6,6 +6,8 @@ trigger: - main - release/* - hotfix/* + exclude: + - feature/v4 paths: include: - sdk/healthdataaiservices/ci.mgmt.yml