diff --git a/sdk/fabric/arm-fabric/CHANGELOG.md b/sdk/fabric/arm-fabric/CHANGELOG.md deleted file mode 100644 index 1dec6e70dc7c..000000000000 --- a/sdk/fabric/arm-fabric/CHANGELOG.md +++ /dev/null @@ -1,17 +0,0 @@ -# Release History - -## 1.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.0.0 (2024-10-14) - -### Features Added - -This is the first stable version with the package of @azure/arm-fabric diff --git a/sdk/fabric/arm-fabric/LICENSE b/sdk/fabric/arm-fabric/LICENSE deleted file mode 100644 index 7d5934740965..000000000000 --- a/sdk/fabric/arm-fabric/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2024 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/sdk/fabric/arm-fabric/README.md b/sdk/fabric/arm-fabric/README.md deleted file mode 100644 index 2afa0caf7d37..000000000000 --- a/sdk/fabric/arm-fabric/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# Azure Fabric client library for JavaScript - -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Fabric client. - - - -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-fabric) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview) | - -## Getting started - -### Currently supported environments - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge and Firefox. - -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. - -### Prerequisites - -- An [Azure subscription][azure_sub]. - -### Install the `@azure/arm-fabric` package - -Install the Azure Fabric client library for JavaScript with `npm`: - -```bash -npm install @azure/arm-fabric -``` - -### Create and authenticate a `FabricClient` - -To create a client object to access the Azure Fabric API, you will need the `endpoint` of your Azure Fabric resource and a `credential`. The Azure Fabric client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure Fabric resource in the [Azure Portal][azure_portal]. - -You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). - -To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: - -```bash -npm install @azure/identity -``` - -You will also need to **register a new AAD application and grant access to Azure Fabric** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). -Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. - -For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). - -```javascript -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); -// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. - -const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new FabricClient(new DefaultAzureCredential(), subscriptionId); - -// For client-side applications running in the browser, use this code instead: -// const credential = new InteractiveBrowserCredential({ -// tenantId: "", -// clientId: "" -// }); -// const client = new FabricClient(credential, subscriptionId); -``` - - -### JavaScript Bundle -To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). - -## Key concepts - -### FabricClient - -`FabricClient` is the primary interface for developers using the Azure Fabric client library. Explore the methods on this client object to understand the different features of the Azure Fabric service that you can access. - -## Troubleshooting - -### Logging - -Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: - -```javascript -const { setLogLevel } = require("@azure/logger"); -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. - -## Related projects - -- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -[azure_sub]: https://azure.microsoft.com/free/ -[azure_portal]: https://portal.azure.com -[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity -[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/fabric/arm-fabric/api-extractor.json b/sdk/fabric/arm-fabric/api-extractor.json deleted file mode 100644 index 23b0d14b38ef..000000000000 --- a/sdk/fabric/arm-fabric/api-extractor.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist/esm/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/arm-fabric.d.ts" - }, - "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, - "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } - } - } -} diff --git a/sdk/fabric/arm-fabric/assets.json b/sdk/fabric/arm-fabric/assets.json deleted file mode 100644 index 28da7b6f94c5..000000000000 --- a/sdk/fabric/arm-fabric/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/fabric/arm-fabric", - "Tag": "js/fabric/arm-fabric_57008420a9" -} diff --git a/sdk/fabric/arm-fabric/package.json b/sdk/fabric/arm-fabric/package.json deleted file mode 100644 index 808b9768105e..000000000000 --- a/sdk/fabric/arm-fabric/package.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "name": "@azure/arm-fabric", - "version": "1.0.1", - "description": "A generated SDK for FabricClient.", - "engines": { - "node": ">=18.0.0" - }, - "sideEffects": false, - "autoPublish": false, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts", - "./models": "./src/models/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false, - "project": "./tsconfig.src.json" - }, - "type": "module", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "files": [ - "dist", - "README.md", - "LICENSE", - "review/*", - "CHANGELOG.md" - ], - "sdk-type": "mgmt", - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", - "//metadata": { - "constantPaths": [ - { - "path": "src/api/fabricContext.ts", - "prefix": "userAgentInfo" - } - ] - }, - "dependencies": { - "@azure/core-util": "^1.9.2", - "@azure-rest/core-client": "^2.1.0", - "@azure/core-auth": "^1.6.0", - "@azure/core-rest-pipeline": "^1.5.0", - "@azure/logger": "^1.0.0", - "tslib": "^2.6.2", - "@azure/core-lro": "^3.0.0", - "@azure/abort-controller": "^2.1.2" - }, - "devDependencies": { - "dotenv": "^16.0.0", - "@types/node": "^18.0.0", - "eslint": "^9.9.0", - "prettier": "^3.2.5", - "typescript": "~5.6.2", - "@azure/identity": "^4.2.1", - "@vitest/browser": "^2.0.5", - "@vitest/coverage-istanbul": "^2.0.5", - "playwright": "^1.41.2", - "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": { - "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", - "pack": "npm pack 2>&1", - "lint": "echo skipped", - "lint:fix": "echo skipped", - "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", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", - "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", - "check-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}\" \"samples-dev/*.ts\"", - "execute:samples": "dev-tool samples run samples-dev", - "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": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", - "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", - "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", - "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", - "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" - }, - "//sampleConfiguration": { - "productName": "@azure/arm-fabric", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./models": { - "browser": { - "types": "./dist/browser/models/index.d.ts", - "default": "./dist/browser/models/index.js" - }, - "react-native": { - "types": "./dist/react-native/models/index.d.ts", - "default": "./dist/react-native/models/index.js" - }, - "import": { - "types": "./dist/esm/models/index.d.ts", - "default": "./dist/esm/models/index.js" - }, - "require": { - "types": "./dist/commonjs/models/index.d.ts", - "default": "./dist/commonjs/models/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "module": "./dist/esm/index.js" -} diff --git a/sdk/fabric/arm-fabric/review/arm-fabric-models.api.md b/sdk/fabric/arm-fabric/review/arm-fabric-models.api.md deleted file mode 100644 index 9169af8434e9..000000000000 --- a/sdk/fabric/arm-fabric/review/arm-fabric-models.api.md +++ /dev/null @@ -1,190 +0,0 @@ -## API Report File for "@azure/arm-fabric" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -// @public -export type ActionType = string; - -// @public -export interface CapacityAdministration { - members: string[]; -} - -// @public -export type CheckNameAvailabilityReason = string; - -// @public -export interface CheckNameAvailabilityRequest { - name?: string; - type?: string; -} - -// @public -export interface CheckNameAvailabilityResponse { - message?: string; - nameAvailable?: boolean; - reason?: CheckNameAvailabilityReason; -} - -// @public -export type CreatedByType = string; - -// @public -export interface FabricCapacity extends TrackedResource { - properties: FabricCapacityProperties; - sku: RpSku; -} - -// @public -export interface FabricCapacityProperties { - administration: CapacityAdministration; - readonly provisioningState?: ProvisioningState; - readonly state?: ResourceState; -} - -// @public -export interface FabricCapacityUpdate { - properties?: FabricCapacityUpdateProperties; - sku?: RpSku; - tags?: Record; -} - -// @public -export interface FabricCapacityUpdateProperties { - administration?: CapacityAdministration; -} - -// @public -export enum KnownActionType { - Internal = "Internal" -} - -// @public -export enum KnownCheckNameAvailabilityReason { - AlreadyExists = "AlreadyExists", - Invalid = "Invalid" -} - -// @public -export enum KnownCreatedByType { - Application = "Application", - Key = "Key", - ManagedIdentity = "ManagedIdentity", - User = "User" -} - -// @public -export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" -} - -// @public -export enum KnownProvisioningState { - Canceled = "Canceled", - Deleting = "Deleting", - Failed = "Failed", - Provisioning = "Provisioning", - Succeeded = "Succeeded", - Updating = "Updating" -} - -// @public -export enum KnownResourceState { - Active = "Active", - Deleting = "Deleting", - Failed = "Failed", - Paused = "Paused", - Pausing = "Pausing", - Preparing = "Preparing", - Provisioning = "Provisioning", - Resuming = "Resuming", - Scaling = "Scaling", - Suspended = "Suspended", - Suspending = "Suspending", - Updating = "Updating" -} - -// @public -export enum KnownRpSkuTier { - Fabric = "Fabric" -} - -// @public -export interface Operation { - actionType?: ActionType; - readonly display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; -} - -// @public -export interface OperationDisplay { - readonly description?: string; - readonly operation?: string; - readonly provider?: string; - readonly resource?: string; -} - -// @public -export type Origin = string; - -// @public -export type ProvisioningState = string; - -// @public -export interface Resource { - readonly id?: string; - readonly name?: string; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export type ResourceState = string; - -// @public -export interface RpSku { - name: string; - tier: RpSkuTier; -} - -// @public -export interface RpSkuDetailsForExistingResource { - resourceType: string; - sku: RpSku; -} - -// @public -export interface RpSkuDetailsForNewResource { - locations: string[]; - name: string; - resourceType: string; -} - -// @public -export type RpSkuTier = string; - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export interface TrackedResource extends Resource { - location: string; - tags?: Record; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/fabric/arm-fabric/review/arm-fabric.api.md b/sdk/fabric/arm-fabric/review/arm-fabric.api.md deleted file mode 100644 index 430114ce3bf6..000000000000 --- a/sdk/fabric/arm-fabric/review/arm-fabric.api.md +++ /dev/null @@ -1,312 +0,0 @@ -## API Report File for "@azure/arm-fabric" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { AbortSignalLike } from '@azure/abort-controller'; -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { PollerLike } from '@azure/core-lro'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export type ActionType = string; - -// @public -export interface CapacityAdministration { - members: string[]; -} - -// @public -export type CheckNameAvailabilityReason = string; - -// @public -export interface CheckNameAvailabilityRequest { - name?: string; - type?: string; -} - -// @public -export interface CheckNameAvailabilityResponse { - message?: string; - nameAvailable?: boolean; - reason?: CheckNameAvailabilityReason; -} - -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - -// @public -export type CreatedByType = string; - -// @public -export interface FabricCapacitiesCheckNameAvailabilityOptionalParams extends OperationOptions { -} - -// @public -export interface FabricCapacitiesCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FabricCapacitiesDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FabricCapacitiesGetOptionalParams extends OperationOptions { -} - -// @public -export interface FabricCapacitiesListByResourceGroupOptionalParams extends OperationOptions { -} - -// @public -export interface FabricCapacitiesListBySubscriptionOptionalParams extends OperationOptions { -} - -// @public -export interface FabricCapacitiesListSkusForCapacityOptionalParams extends OperationOptions { -} - -// @public -export interface FabricCapacitiesListSkusOptionalParams extends OperationOptions { -} - -// @public -export interface FabricCapacitiesOperations { - checkNameAvailability: (location: string, body: CheckNameAvailabilityRequest, options?: FabricCapacitiesCheckNameAvailabilityOptionalParams) => Promise; - createOrUpdate: (resourceGroupName: string, capacityName: string, resource: FabricCapacity, options?: FabricCapacitiesCreateOrUpdateOptionalParams) => PollerLike, FabricCapacity>; - delete: (resourceGroupName: string, capacityName: string, options?: FabricCapacitiesDeleteOptionalParams) => PollerLike, void>; - get: (resourceGroupName: string, capacityName: string, options?: FabricCapacitiesGetOptionalParams) => Promise; - listByResourceGroup: (resourceGroupName: string, options?: FabricCapacitiesListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; - listBySubscription: (options?: FabricCapacitiesListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; - listSkus: (options?: FabricCapacitiesListSkusOptionalParams) => PagedAsyncIterableIterator; - listSkusForCapacity: (resourceGroupName: string, capacityName: string, options?: FabricCapacitiesListSkusForCapacityOptionalParams) => PagedAsyncIterableIterator; - resume: (resourceGroupName: string, capacityName: string, options?: FabricCapacitiesResumeOptionalParams) => PollerLike, void>; - suspend: (resourceGroupName: string, capacityName: string, options?: FabricCapacitiesSuspendOptionalParams) => PollerLike, void>; - update: (resourceGroupName: string, capacityName: string, properties: FabricCapacityUpdate, options?: FabricCapacitiesUpdateOptionalParams) => PollerLike, FabricCapacity>; -} - -// @public -export interface FabricCapacitiesResumeOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FabricCapacitiesSuspendOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FabricCapacitiesUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FabricCapacity extends TrackedResource { - properties: FabricCapacityProperties; - sku: RpSku; -} - -// @public -export interface FabricCapacityProperties { - administration: CapacityAdministration; - readonly provisioningState?: ProvisioningState; - readonly state?: ResourceState; -} - -// @public -export interface FabricCapacityUpdate { - properties?: FabricCapacityUpdateProperties; - sku?: RpSku; - tags?: Record; -} - -// @public -export interface FabricCapacityUpdateProperties { - administration?: CapacityAdministration; -} - -// @public (undocumented) -export class FabricClient { - constructor(credential: TokenCredential, subscriptionId: string, options?: FabricClientOptionalParams); - readonly fabricCapacities: FabricCapacitiesOperations; - readonly operations: OperationsOperations; - readonly pipeline: Pipeline; -} - -// @public -export interface FabricClientOptionalParams extends ClientOptions { - apiVersion?: string; -} - -// @public -export enum KnownActionType { - Internal = "Internal" -} - -// @public -export enum KnownCheckNameAvailabilityReason { - AlreadyExists = "AlreadyExists", - Invalid = "Invalid" -} - -// @public -export enum KnownCreatedByType { - Application = "Application", - Key = "Key", - ManagedIdentity = "ManagedIdentity", - User = "User" -} - -// @public -export enum KnownOrigin { - System = "system", - User = "user", - UserSystem = "user,system" -} - -// @public -export enum KnownProvisioningState { - Canceled = "Canceled", - Deleting = "Deleting", - Failed = "Failed", - Provisioning = "Provisioning", - Succeeded = "Succeeded", - Updating = "Updating" -} - -// @public -export enum KnownResourceState { - Active = "Active", - Deleting = "Deleting", - Failed = "Failed", - Paused = "Paused", - Pausing = "Pausing", - Preparing = "Preparing", - Provisioning = "Provisioning", - Resuming = "Resuming", - Scaling = "Scaling", - Suspended = "Suspended", - Suspending = "Suspending", - Updating = "Updating" -} - -// @public -export enum KnownRpSkuTier { - Fabric = "Fabric" -} - -// @public -export interface Operation { - actionType?: ActionType; - readonly display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; -} - -// @public -export interface OperationDisplay { - readonly description?: string; - readonly operation?: string; - readonly provider?: string; - readonly resource?: string; -} - -// @public -export interface OperationsListOptionalParams extends OperationOptions { -} - -// @public -export interface OperationsOperations { - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; -} - -// @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 type ProvisioningState = string; - -// @public -export interface Resource { - readonly id?: string; - readonly name?: string; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export type ResourceState = string; - -// @public -export function restorePoller(client: FabricClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; - -// @public (undocumented) -export interface RestorePollerOptions extends OperationOptions { - abortSignal?: AbortSignalLike; - processResponseBody?: (result: TResponse) => Promise; - updateIntervalInMs?: number; -} - -// @public -export interface RpSku { - name: string; - tier: RpSkuTier; -} - -// @public -export interface RpSkuDetailsForExistingResource { - resourceType: string; - sku: RpSku; -} - -// @public -export interface RpSkuDetailsForNewResource { - locations: string[]; - name: string; - resourceType: string; -} - -// @public -export type RpSkuTier = string; - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export interface TrackedResource extends Resource { - location: string; - tags?: Record; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/fabric/arm-fabric/sample.env b/sdk/fabric/arm-fabric/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/fabric/arm-fabric/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesCheckNameAvailabilitySample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesCheckNameAvailabilitySample.ts deleted file mode 100644 index 6d0c6e3d84bd..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to implements local CheckNameAvailability operations - * - * @summary implements local CheckNameAvailability operations - * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json - */ -async function checkNameAvailabilityOfACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.checkNameAvailability( - "westcentralus", - { name: "azsdktest", type: "Microsoft.Fabric/capacities" }, - ); - console.log(result); -} - -async function main() { - checkNameAvailabilityOfACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesCreateOrUpdateSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesCreateOrUpdateSample.ts deleted file mode 100644 index 5c0bdb2782b4..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesCreateOrUpdateSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a FabricCapacity - * - * @summary create a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json - */ -async function createOrUpdateACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.createOrUpdate( - "TestRG", - "azsdktest", - { - properties: { - administration: { - members: ["azsdktest@microsoft.com", "azsdktest2@microsoft.com"], - }, - }, - sku: { name: "F2", tier: "Fabric" }, - location: "westcentralus", - }, - ); - console.log(result); -} - -async function main() { - createOrUpdateACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesDeleteSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesDeleteSample.ts deleted file mode 100644 index edc998780566..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesDeleteSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a FabricCapacity - * - * @summary delete a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json - */ -async function deleteACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.delete("TestRG", "azsdktest"); -} - -async function main() { - deleteACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesGetSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesGetSample.ts deleted file mode 100644 index ed8948e384b6..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a FabricCapacity - * - * @summary get a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json - */ -async function getACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.get("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - getACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListByResourceGroupSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListByResourceGroupSample.ts deleted file mode 100644 index 08892bd95c26..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListByResourceGroupSample.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list FabricCapacity resources by resource group - * - * @summary list FabricCapacity resources by resource group - * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json - */ -async function listCapacitiesByResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listByResourceGroup( - "TestRG", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListBySubscriptionSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListBySubscriptionSample.ts deleted file mode 100644 index 9951f51ba60a..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListBySubscriptionSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list FabricCapacity resources by subscription ID - * - * @summary list FabricCapacity resources by subscription ID - * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json - */ -async function listCapacitiesBySubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListSkusForCapacitySample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListSkusForCapacitySample.ts deleted file mode 100644 index 731a9c040d74..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListSkusForCapacitySample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list eligible SKUs for a Microsoft Fabric resource - * - * @summary list eligible SKUs for a Microsoft Fabric resource - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json - */ -async function listEligibleSKUsForAnExistingCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkusForCapacity( - "TestRG", - "azsdktest", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForAnExistingCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListSkusSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListSkusSample.ts deleted file mode 100644 index 2fcbf415f987..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesListSkusSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list eligible SKUs for Microsoft Fabric resource provider - * - * @summary list eligible SKUs for Microsoft Fabric resource provider - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json - */ -async function listEligibleSKUsForANewCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkus()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForANewCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesResumeSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesResumeSample.ts deleted file mode 100644 index d5a06d3587b6..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesResumeSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to resume operation of the specified Fabric capacity instance. - * - * @summary resume operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json - */ -async function resumeCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.resume("TestRG", "azsdktest"); -} - -async function main() { - resumeCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesSuspendSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesSuspendSample.ts deleted file mode 100644 index 2775b881a683..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesSuspendSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to suspend operation of the specified Fabric capacity instance. - * - * @summary suspend operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json - */ -async function suspendCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.suspend("TestRG", "azsdktest"); -} - -async function main() { - suspendCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesUpdateSample.ts b/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesUpdateSample.ts deleted file mode 100644 index 0261078edc28..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/fabricCapacitiesUpdateSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a FabricCapacity - * - * @summary update a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json - */ -async function updateCapacityProperties() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.update("TestRG", "azsdktest", { - sku: { name: "F8", tier: "Fabric" }, - tags: { testKey: "testValue" }, - properties: { administration: { members: ["azsdktest2@microsoft.com"] } }, - }); - console.log(result); -} - -async function main() { - updateCapacityProperties(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples-dev/operationsListSample.ts b/sdk/fabric/arm-fabric/samples-dev/operationsListSample.ts deleted file mode 100644 index 4b2e3ba30c44..000000000000 --- a/sdk/fabric/arm-fabric/samples-dev/operationsListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2023-11-01/Operations_List.json - */ -async function listOperations() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listOperations(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/README.md b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/README.md deleted file mode 100644 index bde5c1218fb9..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# @azure/arm-fabric client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for @azure/arm-fabric in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| [fabricCapacitiesCheckNameAvailabilitySample.js][fabriccapacitieschecknameavailabilitysample] | implements local CheckNameAvailability operations x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json | -| [fabricCapacitiesCreateOrUpdateSample.js][fabriccapacitiescreateorupdatesample] | create a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json | -| [fabricCapacitiesDeleteSample.js][fabriccapacitiesdeletesample] | delete a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json | -| [fabricCapacitiesGetSample.js][fabriccapacitiesgetsample] | get a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Get.json | -| [fabricCapacitiesListByResourceGroupSample.js][fabriccapacitieslistbyresourcegroupsample] | list FabricCapacity resources by resource group x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json | -| [fabricCapacitiesListBySubscriptionSample.js][fabriccapacitieslistbysubscriptionsample] | list FabricCapacity resources by subscription ID x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json | -| [fabricCapacitiesListSkusForCapacitySample.js][fabriccapacitieslistskusforcapacitysample] | list eligible SKUs for a Microsoft Fabric resource x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json | -| [fabricCapacitiesListSkusSample.js][fabriccapacitieslistskussample] | list eligible SKUs for Microsoft Fabric resource provider x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json | -| [fabricCapacitiesResumeSample.js][fabriccapacitiesresumesample] | resume operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json | -| [fabricCapacitiesSuspendSample.js][fabriccapacitiessuspendsample] | suspend operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json | -| [fabricCapacitiesUpdateSample.js][fabriccapacitiesupdatesample] | update a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Update.json | -| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2023-11-01/Operations_List.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node fabricCapacitiesCheckNameAvailabilitySample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env node fabricCapacitiesCheckNameAvailabilitySample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[fabriccapacitieschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCheckNameAvailabilitySample.js -[fabriccapacitiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCreateOrUpdateSample.js -[fabriccapacitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesDeleteSample.js -[fabriccapacitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesGetSample.js -[fabriccapacitieslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListByResourceGroupSample.js -[fabriccapacitieslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListBySubscriptionSample.js -[fabriccapacitieslistskusforcapacitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusForCapacitySample.js -[fabriccapacitieslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusSample.js -[fabriccapacitiesresumesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesResumeSample.js -[fabriccapacitiessuspendsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesSuspendSample.js -[fabriccapacitiesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/javascript/operationsListSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric/README.md diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCheckNameAvailabilitySample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCheckNameAvailabilitySample.js deleted file mode 100644 index 5b298d5ffeb0..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCheckNameAvailabilitySample.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to implements local CheckNameAvailability operations - * - * @summary implements local CheckNameAvailability operations - * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json - */ -async function checkNameAvailabilityOfACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.checkNameAvailability("westcentralus", { - name: "azsdktest", - type: "Microsoft.Fabric/capacities", - }); - console.log(result); -} - -async function main() { - checkNameAvailabilityOfACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCreateOrUpdateSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCreateOrUpdateSample.js deleted file mode 100644 index ec2bb4ebb31b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesCreateOrUpdateSample.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to create a FabricCapacity - * - * @summary create a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json - */ -async function createOrUpdateACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.createOrUpdate("TestRG", "azsdktest", { - properties: { - administration: { - members: ["azsdktest@microsoft.com", "azsdktest2@microsoft.com"], - }, - }, - sku: { name: "F2", tier: "Fabric" }, - location: "westcentralus", - }); - console.log(result); -} - -async function main() { - createOrUpdateACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesDeleteSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesDeleteSample.js deleted file mode 100644 index 46ff1ad28c67..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesDeleteSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to delete a FabricCapacity - * - * @summary delete a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json - */ -async function deleteACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.delete("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - deleteACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesGetSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesGetSample.js deleted file mode 100644 index d96f8152eb1c..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesGetSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to get a FabricCapacity - * - * @summary get a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json - */ -async function getACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.get("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - getACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListByResourceGroupSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListByResourceGroupSample.js deleted file mode 100644 index 0edd685992b6..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListByResourceGroupSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list FabricCapacity resources by resource group - * - * @summary list FabricCapacity resources by resource group - * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json - */ -async function listCapacitiesByResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listByResourceGroup("TestRG")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListBySubscriptionSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListBySubscriptionSample.js deleted file mode 100644 index cd6ea1324983..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListBySubscriptionSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list FabricCapacity resources by subscription ID - * - * @summary list FabricCapacity resources by subscription ID - * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json - */ -async function listCapacitiesBySubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusForCapacitySample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusForCapacitySample.js deleted file mode 100644 index 802f5af043d9..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusForCapacitySample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list eligible SKUs for a Microsoft Fabric resource - * - * @summary list eligible SKUs for a Microsoft Fabric resource - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json - */ -async function listEligibleSKUsForAnExistingCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkusForCapacity("TestRG", "azsdktest")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForAnExistingCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusSample.js deleted file mode 100644 index 1a13dc837a95..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesListSkusSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list eligible SKUs for Microsoft Fabric resource provider - * - * @summary list eligible SKUs for Microsoft Fabric resource provider - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json - */ -async function listEligibleSKUsForANewCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkus()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForANewCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesResumeSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesResumeSample.js deleted file mode 100644 index c140ef8aafbc..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesResumeSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to resume operation of the specified Fabric capacity instance. - * - * @summary resume operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json - */ -async function resumeCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.resume("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - resumeCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesSuspendSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesSuspendSample.js deleted file mode 100644 index e7aa6da83d51..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesSuspendSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to suspend operation of the specified Fabric capacity instance. - * - * @summary suspend operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json - */ -async function suspendCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.suspend("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - suspendCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesUpdateSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesUpdateSample.js deleted file mode 100644 index 1bef1a5b680c..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/fabricCapacitiesUpdateSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to update a FabricCapacity - * - * @summary update a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json - */ -async function updateCapacityProperties() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.update("TestRG", "azsdktest", { - sku: { name: "F8", tier: "Fabric" }, - tags: { testKey: "testValue" }, - properties: { administration: { members: ["azsdktest2@microsoft.com"] } }, - }); - console.log(result); -} - -async function main() { - updateCapacityProperties(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/operationsListSample.js b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/operationsListSample.js deleted file mode 100644 index af75954d183b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/operationsListSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2023-11-01/Operations_List.json - */ -async function listOperations() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listOperations(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/package.json b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/package.json deleted file mode 100644 index b349b29d7957..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@azure-samples/arm-fabric-js-beta", - "private": true, - "version": "1.0.0", - "description": "@azure/arm-fabric client library samples for JavaScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/fabric/arm-fabric" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric", - "dependencies": { - "@azure/arm-fabric": "next", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/sample.env b/sdk/fabric/arm-fabric/samples/v1-beta/javascript/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/javascript/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/README.md b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/README.md deleted file mode 100644 index 8865a39f0a3b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# @azure/arm-fabric client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for @azure/arm-fabric in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| [fabricCapacitiesCheckNameAvailabilitySample.ts][fabriccapacitieschecknameavailabilitysample] | implements local CheckNameAvailability operations x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json | -| [fabricCapacitiesCreateOrUpdateSample.ts][fabriccapacitiescreateorupdatesample] | create a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json | -| [fabricCapacitiesDeleteSample.ts][fabriccapacitiesdeletesample] | delete a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json | -| [fabricCapacitiesGetSample.ts][fabriccapacitiesgetsample] | get a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Get.json | -| [fabricCapacitiesListByResourceGroupSample.ts][fabriccapacitieslistbyresourcegroupsample] | list FabricCapacity resources by resource group x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json | -| [fabricCapacitiesListBySubscriptionSample.ts][fabriccapacitieslistbysubscriptionsample] | list FabricCapacity resources by subscription ID x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json | -| [fabricCapacitiesListSkusForCapacitySample.ts][fabriccapacitieslistskusforcapacitysample] | list eligible SKUs for a Microsoft Fabric resource x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json | -| [fabricCapacitiesListSkusSample.ts][fabriccapacitieslistskussample] | list eligible SKUs for Microsoft Fabric resource provider x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json | -| [fabricCapacitiesResumeSample.ts][fabriccapacitiesresumesample] | resume operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json | -| [fabricCapacitiesSuspendSample.ts][fabriccapacitiessuspendsample] | suspend operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json | -| [fabricCapacitiesUpdateSample.ts][fabriccapacitiesupdatesample] | update a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Update.json | -| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2023-11-01/Operations_List.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/fabricCapacitiesCheckNameAvailabilitySample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env node dist/fabricCapacitiesCheckNameAvailabilitySample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[fabriccapacitieschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts -[fabriccapacitiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts -[fabriccapacitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesDeleteSample.ts -[fabriccapacitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesGetSample.ts -[fabriccapacitieslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListByResourceGroupSample.ts -[fabriccapacitieslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListBySubscriptionSample.ts -[fabriccapacitieslistskusforcapacitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts -[fabriccapacitieslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusSample.ts -[fabriccapacitiesresumesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesResumeSample.ts -[fabriccapacitiessuspendsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesSuspendSample.ts -[fabriccapacitiesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/operationsListSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/package.json b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/package.json deleted file mode 100644 index 15a914c0dc52..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@azure-samples/arm-fabric-ts-beta", - "private": true, - "version": "1.0.0", - "description": "@azure/arm-fabric client library samples for TypeScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/fabric/arm-fabric" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric", - "dependencies": { - "@azure/arm-fabric": "next", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.6.2", - "rimraf": "latest" - } -} diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/sample.env b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts deleted file mode 100644 index 2aab90bfdbe1..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to implements local CheckNameAvailability operations - * - * @summary implements local CheckNameAvailability operations - * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json - */ -async function checkNameAvailabilityOfACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.checkNameAvailability( - "westcentralus", - { name: "azsdktest", type: "Microsoft.Fabric/capacities" }, - ); - console.log(result); -} - -async function main() { - checkNameAvailabilityOfACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts deleted file mode 100644 index be407c91b629..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a FabricCapacity - * - * @summary create a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json - */ -async function createOrUpdateACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.createOrUpdate( - "TestRG", - "azsdktest", - { - properties: { - administration: { - members: ["azsdktest@microsoft.com", "azsdktest2@microsoft.com"], - }, - }, - sku: { name: "F2", tier: "Fabric" }, - location: "westcentralus", - }, - ); - console.log(result); -} - -async function main() { - createOrUpdateACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesDeleteSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesDeleteSample.ts deleted file mode 100644 index d58a7d88afce..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesDeleteSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a FabricCapacity - * - * @summary delete a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json - */ -async function deleteACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.delete("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - deleteACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesGetSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesGetSample.ts deleted file mode 100644 index 6289eac0d813..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a FabricCapacity - * - * @summary get a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json - */ -async function getACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.get("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - getACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListByResourceGroupSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListByResourceGroupSample.ts deleted file mode 100644 index 150a3fd4e131..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListByResourceGroupSample.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list FabricCapacity resources by resource group - * - * @summary list FabricCapacity resources by resource group - * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json - */ -async function listCapacitiesByResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listByResourceGroup( - "TestRG", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListBySubscriptionSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListBySubscriptionSample.ts deleted file mode 100644 index a35e7dff27a5..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListBySubscriptionSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list FabricCapacity resources by subscription ID - * - * @summary list FabricCapacity resources by subscription ID - * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json - */ -async function listCapacitiesBySubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts deleted file mode 100644 index 88db01c05e9d..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list eligible SKUs for a Microsoft Fabric resource - * - * @summary list eligible SKUs for a Microsoft Fabric resource - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json - */ -async function listEligibleSKUsForAnExistingCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkusForCapacity( - "TestRG", - "azsdktest", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForAnExistingCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusSample.ts deleted file mode 100644 index 2550dff612b2..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesListSkusSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list eligible SKUs for Microsoft Fabric resource provider - * - * @summary list eligible SKUs for Microsoft Fabric resource provider - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json - */ -async function listEligibleSKUsForANewCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkus()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForANewCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesResumeSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesResumeSample.ts deleted file mode 100644 index 4702c5e973de..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesResumeSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to resume operation of the specified Fabric capacity instance. - * - * @summary resume operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json - */ -async function resumeCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.resume("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - resumeCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesSuspendSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesSuspendSample.ts deleted file mode 100644 index 03915cf9bf19..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesSuspendSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to suspend operation of the specified Fabric capacity instance. - * - * @summary suspend operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json - */ -async function suspendCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.suspend("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - suspendCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesUpdateSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesUpdateSample.ts deleted file mode 100644 index 2013f0e4f1ac..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/fabricCapacitiesUpdateSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a FabricCapacity - * - * @summary update a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json - */ -async function updateCapacityProperties() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.update("TestRG", "azsdktest", { - sku: { name: "F8", tier: "Fabric" }, - tags: { testKey: "testValue" }, - properties: { administration: { members: ["azsdktest2@microsoft.com"] } }, - }); - console.log(result); -} - -async function main() { - updateCapacityProperties(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/operationsListSample.ts deleted file mode 100644 index d233d99dfc20..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2023-11-01/Operations_List.json - */ -async function listOperations() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listOperations(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/tsconfig.json b/sdk/fabric/arm-fabric/samples/v1-beta/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1-beta/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/README.md b/sdk/fabric/arm-fabric/samples/v1/javascript/README.md deleted file mode 100644 index 8b2b28f34b2e..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# @azure/arm-fabric client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for @azure/arm-fabric in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| [fabricCapacitiesCheckNameAvailabilitySample.js][fabriccapacitieschecknameavailabilitysample] | implements local CheckNameAvailability operations x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json | -| [fabricCapacitiesCreateOrUpdateSample.js][fabriccapacitiescreateorupdatesample] | create a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json | -| [fabricCapacitiesDeleteSample.js][fabriccapacitiesdeletesample] | delete a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json | -| [fabricCapacitiesGetSample.js][fabriccapacitiesgetsample] | get a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Get.json | -| [fabricCapacitiesListByResourceGroupSample.js][fabriccapacitieslistbyresourcegroupsample] | list FabricCapacity resources by resource group x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json | -| [fabricCapacitiesListBySubscriptionSample.js][fabriccapacitieslistbysubscriptionsample] | list FabricCapacity resources by subscription ID x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json | -| [fabricCapacitiesListSkusForCapacitySample.js][fabriccapacitieslistskusforcapacitysample] | list eligible SKUs for a Microsoft Fabric resource x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json | -| [fabricCapacitiesListSkusSample.js][fabriccapacitieslistskussample] | list eligible SKUs for Microsoft Fabric resource provider x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json | -| [fabricCapacitiesResumeSample.js][fabriccapacitiesresumesample] | resume operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json | -| [fabricCapacitiesSuspendSample.js][fabriccapacitiessuspendsample] | suspend operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json | -| [fabricCapacitiesUpdateSample.js][fabriccapacitiesupdatesample] | update a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Update.json | -| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2023-11-01/Operations_List.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node fabricCapacitiesCheckNameAvailabilitySample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env node fabricCapacitiesCheckNameAvailabilitySample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[fabriccapacitieschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCheckNameAvailabilitySample.js -[fabriccapacitiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCreateOrUpdateSample.js -[fabriccapacitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesDeleteSample.js -[fabriccapacitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesGetSample.js -[fabriccapacitieslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListByResourceGroupSample.js -[fabriccapacitieslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListBySubscriptionSample.js -[fabriccapacitieslistskusforcapacitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusForCapacitySample.js -[fabriccapacitieslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusSample.js -[fabriccapacitiesresumesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesResumeSample.js -[fabriccapacitiessuspendsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesSuspendSample.js -[fabriccapacitiesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/javascript/operationsListSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric/README.md diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCheckNameAvailabilitySample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCheckNameAvailabilitySample.js deleted file mode 100644 index bc7041a9c18f..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCheckNameAvailabilitySample.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to implements local CheckNameAvailability operations - * - * @summary implements local CheckNameAvailability operations - * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json - */ -async function checkNameAvailabilityOfACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.checkNameAvailability("westcentralus", { - name: "azsdktest", - type: "Microsoft.Fabric/capacities", - }); - console.log(result); -} - -async function main() { - checkNameAvailabilityOfACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCreateOrUpdateSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCreateOrUpdateSample.js deleted file mode 100644 index 2193edc838db..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesCreateOrUpdateSample.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to create a FabricCapacity - * - * @summary create a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json - */ -async function createOrUpdateACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.createOrUpdate("TestRG", "azsdktest", { - properties: { - administration: { - members: ["azsdktest@microsoft.com", "azsdktest2@microsoft.com"], - }, - }, - sku: { name: "F2", tier: "Fabric" }, - location: "westcentralus", - }); - console.log(result); -} - -async function main() { - createOrUpdateACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesDeleteSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesDeleteSample.js deleted file mode 100644 index 3b6bd2bbd662..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesDeleteSample.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to delete a FabricCapacity - * - * @summary delete a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json - */ -async function deleteACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.delete("TestRG", "azsdktest"); -} - -async function main() { - deleteACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesGetSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesGetSample.js deleted file mode 100644 index 9724cd3026a7..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesGetSample.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to get a FabricCapacity - * - * @summary get a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json - */ -async function getACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.get("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - getACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListByResourceGroupSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListByResourceGroupSample.js deleted file mode 100644 index fe931fb5e16c..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListByResourceGroupSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list FabricCapacity resources by resource group - * - * @summary list FabricCapacity resources by resource group - * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json - */ -async function listCapacitiesByResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listByResourceGroup("TestRG")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListBySubscriptionSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListBySubscriptionSample.js deleted file mode 100644 index 761a8e407206..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListBySubscriptionSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list FabricCapacity resources by subscription ID - * - * @summary list FabricCapacity resources by subscription ID - * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json - */ -async function listCapacitiesBySubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusForCapacitySample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusForCapacitySample.js deleted file mode 100644 index b4ba45227cd3..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusForCapacitySample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list eligible SKUs for a Microsoft Fabric resource - * - * @summary list eligible SKUs for a Microsoft Fabric resource - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json - */ -async function listEligibleSKUsForAnExistingCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkusForCapacity("TestRG", "azsdktest")) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForAnExistingCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusSample.js deleted file mode 100644 index 51283ee37bc7..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesListSkusSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list eligible SKUs for Microsoft Fabric resource provider - * - * @summary list eligible SKUs for Microsoft Fabric resource provider - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json - */ -async function listEligibleSKUsForANewCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkus()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForANewCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesResumeSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesResumeSample.js deleted file mode 100644 index 9bdf86ea4ab1..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesResumeSample.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to resume operation of the specified Fabric capacity instance. - * - * @summary resume operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json - */ -async function resumeCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.resume("TestRG", "azsdktest"); -} - -async function main() { - resumeCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesSuspendSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesSuspendSample.js deleted file mode 100644 index 933e1337e26b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesSuspendSample.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to suspend operation of the specified Fabric capacity instance. - * - * @summary suspend operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json - */ -async function suspendCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.suspend("TestRG", "azsdktest"); -} - -async function main() { - suspendCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesUpdateSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesUpdateSample.js deleted file mode 100644 index 1463a195f962..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/fabricCapacitiesUpdateSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to update a FabricCapacity - * - * @summary update a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json - */ -async function updateCapacityProperties() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.update("TestRG", "azsdktest", { - sku: { name: "F8", tier: "Fabric" }, - tags: { testKey: "testValue" }, - properties: { administration: { members: ["azsdktest2@microsoft.com"] } }, - }); - console.log(result); -} - -async function main() { - updateCapacityProperties(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/operationsListSample.js b/sdk/fabric/arm-fabric/samples/v1/javascript/operationsListSample.js deleted file mode 100644 index 1718a32f54ba..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/operationsListSample.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -const { FabricClient } = require("@azure/arm-fabric"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2023-11-01/Operations_List.json - */ -async function listOperations() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listOperations(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/package.json b/sdk/fabric/arm-fabric/samples/v1/javascript/package.json deleted file mode 100644 index 7c94417883d6..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@azure-samples/arm-fabric-js", - "private": true, - "version": "1.0.0", - "description": "@azure/arm-fabric client library samples for JavaScript", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/fabric/arm-fabric" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric", - "dependencies": { - "@azure/arm-fabric": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/fabric/arm-fabric/samples/v1/javascript/sample.env b/sdk/fabric/arm-fabric/samples/v1/javascript/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/javascript/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/README.md b/sdk/fabric/arm-fabric/samples/v1/typescript/README.md deleted file mode 100644 index fccc224edc32..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# @azure/arm-fabric client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for @azure/arm-fabric in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| [fabricCapacitiesCheckNameAvailabilitySample.ts][fabriccapacitieschecknameavailabilitysample] | implements local CheckNameAvailability operations x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json | -| [fabricCapacitiesCreateOrUpdateSample.ts][fabriccapacitiescreateorupdatesample] | create a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json | -| [fabricCapacitiesDeleteSample.ts][fabriccapacitiesdeletesample] | delete a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json | -| [fabricCapacitiesGetSample.ts][fabriccapacitiesgetsample] | get a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Get.json | -| [fabricCapacitiesListByResourceGroupSample.ts][fabriccapacitieslistbyresourcegroupsample] | list FabricCapacity resources by resource group x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json | -| [fabricCapacitiesListBySubscriptionSample.ts][fabriccapacitieslistbysubscriptionsample] | list FabricCapacity resources by subscription ID x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json | -| [fabricCapacitiesListSkusForCapacitySample.ts][fabriccapacitieslistskusforcapacitysample] | list eligible SKUs for a Microsoft Fabric resource x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json | -| [fabricCapacitiesListSkusSample.ts][fabriccapacitieslistskussample] | list eligible SKUs for Microsoft Fabric resource provider x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json | -| [fabricCapacitiesResumeSample.ts][fabriccapacitiesresumesample] | resume operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json | -| [fabricCapacitiesSuspendSample.ts][fabriccapacitiessuspendsample] | suspend operation of the specified Fabric capacity instance. x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json | -| [fabricCapacitiesUpdateSample.ts][fabriccapacitiesupdatesample] | update a FabricCapacity x-ms-original-file: 2023-11-01/FabricCapacities_Update.json | -| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2023-11-01/Operations_List.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/fabricCapacitiesCheckNameAvailabilitySample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env node dist/fabricCapacitiesCheckNameAvailabilitySample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[fabriccapacitieschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts -[fabriccapacitiescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts -[fabriccapacitiesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesDeleteSample.ts -[fabriccapacitiesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesGetSample.ts -[fabriccapacitieslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListByResourceGroupSample.ts -[fabriccapacitieslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListBySubscriptionSample.ts -[fabriccapacitieslistskusforcapacitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts -[fabriccapacitieslistskussample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusSample.ts -[fabriccapacitiesresumesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesResumeSample.ts -[fabriccapacitiessuspendsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesSuspendSample.ts -[fabriccapacitiesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fabric/arm-fabric/samples/v1/typescript/src/operationsListSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-fabric?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/package.json b/sdk/fabric/arm-fabric/samples/v1/typescript/package.json deleted file mode 100644 index 2149ef8e2037..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@azure-samples/arm-fabric-ts", - "private": true, - "version": "1.0.0", - "description": "@azure/arm-fabric client library samples for TypeScript", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/fabric/arm-fabric" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fabric/arm-fabric", - "dependencies": { - "@azure/arm-fabric": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.6.2", - "rimraf": "latest" - } -} diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/sample.env b/sdk/fabric/arm-fabric/samples/v1/typescript/sample.env deleted file mode 100644 index efbc7787bd3b..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts deleted file mode 100644 index 6d0c6e3d84bd..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCheckNameAvailabilitySample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to implements local CheckNameAvailability operations - * - * @summary implements local CheckNameAvailability operations - * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json - */ -async function checkNameAvailabilityOfACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.checkNameAvailability( - "westcentralus", - { name: "azsdktest", type: "Microsoft.Fabric/capacities" }, - ); - console.log(result); -} - -async function main() { - checkNameAvailabilityOfACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts deleted file mode 100644 index 5c0bdb2782b4..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesCreateOrUpdateSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a FabricCapacity - * - * @summary create a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json - */ -async function createOrUpdateACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.createOrUpdate( - "TestRG", - "azsdktest", - { - properties: { - administration: { - members: ["azsdktest@microsoft.com", "azsdktest2@microsoft.com"], - }, - }, - sku: { name: "F2", tier: "Fabric" }, - location: "westcentralus", - }, - ); - console.log(result); -} - -async function main() { - createOrUpdateACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesDeleteSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesDeleteSample.ts deleted file mode 100644 index edc998780566..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesDeleteSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a FabricCapacity - * - * @summary delete a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json - */ -async function deleteACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.delete("TestRG", "azsdktest"); -} - -async function main() { - deleteACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesGetSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesGetSample.ts deleted file mode 100644 index ed8948e384b6..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesGetSample.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a FabricCapacity - * - * @summary get a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json - */ -async function getACapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.get("TestRG", "azsdktest"); - console.log(result); -} - -async function main() { - getACapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListByResourceGroupSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListByResourceGroupSample.ts deleted file mode 100644 index 08892bd95c26..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListByResourceGroupSample.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list FabricCapacity resources by resource group - * - * @summary list FabricCapacity resources by resource group - * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json - */ -async function listCapacitiesByResourceGroup() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listByResourceGroup( - "TestRG", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListBySubscriptionSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListBySubscriptionSample.ts deleted file mode 100644 index 9951f51ba60a..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListBySubscriptionSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list FabricCapacity resources by subscription ID - * - * @summary list FabricCapacity resources by subscription ID - * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json - */ -async function listCapacitiesBySubscription() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listCapacitiesBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts deleted file mode 100644 index 731a9c040d74..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusForCapacitySample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list eligible SKUs for a Microsoft Fabric resource - * - * @summary list eligible SKUs for a Microsoft Fabric resource - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json - */ -async function listEligibleSKUsForAnExistingCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkusForCapacity( - "TestRG", - "azsdktest", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForAnExistingCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusSample.ts deleted file mode 100644 index 2fcbf415f987..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesListSkusSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list eligible SKUs for Microsoft Fabric resource provider - * - * @summary list eligible SKUs for Microsoft Fabric resource provider - * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json - */ -async function listEligibleSKUsForANewCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.fabricCapacities.listSkus()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listEligibleSKUsForANewCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesResumeSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesResumeSample.ts deleted file mode 100644 index d5a06d3587b6..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesResumeSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to resume operation of the specified Fabric capacity instance. - * - * @summary resume operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json - */ -async function resumeCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.resume("TestRG", "azsdktest"); -} - -async function main() { - resumeCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesSuspendSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesSuspendSample.ts deleted file mode 100644 index 2775b881a683..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesSuspendSample.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to suspend operation of the specified Fabric capacity instance. - * - * @summary suspend operation of the specified Fabric capacity instance. - * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json - */ -async function suspendCapacity() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - await client.fabricCapacities.suspend("TestRG", "azsdktest"); -} - -async function main() { - suspendCapacity(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesUpdateSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesUpdateSample.ts deleted file mode 100644 index 0261078edc28..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/fabricCapacitiesUpdateSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a FabricCapacity - * - * @summary update a FabricCapacity - * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json - */ -async function updateCapacityProperties() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; - const client = new FabricClient(credential, subscriptionId); - const result = await client.fabricCapacities.update("TestRG", "azsdktest", { - sku: { name: "F8", tier: "Fabric" }, - tags: { testKey: "testValue" }, - properties: { administration: { members: ["azsdktest2@microsoft.com"] } }, - }); - console.log(result); -} - -async function main() { - updateCapacityProperties(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/src/operationsListSample.ts b/sdk/fabric/arm-fabric/samples/v1/typescript/src/operationsListSample.ts deleted file mode 100644 index 4b2e3ba30c44..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "@azure/arm-fabric"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2023-11-01/Operations_List.json - */ -async function listOperations() { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new FabricClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main() { - listOperations(); -} - -main().catch(console.error); diff --git a/sdk/fabric/arm-fabric/samples/v1/typescript/tsconfig.json b/sdk/fabric/arm-fabric/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/fabric/arm-fabric/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/fabric/arm-fabric/src/api/fabricCapacities/index.ts b/sdk/fabric/arm-fabric/src/api/fabricCapacities/index.ts deleted file mode 100644 index f7df3a0fe4ad..000000000000 --- a/sdk/fabric/arm-fabric/src/api/fabricCapacities/index.ts +++ /dev/null @@ -1,596 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - FabricContext as Client, - FabricCapacitiesCheckNameAvailabilityOptionalParams, - FabricCapacitiesCreateOrUpdateOptionalParams, - FabricCapacitiesDeleteOptionalParams, - FabricCapacitiesGetOptionalParams, - FabricCapacitiesListByResourceGroupOptionalParams, - FabricCapacitiesListBySubscriptionOptionalParams, - FabricCapacitiesListSkusForCapacityOptionalParams, - FabricCapacitiesListSkusOptionalParams, - FabricCapacitiesResumeOptionalParams, - FabricCapacitiesSuspendOptionalParams, - FabricCapacitiesUpdateOptionalParams, -} from "../index.js"; -import { - FabricCapacity, - fabricCapacitySerializer, - fabricCapacityDeserializer, - FabricCapacityUpdate, - fabricCapacityUpdateSerializer, - _FabricCapacityListResult, - _fabricCapacityListResultDeserializer, - CheckNameAvailabilityRequest, - checkNameAvailabilityRequestSerializer, - CheckNameAvailabilityResponse, - checkNameAvailabilityResponseDeserializer, - _RpSkuEnumerationForExistingResourceResult, - _rpSkuEnumerationForExistingResourceResultDeserializer, - RpSkuDetailsForExistingResource, - _RpSkuEnumerationForNewResourceResult, - _rpSkuEnumerationForNewResourceResultDeserializer, - RpSkuDetailsForNewResource, -} from "../../models/models.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; -import { PollerLike, OperationState } from "@azure/core-lro"; - -export function _fabricCapacitiesGetSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesGetOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}", - subscriptionId, - resourceGroupName, - capacityName, - ) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesGetDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return fabricCapacityDeserializer(result.body); -} - -/** Get a FabricCapacity */ -export async function fabricCapacitiesGet( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _fabricCapacitiesGetSend( - context, - subscriptionId, - resourceGroupName, - capacityName, - options, - ); - return _fabricCapacitiesGetDeserialize(result); -} - -export function _fabricCapacitiesCreateOrUpdateSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - resource: FabricCapacity, - options: FabricCapacitiesCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}", - subscriptionId, - resourceGroupName, - capacityName, - ) - .put({ - ...operationOptionsToRequestParameters(options), - body: fabricCapacitySerializer(resource), - }); -} - -export async function _fabricCapacitiesCreateOrUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return fabricCapacityDeserializer(result.body); -} - -/** Create a FabricCapacity */ -export function fabricCapacitiesCreateOrUpdate( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - resource: FabricCapacity, - options: FabricCapacitiesCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): PollerLike, FabricCapacity> { - return getLongRunningPoller(context, _fabricCapacitiesCreateOrUpdateDeserialize, ["200", "201"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _fabricCapacitiesCreateOrUpdateSend( - context, - subscriptionId, - resourceGroupName, - capacityName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }) as PollerLike, FabricCapacity>; -} - -export function _fabricCapacitiesUpdateSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - properties: FabricCapacityUpdate, - options: FabricCapacitiesUpdateOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}", - subscriptionId, - resourceGroupName, - capacityName, - ) - .patch({ - ...operationOptionsToRequestParameters(options), - body: fabricCapacityUpdateSerializer(properties), - }); -} - -export async function _fabricCapacitiesUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "202"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return fabricCapacityDeserializer(result.body); -} - -/** Update a FabricCapacity */ -export function fabricCapacitiesUpdate( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - properties: FabricCapacityUpdate, - options: FabricCapacitiesUpdateOptionalParams = { requestOptions: {} }, -): PollerLike, FabricCapacity> { - return getLongRunningPoller(context, _fabricCapacitiesUpdateDeserialize, ["200", "202"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _fabricCapacitiesUpdateSend( - context, - subscriptionId, - resourceGroupName, - capacityName, - properties, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, FabricCapacity>; -} - -export function _fabricCapacitiesDeleteSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesDeleteOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}", - subscriptionId, - resourceGroupName, - capacityName, - ) - .delete({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesDeleteDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202", "204", "200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** Delete a FabricCapacity */ -export function fabricCapacitiesDelete( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesDeleteOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller(context, _fabricCapacitiesDeleteDeserialize, ["202", "204", "200"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _fabricCapacitiesDeleteSend( - context, - subscriptionId, - resourceGroupName, - capacityName, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, void>; -} - -export function _fabricCapacitiesListByResourceGroupSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - options: FabricCapacitiesListByResourceGroupOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities", - subscriptionId, - resourceGroupName, - ) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesListByResourceGroupDeserialize( - result: PathUncheckedResponse, -): Promise<_FabricCapacityListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _fabricCapacityListResultDeserializer(result.body); -} - -/** List FabricCapacity resources by resource group */ -export function fabricCapacitiesListByResourceGroup( - context: Client, - subscriptionId: string, - resourceGroupName: string, - options: FabricCapacitiesListByResourceGroupOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _fabricCapacitiesListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), - _fabricCapacitiesListByResourceGroupDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _fabricCapacitiesListBySubscriptionSend( - context: Client, - subscriptionId: string, - options: FabricCapacitiesListBySubscriptionOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path("/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/capacities", subscriptionId) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesListBySubscriptionDeserialize( - result: PathUncheckedResponse, -): Promise<_FabricCapacityListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _fabricCapacityListResultDeserializer(result.body); -} - -/** List FabricCapacity resources by subscription ID */ -export function fabricCapacitiesListBySubscription( - context: Client, - subscriptionId: string, - options: FabricCapacitiesListBySubscriptionOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _fabricCapacitiesListBySubscriptionSend(context, subscriptionId, options), - _fabricCapacitiesListBySubscriptionDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _fabricCapacitiesResumeSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesResumeOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/resume", - subscriptionId, - resourceGroupName, - capacityName, - ) - .post({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesResumeDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "202"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** Resume operation of the specified Fabric capacity instance. */ -export function fabricCapacitiesResume( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesResumeOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller(context, _fabricCapacitiesResumeDeserialize, ["200", "202"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _fabricCapacitiesResumeSend( - context, - subscriptionId, - resourceGroupName, - capacityName, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, void>; -} - -export function _fabricCapacitiesSuspendSend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesSuspendOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/suspend", - subscriptionId, - resourceGroupName, - capacityName, - ) - .post({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesSuspendDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "202"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return; -} - -/** Suspend operation of the specified Fabric capacity instance. */ -export function fabricCapacitiesSuspend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesSuspendOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller(context, _fabricCapacitiesSuspendDeserialize, ["200", "202"], { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _fabricCapacitiesSuspendSend( - context, - subscriptionId, - resourceGroupName, - capacityName, - options, - ), - resourceLocationConfig: "location", - }) as PollerLike, void>; -} - -export function _fabricCapacitiesCheckNameAvailabilitySend( - context: Client, - subscriptionId: string, - location: string, - body: CheckNameAvailabilityRequest, - options: FabricCapacitiesCheckNameAvailabilityOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/checkNameAvailability", - subscriptionId, - location, - ) - .post({ - ...operationOptionsToRequestParameters(options), - body: checkNameAvailabilityRequestSerializer(body), - }); -} - -export async function _fabricCapacitiesCheckNameAvailabilityDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return checkNameAvailabilityResponseDeserializer(result.body); -} - -/** Implements local CheckNameAvailability operations */ -export async function fabricCapacitiesCheckNameAvailability( - context: Client, - subscriptionId: string, - location: string, - body: CheckNameAvailabilityRequest, - options: FabricCapacitiesCheckNameAvailabilityOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _fabricCapacitiesCheckNameAvailabilitySend( - context, - subscriptionId, - location, - body, - options, - ); - return _fabricCapacitiesCheckNameAvailabilityDeserialize(result); -} - -export function _fabricCapacitiesListSkusForCapacitySend( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesListSkusForCapacityOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/skus", - subscriptionId, - resourceGroupName, - capacityName, - ) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesListSkusForCapacityDeserialize( - result: PathUncheckedResponse, -): Promise<_RpSkuEnumerationForExistingResourceResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _rpSkuEnumerationForExistingResourceResultDeserializer(result.body); -} - -/** List eligible SKUs for a Microsoft Fabric resource */ -export function fabricCapacitiesListSkusForCapacity( - context: Client, - subscriptionId: string, - resourceGroupName: string, - capacityName: string, - options: FabricCapacitiesListSkusForCapacityOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _fabricCapacitiesListSkusForCapacitySend( - context, - subscriptionId, - resourceGroupName, - capacityName, - options, - ), - _fabricCapacitiesListSkusForCapacityDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _fabricCapacitiesListSkusSend( - context: Client, - subscriptionId: string, - options: FabricCapacitiesListSkusOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/skus", subscriptionId) - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _fabricCapacitiesListSkusDeserialize( - result: PathUncheckedResponse, -): Promise<_RpSkuEnumerationForNewResourceResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _rpSkuEnumerationForNewResourceResultDeserializer(result.body); -} - -/** List eligible SKUs for Microsoft Fabric resource provider */ -export function fabricCapacitiesListSkus( - context: Client, - subscriptionId: string, - options: FabricCapacitiesListSkusOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _fabricCapacitiesListSkusSend(context, subscriptionId, options), - _fabricCapacitiesListSkusDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} diff --git a/sdk/fabric/arm-fabric/src/api/fabricContext.ts b/sdk/fabric/arm-fabric/src/api/fabricContext.ts deleted file mode 100644 index 1f740aaedbf1..000000000000 --- a/sdk/fabric/arm-fabric/src/api/fabricContext.ts +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { logger } from "../logger.js"; -import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; -import { TokenCredential } from "@azure/core-auth"; - -export interface FabricContext extends Client {} - -/** Optional parameters for the client. */ -export interface FabricClientOptionalParams extends ClientOptions { - /** The API version to use for this operation. */ - apiVersion?: string; -} - -export function createFabric( - credential: TokenCredential, - options: FabricClientOptionalParams = {}, -): FabricContext { - const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; - - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentInfo = `azsdk-js-arm-fabric/1.0.1`; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` - : `azsdk-js-api ${userAgentInfo}`; - 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 ?? "2023-11-01"; - 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/fabric/arm-fabric/src/api/index.ts b/sdk/fabric/arm-fabric/src/api/index.ts deleted file mode 100644 index a54caeb2aad4..000000000000 --- a/sdk/fabric/arm-fabric/src/api/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { createFabric, FabricContext, FabricClientOptionalParams } from "./fabricContext.js"; -export { - FabricCapacitiesGetOptionalParams, - FabricCapacitiesCreateOrUpdateOptionalParams, - FabricCapacitiesUpdateOptionalParams, - FabricCapacitiesDeleteOptionalParams, - FabricCapacitiesListByResourceGroupOptionalParams, - FabricCapacitiesListBySubscriptionOptionalParams, - FabricCapacitiesResumeOptionalParams, - FabricCapacitiesSuspendOptionalParams, - FabricCapacitiesCheckNameAvailabilityOptionalParams, - FabricCapacitiesListSkusForCapacityOptionalParams, - FabricCapacitiesListSkusOptionalParams, - OperationsListOptionalParams, -} from "./options.js"; -export { - fabricCapacitiesGet, - fabricCapacitiesCreateOrUpdate, - fabricCapacitiesUpdate, - fabricCapacitiesDelete, - fabricCapacitiesListByResourceGroup, - fabricCapacitiesListBySubscription, - fabricCapacitiesResume, - fabricCapacitiesSuspend, - fabricCapacitiesCheckNameAvailability, - fabricCapacitiesListSkusForCapacity, - fabricCapacitiesListSkus, -} from "./fabricCapacities/index.js"; -export { operationsList } from "./operations/index.js"; diff --git a/sdk/fabric/arm-fabric/src/api/operations/index.ts b/sdk/fabric/arm-fabric/src/api/operations/index.ts deleted file mode 100644 index 0b9e3990441c..000000000000 --- a/sdk/fabric/arm-fabric/src/api/operations/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricContext as Client, OperationsListOptionalParams } from "../index.js"; -import { - _OperationListResult, - _operationListResultDeserializer, - Operation, -} from "../../models/models.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; - -export function _operationsListSend( - context: Client, - options: OperationsListOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/providers/Microsoft.Fabric/operations") - .get({ ...operationOptionsToRequestParameters(options) }); -} - -export async function _operationsListDeserialize( - result: PathUncheckedResponse, -): Promise<_OperationListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - - return _operationListResultDeserializer(result.body); -} - -/** List the operations for the provider */ -export function operationsList( - context: Client, - options: OperationsListOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _operationsListSend(context, options), - _operationsListDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} diff --git a/sdk/fabric/arm-fabric/src/api/options.ts b/sdk/fabric/arm-fabric/src/api/options.ts deleted file mode 100644 index 7f27b346f816..000000000000 --- a/sdk/fabric/arm-fabric/src/api/options.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { OperationOptions } from "@azure-rest/core-client"; - -/** Optional parameters. */ -export interface FabricCapacitiesGetOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface FabricCapacitiesCreateOrUpdateOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FabricCapacitiesUpdateOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FabricCapacitiesDeleteOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FabricCapacitiesListByResourceGroupOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface FabricCapacitiesListBySubscriptionOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface FabricCapacitiesResumeOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FabricCapacitiesSuspendOptionalParams extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FabricCapacitiesCheckNameAvailabilityOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface FabricCapacitiesListSkusForCapacityOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface FabricCapacitiesListSkusOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/fabric/arm-fabric/src/classic/fabricCapacities/index.ts b/sdk/fabric/arm-fabric/src/classic/fabricCapacities/index.ts deleted file mode 100644 index 6ef9f4af8109..000000000000 --- a/sdk/fabric/arm-fabric/src/classic/fabricCapacities/index.ts +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricContext } from "../../api/fabricContext.js"; -import { - fabricCapacitiesGet, - fabricCapacitiesCreateOrUpdate, - fabricCapacitiesUpdate, - fabricCapacitiesDelete, - fabricCapacitiesListByResourceGroup, - fabricCapacitiesListBySubscription, - fabricCapacitiesResume, - fabricCapacitiesSuspend, - fabricCapacitiesCheckNameAvailability, - fabricCapacitiesListSkusForCapacity, - fabricCapacitiesListSkus, -} from "../../api/fabricCapacities/index.js"; -import { - FabricCapacity, - FabricCapacityUpdate, - CheckNameAvailabilityRequest, - CheckNameAvailabilityResponse, - RpSkuDetailsForExistingResource, - RpSkuDetailsForNewResource, -} from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; -import { - FabricCapacitiesGetOptionalParams, - FabricCapacitiesCreateOrUpdateOptionalParams, - FabricCapacitiesUpdateOptionalParams, - FabricCapacitiesDeleteOptionalParams, - FabricCapacitiesListByResourceGroupOptionalParams, - FabricCapacitiesListBySubscriptionOptionalParams, - FabricCapacitiesResumeOptionalParams, - FabricCapacitiesSuspendOptionalParams, - FabricCapacitiesCheckNameAvailabilityOptionalParams, - FabricCapacitiesListSkusForCapacityOptionalParams, - FabricCapacitiesListSkusOptionalParams, -} from "../../api/options.js"; - -/** Interface representing a FabricCapacities operations. */ -export interface FabricCapacitiesOperations { - /** Get a FabricCapacity */ - get: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesGetOptionalParams, - ) => Promise; - /** Create a FabricCapacity */ - createOrUpdate: ( - resourceGroupName: string, - capacityName: string, - resource: FabricCapacity, - options?: FabricCapacitiesCreateOrUpdateOptionalParams, - ) => PollerLike, FabricCapacity>; - /** Update a FabricCapacity */ - update: ( - resourceGroupName: string, - capacityName: string, - properties: FabricCapacityUpdate, - options?: FabricCapacitiesUpdateOptionalParams, - ) => PollerLike, FabricCapacity>; - /** Delete a FabricCapacity */ - delete: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesDeleteOptionalParams, - ) => PollerLike, void>; - /** List FabricCapacity resources by resource group */ - listByResourceGroup: ( - resourceGroupName: string, - options?: FabricCapacitiesListByResourceGroupOptionalParams, - ) => PagedAsyncIterableIterator; - /** List FabricCapacity resources by subscription ID */ - listBySubscription: ( - options?: FabricCapacitiesListBySubscriptionOptionalParams, - ) => PagedAsyncIterableIterator; - /** Resume operation of the specified Fabric capacity instance. */ - resume: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesResumeOptionalParams, - ) => PollerLike, void>; - /** Suspend operation of the specified Fabric capacity instance. */ - suspend: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesSuspendOptionalParams, - ) => PollerLike, void>; - /** Implements local CheckNameAvailability operations */ - checkNameAvailability: ( - location: string, - body: CheckNameAvailabilityRequest, - options?: FabricCapacitiesCheckNameAvailabilityOptionalParams, - ) => Promise; - /** List eligible SKUs for a Microsoft Fabric resource */ - listSkusForCapacity: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesListSkusForCapacityOptionalParams, - ) => PagedAsyncIterableIterator; - /** List eligible SKUs for Microsoft Fabric resource provider */ - listSkus: ( - options?: FabricCapacitiesListSkusOptionalParams, - ) => PagedAsyncIterableIterator; -} - -export function getFabricCapacities(context: FabricContext, subscriptionId: string) { - return { - get: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesGetOptionalParams, - ) => fabricCapacitiesGet(context, subscriptionId, resourceGroupName, capacityName, options), - createOrUpdate: ( - resourceGroupName: string, - capacityName: string, - resource: FabricCapacity, - options?: FabricCapacitiesCreateOrUpdateOptionalParams, - ) => - fabricCapacitiesCreateOrUpdate( - context, - subscriptionId, - resourceGroupName, - capacityName, - resource, - options, - ), - update: ( - resourceGroupName: string, - capacityName: string, - properties: FabricCapacityUpdate, - options?: FabricCapacitiesUpdateOptionalParams, - ) => - fabricCapacitiesUpdate( - context, - subscriptionId, - resourceGroupName, - capacityName, - properties, - options, - ), - delete: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesDeleteOptionalParams, - ) => fabricCapacitiesDelete(context, subscriptionId, resourceGroupName, capacityName, options), - listByResourceGroup: ( - resourceGroupName: string, - options?: FabricCapacitiesListByResourceGroupOptionalParams, - ) => fabricCapacitiesListByResourceGroup(context, subscriptionId, resourceGroupName, options), - listBySubscription: (options?: FabricCapacitiesListBySubscriptionOptionalParams) => - fabricCapacitiesListBySubscription(context, subscriptionId, options), - resume: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesResumeOptionalParams, - ) => fabricCapacitiesResume(context, subscriptionId, resourceGroupName, capacityName, options), - suspend: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesSuspendOptionalParams, - ) => fabricCapacitiesSuspend(context, subscriptionId, resourceGroupName, capacityName, options), - checkNameAvailability: ( - location: string, - body: CheckNameAvailabilityRequest, - options?: FabricCapacitiesCheckNameAvailabilityOptionalParams, - ) => fabricCapacitiesCheckNameAvailability(context, subscriptionId, location, body, options), - listSkusForCapacity: ( - resourceGroupName: string, - capacityName: string, - options?: FabricCapacitiesListSkusForCapacityOptionalParams, - ) => - fabricCapacitiesListSkusForCapacity( - context, - subscriptionId, - resourceGroupName, - capacityName, - options, - ), - listSkus: (options?: FabricCapacitiesListSkusOptionalParams) => - fabricCapacitiesListSkus(context, subscriptionId, options), - }; -} - -export function getFabricCapacitiesOperations( - context: FabricContext, - subscriptionId: string, -): FabricCapacitiesOperations { - return { - ...getFabricCapacities(context, subscriptionId), - }; -} diff --git a/sdk/fabric/arm-fabric/src/classic/index.ts b/sdk/fabric/arm-fabric/src/classic/index.ts deleted file mode 100644 index 40e9adc84a03..000000000000 --- a/sdk/fabric/arm-fabric/src/classic/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { FabricCapacitiesOperations } from "./fabricCapacities/index.js"; -export { OperationsOperations } from "./operations/index.js"; diff --git a/sdk/fabric/arm-fabric/src/classic/operations/index.ts b/sdk/fabric/arm-fabric/src/classic/operations/index.ts deleted file mode 100644 index 9c58c5b2ee94..000000000000 --- a/sdk/fabric/arm-fabric/src/classic/operations/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricContext } from "../../api/fabricContext.js"; -import { operationsList } from "../../api/operations/index.js"; -import { OperationsListOptionalParams } from "../../api/options.js"; -import { Operation } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; - -/** Interface representing a Operations operations. */ -export interface OperationsOperations { - /** List the operations for the provider */ - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; -} - -export function getOperations(context: FabricContext) { - return { - list: (options?: OperationsListOptionalParams) => operationsList(context, options), - }; -} - -export function getOperationsOperations(context: FabricContext): OperationsOperations { - return { - ...getOperations(context), - }; -} diff --git a/sdk/fabric/arm-fabric/src/fabricClient.ts b/sdk/fabric/arm-fabric/src/fabricClient.ts deleted file mode 100644 index 9c357dbe5f71..000000000000 --- a/sdk/fabric/arm-fabric/src/fabricClient.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - getFabricCapacitiesOperations, - FabricCapacitiesOperations, -} from "./classic/fabricCapacities/index.js"; -import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js"; -import { createFabric, FabricContext, FabricClientOptionalParams } from "./api/index.js"; -import { Pipeline } from "@azure/core-rest-pipeline"; -import { TokenCredential } from "@azure/core-auth"; - -export { FabricClientOptionalParams } from "./api/fabricContext.js"; - -export class FabricClient { - private _client: FabricContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - constructor( - credential: TokenCredential, - subscriptionId: string, - options: FabricClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : "azsdk-js-client"; - this._client = createFabric(credential, { - ...options, - userAgentOptions: { userAgentPrefix }, - }); - this.pipeline = this._client.pipeline; - this.fabricCapacities = getFabricCapacitiesOperations(this._client, subscriptionId); - this.operations = getOperationsOperations(this._client); - } - - /** The operation groups for FabricCapacities */ - public readonly fabricCapacities: FabricCapacitiesOperations; - /** The operation groups for Operations */ - public readonly operations: OperationsOperations; -} diff --git a/sdk/fabric/arm-fabric/src/helpers/serializerHelpers.ts b/sdk/fabric/arm-fabric/src/helpers/serializerHelpers.ts deleted file mode 100644 index 7518a16c2ee9..000000000000 --- a/sdk/fabric/arm-fabric/src/helpers/serializerHelpers.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export function serializeRecord( - item: Record, -): Record; -export function serializeRecord( - item: Record, - serializer: (item: T) => R, -): Record; -export function serializeRecord( - item: Record, - serializer?: (item: T) => R, -): Record { - return Object.keys(item).reduce( - (acc, key) => { - if (isSupportedRecordType(item[key])) { - acc[key] = item[key] as any; - } else if (serializer) { - const value = item[key]; - if (value !== undefined) { - acc[key] = serializer(value); - } - } else { - console.warn(`Don't know how to serialize ${item[key]}`); - acc[key] = item[key] as any; - } - return acc; - }, - {} as Record, - ); -} - -function isSupportedRecordType(t: any) { - return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date; -} diff --git a/sdk/fabric/arm-fabric/src/index.ts b/sdk/fabric/arm-fabric/src/index.ts deleted file mode 100644 index 1d9521b30894..000000000000 --- a/sdk/fabric/arm-fabric/src/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - PageSettings, - ContinuablePage, - PagedAsyncIterableIterator, -} from "./static-helpers/pagingHelpers.js"; - -export { FabricClient } from "./fabricClient.js"; -export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; -export { - Operation, - OperationDisplay, - KnownOrigin, - Origin, - KnownActionType, - ActionType, - FabricCapacity, - FabricCapacityProperties, - ProvisioningState, - KnownProvisioningState, - KnownResourceState, - ResourceState, - CapacityAdministration, - RpSku, - KnownRpSkuTier, - RpSkuTier, - TrackedResource, - Resource, - SystemData, - KnownCreatedByType, - CreatedByType, - FabricCapacityUpdate, - FabricCapacityUpdateProperties, - CheckNameAvailabilityRequest, - CheckNameAvailabilityResponse, - KnownCheckNameAvailabilityReason, - CheckNameAvailabilityReason, - RpSkuDetailsForExistingResource, - RpSkuDetailsForNewResource, -} from "./models/index.js"; -export { - FabricClientOptionalParams, - FabricCapacitiesGetOptionalParams, - FabricCapacitiesCreateOrUpdateOptionalParams, - FabricCapacitiesUpdateOptionalParams, - FabricCapacitiesDeleteOptionalParams, - FabricCapacitiesListByResourceGroupOptionalParams, - FabricCapacitiesListBySubscriptionOptionalParams, - FabricCapacitiesResumeOptionalParams, - FabricCapacitiesSuspendOptionalParams, - FabricCapacitiesCheckNameAvailabilityOptionalParams, - FabricCapacitiesListSkusForCapacityOptionalParams, - FabricCapacitiesListSkusOptionalParams, - OperationsListOptionalParams, -} from "./api/index.js"; -export { FabricCapacitiesOperations, OperationsOperations } from "./classic/index.js"; -export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/fabric/arm-fabric/src/logger.ts b/sdk/fabric/arm-fabric/src/logger.ts deleted file mode 100644 index 20b808ae45c9..000000000000 --- a/sdk/fabric/arm-fabric/src/logger.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { createClientLogger } from "@azure/logger"; -export const logger = createClientLogger("arm-fabric"); diff --git a/sdk/fabric/arm-fabric/src/models/index.ts b/sdk/fabric/arm-fabric/src/models/index.ts deleted file mode 100644 index 74e59c1d9a00..000000000000 --- a/sdk/fabric/arm-fabric/src/models/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { - Operation, - OperationDisplay, - KnownOrigin, - Origin, - KnownActionType, - ActionType, - FabricCapacity, - FabricCapacityProperties, - ProvisioningState, - KnownProvisioningState, - KnownResourceState, - ResourceState, - CapacityAdministration, - RpSku, - KnownRpSkuTier, - RpSkuTier, - TrackedResource, - Resource, - SystemData, - KnownCreatedByType, - CreatedByType, - FabricCapacityUpdate, - FabricCapacityUpdateProperties, - CheckNameAvailabilityRequest, - CheckNameAvailabilityResponse, - KnownCheckNameAvailabilityReason, - CheckNameAvailabilityReason, - RpSkuDetailsForExistingResource, - RpSkuDetailsForNewResource, -} from "./models.js"; diff --git a/sdk/fabric/arm-fabric/src/models/models.ts b/sdk/fabric/arm-fabric/src/models/models.ts deleted file mode 100644 index b564a5d1eedb..000000000000 --- a/sdk/fabric/arm-fabric/src/models/models.ts +++ /dev/null @@ -1,609 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** 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 interface _OperationListResult { - /** The Operation items on this page */ - value: Operation[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _operationListResultDeserializer(item: any): _OperationListResult { - return { - value: operationArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** 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?: OperationDisplay; - /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ - readonly origin?: Origin; - /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ - actionType?: ActionType; -} - -export function operationDeserializer(item: any): Operation { - return { - name: item["name"], - isDataAction: item["isDataAction"], - display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), - origin: item["origin"], - actionType: item["actionType"], - }; -} - -/** Localized display information for and operation. */ -export interface OperationDisplay { - /** 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; -} - -export function operationDisplayDeserializer(item: any): OperationDisplay { - return { - provider: item["provider"], - resource: item["resource"], - operation: item["operation"], - description: item["description"], - }; -} - -/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -export enum KnownOrigin { - /** Indicates the operation is initiated by a user. */ - User = "user", - /** Indicates the operation is initiated by a system. */ - System = "system", - /** Indicates the operation is initiated by a user or system. */ - UserSystem = "user,system", -} - -/** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user**: Indicates the operation is initiated by a user. \ - * **system**: Indicates the operation is initiated by a system. \ - * **user,system**: Indicates the operation is initiated by a user or system. - */ -export type Origin = string; - -/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -export enum KnownActionType { - /** Actions are for internal-only APIs. */ - Internal = "Internal", -} - -/** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal**: Actions are for internal-only APIs. - */ -export type ActionType = string; - -export function operationArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return operationDeserializer(item); - }); -} - -/** Fabric Capacity resource */ -export interface FabricCapacity extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties: FabricCapacityProperties; - /** The SKU details */ - sku: RpSku; -} - -export function fabricCapacitySerializer(item: FabricCapacity): any { - return { - tags: item["tags"], - location: item["location"], - properties: fabricCapacityPropertiesSerializer(item["properties"]), - sku: rpSkuSerializer(item["sku"]), - }; -} - -export function fabricCapacityDeserializer(item: any): FabricCapacity { - return { - tags: item["tags"], - location: item["location"], - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - properties: fabricCapacityPropertiesDeserializer(item["properties"]), - sku: rpSkuDeserializer(item["sku"]), - }; -} - -/** The Microsoft Fabric capacity properties. */ -export interface FabricCapacityProperties { - /** The current deployment state of Microsoft Fabric resource. The provisioningState is to indicate states for resource provisioning. */ - readonly provisioningState?: ProvisioningState; - /** The current state of Microsoft Fabric resource. The state is to indicate more states outside of resource provisioning. */ - readonly state?: ResourceState; - /** The capacity administration */ - administration: CapacityAdministration; -} - -export function fabricCapacityPropertiesSerializer(item: FabricCapacityProperties): any { - return { - administration: capacityAdministrationSerializer(item["administration"]), - }; -} - -export function fabricCapacityPropertiesDeserializer(item: any): FabricCapacityProperties { - return { - provisioningState: !item["provisioningState"] - ? item["provisioningState"] - : provisioningStateDeserializer(item["provisioningState"]), - state: item["state"], - administration: capacityAdministrationDeserializer(item["administration"]), - }; -} - -/** Known values of {@link ProvisioningState} that the service accepts. */ -export enum KnownProvisioningState { - /** Succeeded */ - Succeeded = "Succeeded", - /** Failed */ - Failed = "Failed", - /** Canceled */ - Canceled = "Canceled", - /** Deleting */ - Deleting = "Deleting", - /** Provisioning */ - Provisioning = "Provisioning", - /** Updating */ - Updating = "Updating", -} - -/** - * The provisioning state of a resource type. \ - * {@link KnownProvisioningState} can be used interchangeably with ResourceProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Succeeded** \ - * **Failed** \ - * **Canceled** \ - * **Deleting** \ - * **Provisioning** \ - * **Updating** - */ -/** Alias for ProvisioningState */ -export type ProvisioningState = string; -export function provisioningStateSerializer(item: ProvisioningState): any { - return item; -} - -export function provisioningStateDeserializer(item: any): ProvisioningState { - return item; -} - -/** The state of the Fabric capacity resource. */ -export enum KnownResourceState { - /** Resource is active */ - Active = "Active", - /** Resource is provisioning */ - Provisioning = "Provisioning", - /** Resource is failed */ - Failed = "Failed", - /** Resource is updating */ - Updating = "Updating", - /** Resource is deleting */ - Deleting = "Deleting", - /** Resource is suspending */ - Suspending = "Suspending", - /** Resource is suspended */ - Suspended = "Suspended", - /** Resource is pausing */ - Pausing = "Pausing", - /** Resource is paused */ - Paused = "Paused", - /** Resource is resuming */ - Resuming = "Resuming", - /** Resource is scaling */ - Scaling = "Scaling", - /** Resource is preparing */ - Preparing = "Preparing", -} - -/** - * The state of the Fabric capacity resource. \ - * {@link KnownResourceState} can be used interchangeably with ResourceState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active**: Resource is active \ - * **Provisioning**: Resource is provisioning \ - * **Failed**: Resource is failed \ - * **Updating**: Resource is updating \ - * **Deleting**: Resource is deleting \ - * **Suspending**: Resource is suspending \ - * **Suspended**: Resource is suspended \ - * **Pausing**: Resource is pausing \ - * **Paused**: Resource is paused \ - * **Resuming**: Resource is resuming \ - * **Scaling**: Resource is scaling \ - * **Preparing**: Resource is preparing - */ -export type ResourceState = string; - -/** The administration properties of the Fabric capacity resource */ -export interface CapacityAdministration { - /** An array of administrator user identities. */ - members: string[]; -} - -export function capacityAdministrationSerializer(item: CapacityAdministration): any { - return { - members: item["members"].map((p: any) => { - return p; - }), - }; -} - -export function capacityAdministrationDeserializer(item: any): CapacityAdministration { - return { - members: item["members"].map((p: any) => { - return p; - }), - }; -} - -/** Represents the SKU name and Azure pricing tier for Microsoft Fabric capacity resource. */ -export interface RpSku { - /** The name of the SKU level. */ - name: string; - /** The name of the Azure pricing tier to which the SKU applies. */ - tier: RpSkuTier; -} - -export function rpSkuSerializer(item: RpSku): any { - return { name: item["name"], tier: item["tier"] }; -} - -export function rpSkuDeserializer(item: any): RpSku { - return { - name: item["name"], - tier: item["tier"], - }; -} - -/** The name of the Azure pricing tier to which the SKU applies. */ -export enum KnownRpSkuTier { - /** Fabric tier */ - Fabric = "Fabric", -} - -/** - * The name of the Azure pricing tier to which the SKU applies. \ - * {@link KnownRpSkuTier} can be used interchangeably with RpSkuTier, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Fabric**: Fabric tier - */ -export type RpSkuTier = 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; -} - -export function trackedResourceSerializer(item: TrackedResource): any { - return { tags: item["tags"], location: item["location"] }; -} - -export function trackedResourceDeserializer(item: any): TrackedResource { - return { - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - tags: item["tags"], - location: item["location"], - }; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - 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?: SystemData; -} - -export function resourceSerializer(item: Resource): any { - return item; -} - -export function resourceDeserializer(item: any): Resource { - return { - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - }; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -export function systemDataDeserializer(item: any): SystemData { - return { - createdBy: item["createdBy"], - createdByType: item["createdByType"], - createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), - lastModifiedBy: item["lastModifiedBy"], - lastModifiedByType: item["lastModifiedByType"], - lastModifiedAt: !item["lastModifiedAt"] - ? item["lastModifiedAt"] - : new Date(item["lastModifiedAt"]), - }; -} - -/** The kind of entity that created the resource. */ -export enum KnownCreatedByType { - /** The entity was created by a user. */ - User = "User", - /** The entity was created by an application. */ - Application = "Application", - /** The entity was created by a managed identity. */ - ManagedIdentity = "ManagedIdentity", - /** The entity was created by a key. */ - Key = "Key", -} - -/** - * The kind of entity that created the resource. \ - * {@link KnowncreatedByType} can be used interchangeably with createdByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User**: The entity was created by a user. \ - * **Application**: The entity was created by an application. \ - * **ManagedIdentity**: The entity was created by a managed identity. \ - * **Key**: The entity was created by a key. - */ -export type CreatedByType = string; - -/** The type used for update operations of the FabricCapacity. */ -export interface FabricCapacityUpdate { - /** The SKU details */ - sku?: RpSku; - /** Resource tags. */ - tags?: Record; - /** The resource-specific properties for this resource. */ - properties?: FabricCapacityUpdateProperties; -} - -export function fabricCapacityUpdateSerializer(item: FabricCapacityUpdate): any { - return { - sku: !item["sku"] ? item["sku"] : rpSkuSerializer(item["sku"]), - tags: item["tags"], - properties: !item["properties"] - ? item["properties"] - : fabricCapacityUpdatePropertiesSerializer(item["properties"]), - }; -} - -/** The updatable properties of the FabricCapacity. */ -export interface FabricCapacityUpdateProperties { - /** The capacity administration */ - administration?: CapacityAdministration; -} - -export function fabricCapacityUpdatePropertiesSerializer( - item: FabricCapacityUpdateProperties, -): any { - return { - administration: !item["administration"] - ? item["administration"] - : capacityAdministrationSerializer(item["administration"]), - }; -} - -/** The response of a FabricCapacity list operation. */ -export interface _FabricCapacityListResult { - /** The FabricCapacity items on this page */ - value: FabricCapacity[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _fabricCapacityListResultDeserializer(item: any): _FabricCapacityListResult { - return { - value: fabricCapacityArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -export function fabricCapacityArraySerializer(result: Array): any[] { - return result.map((item) => { - return fabricCapacitySerializer(item); - }); -} - -export function fabricCapacityArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return fabricCapacityDeserializer(item); - }); -} - -/** The check availability request body. */ -export interface CheckNameAvailabilityRequest { - /** The name of the resource for which availability needs to be checked. */ - name?: string; - /** The resource type. */ - type?: string; -} - -export function checkNameAvailabilityRequestSerializer(item: CheckNameAvailabilityRequest): any { - return { name: item["name"], type: item["type"] }; -} - -/** The check availability result. */ -export interface CheckNameAvailabilityResponse { - /** Indicates if the resource name is available. */ - nameAvailable?: boolean; - /** The reason why the given name is not available. */ - reason?: CheckNameAvailabilityReason; - /** Detailed reason why the given name is not available. */ - message?: string; -} - -export function checkNameAvailabilityResponseDeserializer( - item: any, -): CheckNameAvailabilityResponse { - return { - nameAvailable: item["nameAvailable"], - reason: item["reason"], - message: item["message"], - }; -} - -/** Possible reasons for a name not being available. */ -export enum KnownCheckNameAvailabilityReason { - /** Name is invalid. */ - Invalid = "Invalid", - /** Name already exists. */ - AlreadyExists = "AlreadyExists", -} - -/** - * Possible reasons for a name not being available. \ - * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Invalid**: Name is invalid. \ - * **AlreadyExists**: Name already exists. - */ -export type CheckNameAvailabilityReason = string; - -/** An object that represents enumerating SKUs for existing resources */ -export interface _RpSkuEnumerationForExistingResourceResult { - /** The SKU details */ - value: RpSkuDetailsForExistingResource[]; - /** Url for the next page. Null if no more pages available */ - nextLink?: string; -} - -export function _rpSkuEnumerationForExistingResourceResultDeserializer( - item: any, -): _RpSkuEnumerationForExistingResourceResult { - return { - value: rpSkuDetailsForExistingResourceArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -/** An object that represents SKU details for existing resources */ -export interface RpSkuDetailsForExistingResource { - /** The resource type */ - resourceType: string; - /** The SKU details */ - sku: RpSku; -} - -export function rpSkuDetailsForExistingResourceDeserializer( - item: any, -): RpSkuDetailsForExistingResource { - return { - resourceType: item["resourceType"], - sku: rpSkuDeserializer(item["sku"]), - }; -} - -export function rpSkuDetailsForExistingResourceArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return rpSkuDetailsForExistingResourceDeserializer(item); - }); -} - -/** An object that represents enumerating SKUs for new resources. */ -export interface _RpSkuEnumerationForNewResourceResult { - /** The collection of available SKUs for new resources */ - value: RpSkuDetailsForNewResource[]; - /** Url for the next page. Null if no more pages available */ - nextLink?: string; -} - -export function _rpSkuEnumerationForNewResourceResultDeserializer( - item: any, -): _RpSkuEnumerationForNewResourceResult { - return { - value: rpSkuDetailsForNewResourceArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -/** The SKU details */ -export interface RpSkuDetailsForNewResource { - /** The resource type */ - resourceType: string; - /** The SKU's name */ - name: string; - /** The list of available locations for the SKU */ - locations: string[]; -} - -export function rpSkuDetailsForNewResourceDeserializer(item: any): RpSkuDetailsForNewResource { - return { - resourceType: item["resourceType"], - name: item["name"], - locations: item["locations"].map((p: any) => { - return p; - }), - }; -} - -export function rpSkuDetailsForNewResourceArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return rpSkuDetailsForNewResourceDeserializer(item); - }); -} diff --git a/sdk/fabric/arm-fabric/src/restorePollerHelpers.ts b/sdk/fabric/arm-fabric/src/restorePollerHelpers.ts deleted file mode 100644 index 5d85be3db9cc..000000000000 --- a/sdk/fabric/arm-fabric/src/restorePollerHelpers.ts +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { FabricClient } from "./fabricClient.js"; -import { - _fabricCapacitiesCreateOrUpdateDeserialize, - _fabricCapacitiesUpdateDeserialize, - _fabricCapacitiesDeleteDeserialize, - _fabricCapacitiesResumeDeserialize, - _fabricCapacitiesSuspendDeserialize, -} from "./api/fabricCapacities/index.js"; -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, - TResponse extends PathUncheckedResponse = PathUncheckedResponse, -> extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** - * The signal which can be used to abort requests. - */ - abortSignal?: AbortSignalLike; - /** Deserialization function for raw response body */ - processResponseBody?: (result: TResponse) => Promise; -} - -/** - * Creates a poller from the serialized state of another poller. This can be - * useful when you want to create pollers on a different host or a poller - * needs to be constructed after the original one is not in scope. - */ -export function restorePoller( - client: FabricClient, - serializedState: string, - sourceOperation: (...args: any[]) => PollerLike, TResult>, - options?: RestorePollerOptions, -): PollerLike, TResult> { - const pollerConfig = deserializeState(serializedState).config; - const { initialRequestUrl, requestMethod, metadata } = pollerConfig; - if (!initialRequestUrl || !requestMethod) { - throw new Error( - `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, - ); - } - const resourceLocationConfig = metadata?.["resourceLocationConfig"] as - | ResourceLocationConfig - | undefined; - 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}.`, - ); - } - return getLongRunningPoller( - (client as any)["_client"] ?? client, - deserializeHelper as (result: TResponse) => Promise, - expectedStatuses, - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - resourceLocationConfig, - restoreFrom: serializedState, - initialRequestUrl, - }, - ); -} - -interface DeserializationHelper { - deserializer: Function; - expectedStatuses: string[]; -} - -const deserializeMap: Record = { - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}": - { - deserializer: _fabricCapacitiesCreateOrUpdateDeserialize, - expectedStatuses: ["200", "201"], - }, - "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}": - { - deserializer: _fabricCapacitiesUpdateDeserialize, - expectedStatuses: ["200", "202"], - }, - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}": - { - deserializer: _fabricCapacitiesDeleteDeserialize, - expectedStatuses: ["202", "204", "200"], - }, - "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/resume": - { - deserializer: _fabricCapacitiesResumeDeserialize, - expectedStatuses: ["200", "202"], - }, - "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/suspend": - { - deserializer: _fabricCapacitiesSuspendDeserialize, - expectedStatuses: ["200", "202"], - }, -}; - -function getDeserializationHelper( - urlStr: string, - method: string, -): DeserializationHelper | undefined { - const path = new URL(urlStr).pathname; - 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: DeserializationHelper | undefined; - - // Iterate the responseMap to find a match - for (const [key, value] of Object.entries(deserializeMap)) { - // 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/fabric/arm-fabric/src/static-helpers/pagingHelpers.ts b/sdk/fabric/arm-fabric/src/static-helpers/pagingHelpers.ts deleted file mode 100644 index ce33af5f4178..000000000000 --- a/sdk/fabric/arm-fabric/src/static-helpers/pagingHelpers.ts +++ /dev/null @@ -1,241 +0,0 @@ -// 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"; - -/** - * 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; -} - -/** - * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator - */ -export function buildPagedAsyncIterator< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, - TResponse extends PathUncheckedResponse = PathUncheckedResponse, ->( - client: Client, - getInitialResponse: () => PromiseLike, - processResponseBody: (result: TResponse) => PromiseLike, - expectedStatuses: string[], - options: BuildPagedAsyncIteratorOptions = {}, -): PagedAsyncIterableIterator { - const itemName = options.itemName ?? "value"; - const nextLinkName = options.nextLinkName ?? "nextLink"; - const pagedResult: PagedResult = { - getPage: async (pageLink?: string) => { - const result = - pageLink === undefined - ? await getInitialResponse() - : await client.pathUnchecked(pageLink).get(); - checkPagingRequest(result, expectedStatuses); - const results = await processResponseBody(result as TResponse); - const nextLink = getNextLink(results, nextLinkName); - const values = getElements(results, itemName) as TPage; - return { - page: values, - nextPageLink: nextLink, - }; - }, - byPage: (settings?: TPageSettings) => { - const { continuationToken } = settings ?? {}; - return getPageAsyncIterator(pagedResult, { - pageLink: continuationToken, - }); - }, - }; - return getPagedAsyncIterator(pagedResult); -} - -/** - * returns an async iterator that iterates over results. It also has a `byPage` - * method that returns pages of items at once. - * - * @param pagedResult - an object that specifies how to get pages. - * @returns a paged async iterator that iterates over results. - */ - -function getPagedAsyncIterator< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, ->( - pagedResult: PagedResult, -): PagedAsyncIterableIterator { - const iter = getItemAsyncIterator(pagedResult); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: - pagedResult?.byPage ?? - ((settings?: TPageSettings) => { - const { continuationToken } = settings ?? {}; - return getPageAsyncIterator(pagedResult, { - pageLink: continuationToken, - }); - }), - }; -} - -async function* getItemAsyncIterator( - pagedResult: PagedResult, -): AsyncIterableIterator { - const pages = getPageAsyncIterator(pagedResult); - for await (const page of pages) { - yield* page as unknown as TElement[]; - } -} - -async function* getPageAsyncIterator( - pagedResult: PagedResult, - options: { - pageLink?: string; - } = {}, -): AsyncIterableIterator> { - const { pageLink } = options; - let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); - if (!response) { - return; - } - let result = response.page as ContinuablePage; - result.continuationToken = response.nextPageLink; - yield result; - while (response.nextPageLink) { - response = await pagedResult.getPage(response.nextPageLink); - if (!response) { - return; - } - result = response.page as ContinuablePage; - result.continuationToken = response.nextPageLink; - yield result; - } -} - -/** - * 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" && nextLink !== null) { - throw new RestError( - `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, - ); - } - - if (nextLink === null) { - return 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[]; - if (!Array.isArray(value)) { - throw new RestError( - `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, expectedStatuses: string[]): void { - if (!expectedStatuses.includes(response.status)) { - throw createRestError( - `Pagination failed with unexpected statusCode ${response.status}`, - response, - ); - } -} diff --git a/sdk/fabric/arm-fabric/src/static-helpers/pollingHelpers.ts b/sdk/fabric/arm-fabric/src/static-helpers/pollingHelpers.ts deleted file mode 100644 index f01c41bab69d..000000000000 --- a/sdk/fabric/arm-fabric/src/static-helpers/pollingHelpers.ts +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - PollerLike, - OperationState, - ResourceLocationConfig, - RunningOperation, - createHttpPoller, - OperationResponse, -} from "@azure/core-lro"; - -import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; - -export interface GetLongRunningPollerOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** - * The signal which can be used to abort requests. - */ - abortSignal?: AbortSignalLike; - /** - * The potential location of the result of the LRO if specified by the LRO extension in the swagger. - */ - resourceLocationConfig?: ResourceLocationConfig; - /** - * The original url of the LRO - * Should not be null when restoreFrom is set - */ - initialRequestUrl?: string; - /** - * A serialized poller which can be used to resume an existing paused Long-Running-Operation. - */ - restoreFrom?: string; - /** - * The function to get the initial response - */ - getInitialResponse?: () => PromiseLike; -} -export function getLongRunningPoller( - 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"); - } - 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"); - } - initialResponse = await getInitialResponse(); - return getLroResponse(initialResponse, expectedStatuses); - }, - sendPollRequest: async ( - path: string, - pollOptions?: { - abortSignal?: AbortSignalLike; - }, - ) => { - // The poll request would both listen to the user provided abort signal and the poller's own abort signal - function abortListener(): void { - pollAbortController.abort(); - } - const abortSignal = pollAbortController.signal; - if (options.abortSignal?.aborted) { - pollAbortController.abort(); - } else if (pollOptions?.abortSignal?.aborted) { - pollAbortController.abort(); - } else if (!abortSignal.aborted) { - options.abortSignal?.addEventListener("abort", abortListener, { - once: true, - }); - pollOptions?.abortSignal?.addEventListener("abort", abortListener, { - once: true, - }); - } - let response; - try { - response = await client.pathUnchecked(path).get({ abortSignal }); - } finally { - options.abortSignal?.removeEventListener("abort", abortListener); - pollOptions?.abortSignal?.removeEventListener("abort", abortListener); - } - - return getLroResponse(response as TResponse, expectedStatuses); - }, - }; - return createHttpPoller(poller, { - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: options?.resourceLocationConfig, - restoreFrom: options?.restoreFrom, - processResult: (result: unknown) => { - return processResponseBody(result as TResponse); - }, - }); -} -/** - * Converts a Rest Client response to a response that the LRO implementation understands - * @param response - a rest client http response - * @param deserializeFn - deserialize function to convert Rest response to modular output - * @returns - An LRO response that the LRO implementation understands - */ -function getLroResponse( - response: TResponse, - expectedStatuses: string[], -): OperationResponse { - if (!expectedStatuses.includes(response.status)) { - throw createRestError(response); - } - - return { - flatResponse: response, - rawResponse: { - ...response, - statusCode: Number.parseInt(response.status), - body: response.body, - }, - }; -} diff --git a/sdk/fabric/arm-fabric/test/public/fabric_operations_test.spec.ts b/sdk/fabric/arm-fabric/test/public/fabric_operations_test.spec.ts deleted file mode 100644 index a96a1519bbed..000000000000 --- a/sdk/fabric/arm-fabric/test/public/fabric_operations_test.spec.ts +++ /dev/null @@ -1,44 +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 } 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 { FabricClient } from "../../src/fabricClient.js"; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("Fabric test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: FabricClient; - - 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 FabricClient(credential, subscriptionId, recorder.configureClientOptions({})); - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("operations 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/fabric/arm-fabric/test/public/utils/recordedClient.ts b/sdk/fabric/arm-fabric/test/public/utils/recordedClient.ts deleted file mode 100644 index 527ccc9dee86..000000000000 --- a/sdk/fabric/arm-fabric/test/public/utils/recordedClient.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; - -const replaceableVariables: Record = { - SUBSCRIPTION_ID: "azure_subscription_id", -}; - -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 - ], -}; - -/** - * creates the recorder and reads the environment variables from the `.env` file. - * 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 { - const recorder = new Recorder(context); - await recorder.start(recorderEnvSetup); - return recorder; -} diff --git a/sdk/fabric/arm-fabric/tsconfig.browser.config.json b/sdk/fabric/arm-fabric/tsconfig.browser.config.json deleted file mode 100644 index 75871518e3a0..000000000000 --- a/sdk/fabric/arm-fabric/tsconfig.browser.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] -} diff --git a/sdk/fabric/arm-fabric/tsconfig.json b/sdk/fabric/arm-fabric/tsconfig.json deleted file mode 100644 index b186a5a177d8..000000000000 --- a/sdk/fabric/arm-fabric/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../../tsconfig", - "references": [ - { "path": "./tsconfig.src.json" }, - { "path": "./tsconfig.samples.json" }, - { "path": "./tsconfig.test.json" } - ], - "files": [] -} diff --git a/sdk/fabric/arm-fabric/tsconfig.samples.json b/sdk/fabric/arm-fabric/tsconfig.samples.json deleted file mode 100644 index 7e73912c3661..000000000000 --- a/sdk/fabric/arm-fabric/tsconfig.samples.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../../tsconfig.samples.base.json", - "compilerOptions": { - "paths": { - "@azure/arm-fabric": ["./dist/esm"] - } - } -} diff --git a/sdk/fabric/arm-fabric/tsconfig.src.json b/sdk/fabric/arm-fabric/tsconfig.src.json deleted file mode 100644 index bae70752dd38..000000000000 --- a/sdk/fabric/arm-fabric/tsconfig.src.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../../tsconfig.lib.json" -} diff --git a/sdk/fabric/arm-fabric/tsconfig.test.json b/sdk/fabric/arm-fabric/tsconfig.test.json deleted file mode 100644 index 290ca214aebc..000000000000 --- a/sdk/fabric/arm-fabric/tsconfig.test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] -} diff --git a/sdk/fabric/arm-fabric/tsp-location.yaml b/sdk/fabric/arm-fabric/tsp-location.yaml index 02e48bbae82f..bf5c37e71a7c 100644 --- a/sdk/fabric/arm-fabric/tsp-location.yaml +++ b/sdk/fabric/arm-fabric/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/fabric/Microsoft.Fabric.Management -commit: e6fde2ac19d0202f0e72217a3e0f9edb63dba273 -repo: Azure/azure-rest-api-specs -additionalDirectories: +commit: 25f910fdaf9854828cde4ab94bcaab9a4865e23a +repo: ../azure-rest-api-specs +additionalDirectories: diff --git a/sdk/fabric/arm-fabric/vitest.browser.config.ts b/sdk/fabric/arm-fabric/vitest.browser.config.ts deleted file mode 100644 index 93f3735b960c..000000000000 --- a/sdk/fabric/arm-fabric/vitest.browser.config.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig } from "vitest/config"; -import { relativeRecordingsPath } from "@azure-tools/test-recorder"; - -process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); - -export default defineConfig({ - define: { - "process.env": process.env, - }, - test: { - reporters: ["basic", "junit"], - outputFile: { - junit: "test-results.browser.xml", - }, - browser: { - enabled: true, - headless: true, - name: "chromium", - provider: "playwright", - }, - fakeTimers: { - toFake: ["setTimeout", "Date"], - }, - watch: false, - include: ["dist-test/browser/**/*.spec.js"], - coverage: { - include: ["dist-test/browser/**/*.spec.js"], - provider: "istanbul", - reporter: ["text", "json", "html"], - reportsDirectory: "coverage-browser", - }, - testTimeout: 1200000, - hookTimeout: 1200000 - }, -}); diff --git a/sdk/fabric/arm-fabric/vitest.config.ts b/sdk/fabric/arm-fabric/vitest.config.ts deleted file mode 100644 index 16ae9de89f77..000000000000 --- a/sdk/fabric/arm-fabric/vitest.config.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig } from "vitest/config"; -import { relativeRecordingsPath } from "@azure-tools/test-recorder"; - -export default defineConfig({ - test: { - typecheck: { - enabled: true, - tsconfig: "tsconfig.test.json", - include: ["test/**/*.ts", "test/**/*.mts", "test/**/*.cts"], - }, - reporters: ["basic", "junit"], - outputFile: { - junit: "test-results.browser.xml", - }, - fakeTimers: { - toFake: ["setTimeout", "Date"], - }, - watch: false, - include: ["test/**/*.spec.ts"], - exclude: ["test/**/browser/*.spec.ts"], - coverage: { - include: ["src/**/*.ts"], - exclude: [ - "src/**/*-browser.mts", - "src/**/*-react-native.mts", - "vitest*.config.ts", - "samples-dev/**/*.ts", - ], - provider: "istanbul", - reporter: ["text", "json", "html"], - reportsDirectory: "coverage", - }, - testTimeout: 1200000, - hookTimeout: 1200000 - }, -});